Source Code Cross Referenced for DCResultSetMetaData.java in  » J2EE » panther » org » lateralnz » c3d » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » panther » org.lateralnz.c3d 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* ====================================================================
002:         * The LateralNZ Software License, Version 1.0
003:         *
004:         * Copyright (c) 2003 LateralNZ.  All rights reserved.
005:         *
006:         * Redistribution and use in source and binary forms, with or without
007:         * modification, are permitted provided that the following conditions
008:         * are met:
009:         *
010:         * 1. Redistributions of source code must retain the above copyright
011:         *    notice, this list of conditions and the following disclaimer.
012:         *
013:         * 2. Redistributions in binary form must reproduce the above copyright
014:         *    notice, this list of conditions and the following disclaimer in
015:         *    the documentation and/or other materials provided with the
016:         *    distribution.
017:         *
018:         * 3. The end-user documentation included with the redistribution,
019:         *    if any, must include the following acknowledgment:
020:         *       "This product includes software developed by 
021:         *        LateralNZ (http://www.lateralnz.org/) and other third parties."
022:         *    Alternately, this acknowledgment may appear in the software itself,
023:         *    if and wherever such third-party acknowledgments normally appear.
024:         *
025:         * 4. The names "LateralNZ" must not be used to endorse or promote 
026:         *    products derived from this software without prior written 
027:         *    permission. For written permission, please 
028:         *    contact oss@lateralnz.org.
029:         *
030:         * 5. Products derived from this software may not be called "Panther", 
031:         *    or "Lateral" or "LateralNZ", nor may "PANTHER" or "LATERAL" or 
032:         *    "LATERALNZ" appear in their name, without prior written 
033:         *    permission of LateralNZ.
034:         *
035:         * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
036:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
037:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
038:         * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
039:         * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
040:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
041:         * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
042:         * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
043:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
044:         * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
045:         * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
046:         * SUCH DAMAGE.
047:         * ====================================================================
048:         *
049:         * This software consists of voluntary contributions made by many
050:         * individuals on behalf of LateralNZ.  For more
051:         * information on Lateral, please see http://www.lateralnz.com/ or
052:         * http://www.lateralnz.org
053:         *
054:         */
055:        package org.lateralnz.c3d;
056:
057:        import java.io.Serializable;
058:        import java.sql.ResultSetMetaData;
059:        import java.sql.SQLException;
060:        import java.sql.Types;
061:
062:        public class DCResultSetMetaData implements  Serializable,
063:                ResultSetMetaData {
064:
065:            private static final String INDEX_OUT_OF_RANGE = "index out of range";
066:            private static final String STRING_CLASSNAME = java.lang.String.class
067:                    .getName();
068:
069:            private String[] catalogNames;
070:            private String[] columnClassNames;
071:            private int columnCount;
072:            private int[] columnDisplaySizes;
073:            private String[] columnLabels;
074:            private String[] columnNames;
075:            private int[] columnTypes;
076:            private String[] columnTypeNames;
077:            private int[] precisions;
078:            private int[] scales;
079:            private String[] schemaNames;
080:            private String[] tableNames;
081:            private boolean[] autoIncrement;
082:            private boolean[] caseSensitive;
083:            private boolean[] currency;
084:            private int[] nullable;
085:            private boolean[] searchable;
086:            private boolean[] signed;
087:
088:            public DCResultSetMetaData() {
089:                columnCount = 0;
090:            }
091:
092:            public DCResultSetMetaData(String[] colNames) {
093:                columnCount = colNames.length;
094:
095:                init();
096:
097:                for (int i = 0; i < columnCount; i++) {
098:                    catalogNames[i] = "";
099:                    columnClassNames[i] = STRING_CLASSNAME;
100:                    columnDisplaySizes[i] = 1024;
101:                    columnLabels[i] = colNames[i];
102:                    columnNames[i] = colNames[i];
103:                    columnTypes[i] = Types.VARCHAR;
104:                    columnTypeNames[i] = "varchar";
105:                    precisions[i] = 0;
106:                    scales[i] = 0;
107:                    schemaNames[i] = "";
108:                    tableNames[i] = "";
109:                    autoIncrement[i] = false;
110:                    caseSensitive[i] = true;
111:                    currency[i] = false;
112:                    nullable[i] = ResultSetMetaData.columnNoNulls;
113:                    searchable[i] = false;
114:                    signed[i] = false;
115:                }
116:            }
117:
118:            public DCResultSetMetaData(ResultSetMetaData md)
119:                    throws SQLException {
120:                columnCount = md.getColumnCount();
121:                init();
122:
123:                for (int i = 0, j = 1; i < columnCount; i++, j++) {
124:                    catalogNames[i] = md.getCatalogName(j);
125:                    columnClassNames[i] = md.getColumnClassName(j);
126:                    columnDisplaySizes[i] = md.getColumnDisplaySize(j);
127:                    columnLabels[i] = md.getColumnLabel(j);
128:                    columnNames[i] = md.getColumnName(j);
129:                    columnTypes[i] = md.getColumnType(j);
130:                    columnTypeNames[i] = md.getColumnTypeName(j);
131:                    precisions[i] = md.getPrecision(j);
132:                    scales[i] = md.getScale(j);
133:                    schemaNames[i] = md.getSchemaName(j);
134:                    tableNames[i] = md.getTableName(j);
135:                    autoIncrement[i] = md.isAutoIncrement(j);
136:                    caseSensitive[i] = md.isCaseSensitive(j);
137:                    currency[i] = md.isCurrency(j);
138:                    nullable[i] = md.isNullable(j);
139:                    searchable[i] = md.isSearchable(j);
140:                    signed[i] = md.isSigned(j);
141:                }
142:            }
143:
144:            private void init() {
145:                catalogNames = new String[columnCount];
146:                columnClassNames = new String[columnCount];
147:                columnDisplaySizes = new int[columnCount];
148:                columnLabels = new String[columnCount];
149:                columnNames = new String[columnCount];
150:                columnTypes = new int[columnCount];
151:                columnTypeNames = new String[columnCount];
152:                precisions = new int[columnCount];
153:                scales = new int[columnCount];
154:                schemaNames = new String[columnCount];
155:                tableNames = new String[columnCount];
156:                autoIncrement = new boolean[columnCount];
157:                caseSensitive = new boolean[columnCount];
158:                currency = new boolean[columnCount];
159:                nullable = new int[columnCount];
160:                searchable = new boolean[columnCount];
161:                signed = new boolean[columnCount];
162:            }
163:
164:            public String getCatalogName(int param) throws SQLException {
165:                param = param - 1;
166:                if (catalogNames == null || param > catalogNames.length) {
167:                    throw new SQLException(INDEX_OUT_OF_RANGE);
168:                }
169:                return catalogNames[param];
170:            }
171:
172:            public String getColumnClassName(int param) throws SQLException {
173:                param = param - 1;
174:                if (columnClassNames == null || param > columnClassNames.length) {
175:                    throw new SQLException(INDEX_OUT_OF_RANGE);
176:                }
177:                return columnClassNames[param];
178:            }
179:
180:            public int getColumnCount() throws SQLException {
181:                return columnCount;
182:            }
183:
184:            public int getColumnDisplaySize(int param) throws SQLException {
185:                param = param - 1;
186:                if (columnDisplaySizes == null
187:                        || param > columnDisplaySizes.length) {
188:                    throw new SQLException(INDEX_OUT_OF_RANGE);
189:                }
190:                return columnDisplaySizes[param];
191:            }
192:
193:            public String getColumnLabel(int param) throws SQLException {
194:                param = param - 1;
195:                if (columnLabels == null || param > columnLabels.length) {
196:                    throw new SQLException(INDEX_OUT_OF_RANGE);
197:                }
198:                return columnLabels[param];
199:            }
200:
201:            public String getColumnName(int param) throws SQLException {
202:                param = param - 1;
203:                if (columnNames == null || param > columnNames.length) {
204:                    throw new SQLException(INDEX_OUT_OF_RANGE);
205:                }
206:                return columnNames[param];
207:            }
208:
209:            public int getColumnType(int param) throws SQLException {
210:                param = param - 1;
211:                if (columnTypes == null || param > columnTypes.length) {
212:                    throw new SQLException(INDEX_OUT_OF_RANGE);
213:                }
214:                return columnTypes[param];
215:            }
216:
217:            public String getColumnTypeName(int param) throws SQLException {
218:                param = param - 1;
219:                if (columnTypeNames == null || param > columnTypeNames.length) {
220:                    throw new SQLException(INDEX_OUT_OF_RANGE);
221:                }
222:                return columnTypeNames[param];
223:            }
224:
225:            public int getPrecision(int param) throws SQLException {
226:                param = param - 1;
227:                if (precisions == null || param > precisions.length) {
228:                    throw new SQLException(INDEX_OUT_OF_RANGE);
229:                }
230:                return precisions[param];
231:            }
232:
233:            public int getScale(int param) throws SQLException {
234:                param = param - 1;
235:                if (scales == null || param > scales.length) {
236:                    throw new SQLException(INDEX_OUT_OF_RANGE);
237:                }
238:                return scales[param];
239:            }
240:
241:            public String getSchemaName(int param) throws SQLException {
242:                param = param - 1;
243:                if (schemaNames == null || param > schemaNames.length) {
244:                    throw new SQLException(INDEX_OUT_OF_RANGE);
245:                }
246:                return schemaNames[param];
247:            }
248:
249:            public String getTableName(int param) throws SQLException {
250:                param = param - 1;
251:                if (tableNames == null || param > tableNames.length) {
252:                    throw new SQLException(INDEX_OUT_OF_RANGE);
253:                }
254:                return tableNames[param];
255:            }
256:
257:            public boolean isAutoIncrement(int param) throws SQLException {
258:                param = param - 1;
259:                if (autoIncrement == null || param > autoIncrement.length) {
260:                    throw new SQLException(INDEX_OUT_OF_RANGE);
261:                }
262:                return autoIncrement[param];
263:            }
264:
265:            public boolean isCaseSensitive(int param) throws SQLException {
266:                param = param - 1;
267:                if (caseSensitive == null || param > caseSensitive.length) {
268:                    throw new SQLException(INDEX_OUT_OF_RANGE);
269:                }
270:                return caseSensitive[param];
271:            }
272:
273:            public boolean isCurrency(int param) throws SQLException {
274:                param = param - 1;
275:                if (currency == null || param > currency.length) {
276:                    throw new SQLException(INDEX_OUT_OF_RANGE);
277:                }
278:                return currency[param];
279:            }
280:
281:            public boolean isDefinitelyWritable(int param) throws SQLException {
282:                return false;
283:            }
284:
285:            public int isNullable(int param) throws SQLException {
286:                param = param - 1;
287:                if (nullable == null || param > nullable.length) {
288:                    throw new SQLException(INDEX_OUT_OF_RANGE);
289:                }
290:                return nullable[param];
291:            }
292:
293:            public boolean isReadOnly(int param) throws SQLException {
294:                return true;
295:            }
296:
297:            public boolean isSearchable(int param) throws SQLException {
298:                param = param - 1;
299:                if (searchable == null || param > searchable.length) {
300:                    throw new SQLException(INDEX_OUT_OF_RANGE);
301:                }
302:                return searchable[param];
303:            }
304:
305:            public boolean isSigned(int param) throws SQLException {
306:                param = param - 1;
307:                if (signed == null || param > signed.length) {
308:                    throw new SQLException(INDEX_OUT_OF_RANGE);
309:                }
310:                return signed[param];
311:            }
312:
313:            public boolean isWritable(int param) throws SQLException {
314:                return false;
315:            }
316:
317:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.