Source Code Cross Referenced for ResultSetMetaData.java in  » Database-JDBC-Connection-Pool » octopus » com » internetcds » jdbc » tds » 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 » Database JDBC Connection Pool » octopus » com.internetcds.jdbc.tds 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //                                                                            
002:        // Copyright 1998 CDS Networks, Inc., Medford Oregon                          
003:        //                                                                            
004:        // 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 are met:
008:        // 1. Redistributions of source code must retain the above copyright          
009:        //    notice, this list of conditions and the following disclaimer.           
010:        // 2. Redistributions in binary form must reproduce the above copyright       
011:        //    notice, this list of conditions and the following disclaimer in the     
012:        //    documentation and/or other materials provided with the distribution.    
013:        // 3. All advertising materials mentioning features or use of this software   
014:        //    must display the following acknowledgement:                             
015:        //      This product includes software developed by CDS Networks, Inc.        
016:        // 4. The name of CDS Networks, Inc.  may not be used to endorse or promote   
017:        //    products derived from this software without specific prior              
018:        //    written permission.                                                     
019:        //                                                                            
020:        // THIS SOFTWARE IS PROVIDED BY CDS NETWORKS, INC. ``AS IS'' AND              
021:        // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE      
022:        // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
023:        // ARE DISCLAIMED.  IN NO EVENT SHALL CDS NETWORKS, INC. BE LIABLE            
024:        // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
025:        // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS    
026:        // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)      
027:        // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
028:        // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY  
029:        // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF     
030:        // SUCH DAMAGE.                                                               
031:        //                                                                            
032:
033:        package com.internetcds.jdbc.tds;
034:
035:        import java.sql.*;
036:
037:        /**
038:         * A ResultSetMetaData object can be used to find out about the types
039:         * and properties of the columns in a ResultSet.
040:         *
041:         * @author Craig Spannring
042:         * @version $Id: ResultSetMetaData.java,v 1.1 2007-10-19 13:23:55 sinisa Exp $
043:         */
044:        public class ResultSetMetaData implements  java.sql.ResultSetMetaData {
045:            public static final String cvsVersion = "$Id: ResultSetMetaData.java,v 1.1 2007-10-19 13:23:55 sinisa Exp $";
046:
047:            /**
048:             * Does not allow NULL values.
049:             */
050:            public static final int columnNoNulls = 0;
051:
052:            /**
053:             * Allows NULL values.
054:             */
055:            public static final int columnNullable = 1;
056:
057:            /**
058:             * Nullability unknown.
059:             */
060:            public static final int columnNullableUnknown = 2;
061:
062:            private Columns columnsInfo;
063:
064:            private void NotImplemented() throws SQLException {
065:
066:                throw new SQLException("Not implemented");
067:            }
068:
069:            public ResultSetMetaData(Columns columns_) {
070:                columnsInfo = columns_;
071:            }
072:
073:            /**
074:             * What's a column's table's catalog name?
075:             *
076:             * @param column the first column is 1, the second is 2, ...
077:             * @return column name or "" if not applicable.
078:             * @exception SQLException if a database-access error occurs.
079:             */
080:            public String getCatalogName(int column) throws SQLException {
081:                NotImplemented();
082:                return null;
083:            }
084:
085:            /**
086:             * What's the number of columns in the ResultSet?
087:             *
088:             * @return the number
089:             * @exception SQLException if a database-access error occurs.
090:             */
091:            public int getColumnCount() throws SQLException {
092:                return columnsInfo.getColumnCount();
093:            }
094:
095:            /**
096:             * What's the column's normal max width in chars?
097:             *
098:             * @param column the first column is 1, the second is 2, ...
099:             * @return max width
100:             * @exception SQLException if a database-access error occurs.
101:             */
102:            public int getColumnDisplaySize(int column) throws SQLException {
103:                return columnsInfo.getDisplaySize(column);
104:            }
105:
106:            /**
107:             * What's the suggested column title for use in printouts and
108:             * displays?
109:             *
110:             * @param column the first column is 1, the second is 2, ...
111:             * @return true if so
112:             * @exception SQLException if a database-access error occurs.
113:             */
114:            public String getColumnLabel(int column) throws SQLException {
115:                return columnsInfo.getLabel(column);
116:            }
117:
118:            /**
119:             * What's a column's name?
120:             *
121:             * @param column the first column is 1, the second is 2, ...
122:             * @return column name
123:             * @exception SQLException if a database-access error occurs.
124:             */
125:            public String getColumnName(int column) throws SQLException {
126:                return columnsInfo.getName(column);
127:            }
128:
129:            /**
130:             * What's a column's SQL type?
131:             *
132:             * @param column the first column is 1, the second is 2, ...
133:             * @return SQL type
134:             * @exception SQLException if a database-access error occurs.
135:             * @see Types
136:             */
137:            public int getColumnType(int column) throws SQLException {
138:                int result;
139:                try {
140:                    result = Tds.cvtNativeTypeToJdbcType(columnsInfo
141:                            .getType(column), columnsInfo
142:                            .getDisplaySize(column));
143:                } catch (TdsException e) {
144:                    e.printStackTrace();
145:                    throw new SQLException("TDS error- " + e.getMessage());
146:                }
147:                return result;
148:            } // getColumnType();
149:
150:            /**
151:             * What's a column's data source specific type name?
152:             *
153:             * @param column the first column is 1, the second is 2, ...
154:             * @return type name
155:             * @exception SQLException if a database-access error occurs.
156:             */
157:            public String getColumnTypeName(int column) throws SQLException {
158:                String result = null;
159:
160:                switch (columnsInfo.getType(column)) {
161:                case Tds.SYBVOID: {
162:                    result = "VOID";
163:                    break;
164:                }
165:                case Tds.SYBIMAGE: {
166:                    result = "IMAGE";
167:                    break;
168:                }
169:                case Tds.SYBTEXT: {
170:                    result = "TEXT";
171:                    break;
172:                }
173:                case Tds.SYBVARBINARY: {
174:                    result = "VARBINARY";
175:                    break;
176:                }
177:                case Tds.SYBINTN: {
178:                    result = "INTN";
179:                    break;
180:                }
181:                case Tds.SYBVARCHAR: {
182:                    result = "VARCHAR";
183:                    break;
184:                }
185:                    //Sinisa
186:                case Tds.SYBNVARCHAR: {
187:                    result = "VARCHAR";
188:                    break;
189:                }
190:                case Tds.SYBBINARY: {
191:                    result = "BINARY";
192:                    break;
193:                }
194:                case Tds.SYBCHAR: {
195:                    result = "CHAR";
196:                    break;
197:                }
198:                case Tds.SYBINT1: {
199:                    result = "INT1";
200:                    break;
201:                }
202:                case Tds.SYBBIT: {
203:                    result = "BIT";
204:                    break;
205:                }
206:                case Tds.SYBINT2: {
207:                    result = "INT2";
208:                    break;
209:                }
210:                case Tds.SYBINT4: {
211:                    result = "INT4";
212:                    break;
213:                }
214:                case Tds.SYBDATETIME4: {
215:                    result = "DATETIME4";
216:                    break;
217:                }
218:                case Tds.SYBREAL: {
219:                    result = "REAL";
220:                    break;
221:                }
222:                case Tds.SYBMONEY: {
223:                    result = "MONEY";
224:                    break;
225:                }
226:                case Tds.SYBDATETIME: {
227:                    result = "DATETIME";
228:                    break;
229:                }
230:                case Tds.SYBFLT8: {
231:                    result = "FLT8";
232:                    break;
233:                }
234:                case Tds.SYBDECIMAL: {
235:                    result = "DECIMAL";
236:                    break;
237:                }
238:                case Tds.SYBNUMERIC: {
239:                    result = "NUMERIC";
240:                    break;
241:                }
242:                case Tds.SYBFLTN: {
243:                    result = "FLTN";
244:                    break;
245:                }
246:                case Tds.SYBMONEYN: {
247:                    result = "MONEYN";
248:                    break;
249:                }
250:                case Tds.SYBDATETIMN: {
251:                    result = "DATETIMN";
252:                    break;
253:                }
254:                case Tds.SYBMONEY4: {
255:                    result = "MONEY4";
256:                    break;
257:                }
258:                default: {
259:                    throw new SQLException("Unknown native type for column "
260:                            + column);
261:                }
262:                }
263:                return result;
264:            }
265:
266:            /**
267:             * What's a column's number of decimal digits?
268:             *
269:             * @param column the first column is 1, the second is 2, ...
270:             * @return precision
271:             * @exception SQLException if a database-access error occurs.
272:             */
273:            public int getPrecision(int column) throws SQLException {
274:                NotImplemented();
275:                return 0;
276:            }
277:
278:            /**
279:             * What's a column's number of digits to right of the decimal point?
280:             *
281:             * @param column the first column is 1, the second is 2, ...
282:             * @return scale
283:             * @exception SQLException if a database-access error occurs.
284:             */
285:            public int getScale(int column) throws SQLException {
286:                return columnsInfo.getScale(column);
287:            }
288:
289:            /**
290:             * What's a column's table's schema?
291:             *
292:             * @param column the first column is 1, the second is 2, ...
293:             * @return schema name or "" if not applicable
294:             * @exception SQLException if a database-access error occurs.
295:             */
296:            public String getSchemaName(int column) throws SQLException {
297:                NotImplemented();
298:                return null;
299:            }
300:
301:            /**
302:             * What's a column's table name?
303:             *
304:             * @return table name or "" if not applicable
305:             * @exception SQLException if a database-access error occurs.
306:             */
307:            public String getTableName(int column) throws SQLException {
308:                NotImplemented();
309:                return null;
310:            }
311:
312:            /**
313:             * Is the column automatically numbered, thus read-only?
314:             *
315:             * @param column the first column is 1, the second is 2, ...
316:             * @return true if so
317:             * @exception SQLException if a database-access error occurs.
318:             */
319:            public boolean isAutoIncrement(int column) throws SQLException {
320:                return columnsInfo.isAutoIncrement(column);
321:            }
322:
323:            /**
324:             * Does a column's case matter?
325:             *
326:             * @param column the first column is 1, the second is 2, ...
327:             * @return true if so
328:             * @exception SQLException if a database-access error occurs.
329:             */
330:            public boolean isCaseSensitive(int column) throws SQLException {
331:                NotImplemented();
332:                return false;
333:            }
334:
335:            /**
336:             * Is the column a cash value?
337:             *
338:             * @param column the first column is 1, the second is 2, ...
339:             * @return true if so
340:             * @exception SQLException if a database-access error occurs.
341:             */
342:            public boolean isCurrency(int column) throws SQLException {
343:                switch (columnsInfo.getType(column)) {
344:                case Tds.SYBMONEYN:
345:                case Tds.SYBDATETIMN:
346:                case Tds.SYBMONEY4: {
347:                    return true;
348:                }
349:                default: {
350:                    return false;
351:                }
352:                }
353:            }
354:
355:            /**
356:             * Will a write on the column definitely succeed?
357:             *
358:             * @param column the first column is 1, the second is 2, ...
359:             * @return true if so
360:             * @exception SQLException if a database-access error occurs.
361:             */
362:            public boolean isDefinitelyWritable(int column) throws SQLException {
363:                NotImplemented();
364:                return false;
365:            }
366:
367:            /**
368:             * Can you put a NULL in this column?
369:             *
370:             * @param column the first column is 1, the second is 2, ...
371:             * @return columnNoNulls, columnNullable or columnNullableUnknown
372:             * @exception SQLException if a database-access error occurs.
373:             */
374:            public int isNullable(int column) throws SQLException {
375:                return columnsInfo.isNullable(column);
376:            }
377:
378:            /**
379:             * Is a column definitely not writable?
380:             *
381:             * @param column the first column is 1, the second is 2, ...
382:             * @return true if so
383:             * @exception SQLException if a database-access error occurs.
384:             */
385:            public boolean isReadOnly(int column) throws SQLException {
386:                return columnsInfo.isReadOnly(column);
387:            }
388:
389:            /**
390:             * Can the column be used in a where clause?
391:             *
392:             * @param column the first column is 1, the second is 2, ...
393:             * @return true if so
394:             * @exception SQLException if a database-access error occurs.
395:             */
396:            public boolean isSearchable(int column) throws SQLException {
397:                // XXX Is this true?  Can all columns be used in a where clause?
398:                return true;
399:            }
400:
401:            /**
402:             * Is the column a signed number?
403:             *
404:             * @param column the first column is 1, the second is 2, ...
405:             * @return true if so
406:             * @exception SQLException if a database-access error occurs.
407:             */
408:            public boolean isSigned(int column) throws SQLException {
409:                NotImplemented();
410:                return false;
411:            }
412:
413:            /**
414:             * Is it possible for a write on the column to succeed?
415:             *
416:             * @param column the first column is 1, the second is 2, ...
417:             * @return true if so
418:             * @exception SQLException if a database-access error occurs.
419:             */
420:            public boolean isWritable(int column) throws SQLException {
421:                NotImplemented();
422:                return false;
423:            }
424:
425:            /**
426:             * JDBC 2.0
427:             *
428:             * <p>Returns the fully-qualified name of the Java class whose instances 
429:             * are manufactured if the method <code>ResultSet.getObject</code>
430:             * is called to retrieve a value 
431:             * from the column.  <code>ResultSet.getObject</code> may return a subclass of the
432:             * class returned by this method.
433:             *
434:             * @return the fully-qualified name of the class in the Java programming
435:             *         language that would be used by the method 
436:             * <code>ResultSet.getObject</code> to retrieve the value in the specified
437:             * column. This is the class name used for custom mapping.
438:             * @exception SQLException if a database access error occurs
439:             */
440:            public String getColumnClassName(int column) throws SQLException {
441:                NotImplemented();
442:                return null;
443:            }
444:
445:            public boolean isWrapperFor(Class<?> iface) throws SQLException {
446:                // TODO Auto-generated method stub
447:                return false;
448:            }
449:
450:            public <T> T unwrap(Class<T> iface) throws SQLException {
451:                // TODO Auto-generated method stub
452:                return null;
453:            }
454:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.