Source Code Cross Referenced for JtdsResultSetMetaData.java in  » Database-JDBC-Connection-Pool » jTDS » net » sourceforge » jtds » jdbc » 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 » jTDS » net.sourceforge.jtds.jdbc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // jTDS JDBC Driver for Microsoft SQL Server and Sybase
002:        // Copyright (C) 2004 The jTDS Project
003:        //
004:        // This library is free software; you can redistribute it and/or
005:        // modify it under the terms of the GNU Lesser General Public
006:        // License as published by the Free Software Foundation; either
007:        // version 2.1 of the License, or (at your option) any later version.
008:        //
009:        // This library is distributed in the hope that it will be useful,
010:        // but WITHOUT ANY WARRANTY; without even the implied warranty of
011:        // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:        // Lesser General Public License for more details.
013:        //
014:        // You should have received a copy of the GNU Lesser General Public
015:        // License along with this library; if not, write to the Free Software
016:        // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:        //
018:        package net.sourceforge.jtds.jdbc;
019:
020:        import java.sql.ResultSetMetaData;
021:        import java.sql.SQLException;
022:
023:        /**
024:         * jTDS implementation of the java.sql.ResultSetMetaData interface.
025:         * <p>
026:         * Implementation notes:
027:         * <ol>
028:         * <li>New simple implementation required by the new column info structure.
029:         * <li>Unlike the equivalent in the older jTDS, this version is generic and does
030:         *     not need to know details of the TDS protocol.
031:         * </ol>
032:         *
033:         * @author Mike Hutchinson
034:         * @version $Id: JtdsResultSetMetaData.java,v 1.9 2007/07/08 18:53:30 bheineman Exp $
035:         */
036:        public class JtdsResultSetMetaData implements  ResultSetMetaData {
037:            private final ColInfo[] columns;
038:            private final int columnCount;
039:            private final boolean useLOBs;
040:
041:            /**
042:             * Construct ResultSetMetaData object over the current ColInfo array.
043:             *
044:             * @param columns The current ColInfo row descriptor array.
045:             * @param columnCount The number of visible columns.
046:             */
047:            JtdsResultSetMetaData(ColInfo[] columns, int columnCount,
048:                    boolean useLOBs) {
049:                this .columns = columns;
050:                this .columnCount = columnCount;
051:                this .useLOBs = useLOBs;
052:            }
053:
054:            /**
055:             * Return the column descriptor given a column index.
056:             *
057:             * @param column The column index (from 1 .. n).
058:             * @return The column descriptor as a <code>ColInfo<code>.
059:             * @throws SQLException
060:             */
061:            ColInfo getColumn(int column) throws SQLException {
062:                if (column < 1 || column > columnCount) {
063:                    throw new SQLException(Messages.get(
064:                            "error.resultset.colindex", Integer
065:                                    .toString(column)), "07009");
066:                }
067:
068:                return columns[column - 1];
069:            }
070:
071:            // ------  java.sql.ResultSetMetaData methods follow -------
072:
073:            public int getColumnCount() throws SQLException {
074:                return this .columnCount;
075:            }
076:
077:            public int getColumnDisplaySize(int column) throws SQLException {
078:                return getColumn(column).displaySize;
079:            }
080:
081:            public int getColumnType(int column) throws SQLException {
082:                if (useLOBs) {
083:                    return getColumn(column).jdbcType;
084:                } else {
085:                    return Support.convertLOBType(getColumn(column).jdbcType);
086:                }
087:            }
088:
089:            public int getPrecision(int column) throws SQLException {
090:                return getColumn(column).precision;
091:            }
092:
093:            public int getScale(int column) throws SQLException {
094:                return getColumn(column).scale;
095:            }
096:
097:            public int isNullable(int column) throws SQLException {
098:                return getColumn(column).nullable;
099:            }
100:
101:            public boolean isAutoIncrement(int column) throws SQLException {
102:                return getColumn(column).isIdentity;
103:            }
104:
105:            public boolean isCaseSensitive(int column) throws SQLException {
106:                return getColumn(column).isCaseSensitive;
107:            }
108:
109:            public boolean isCurrency(int column) throws SQLException {
110:                return TdsData.isCurrency(getColumn(column));
111:            }
112:
113:            public boolean isDefinitelyWritable(int column) throws SQLException {
114:                getColumn(column);
115:
116:                return false;
117:            }
118:
119:            public boolean isReadOnly(int column) throws SQLException {
120:                return !getColumn(column).isWriteable;
121:            }
122:
123:            public boolean isSearchable(int column) throws SQLException {
124:                return TdsData.isSearchable(getColumn(column));
125:            }
126:
127:            public boolean isSigned(int column) throws SQLException {
128:                return TdsData.isSigned(getColumn(column));
129:            }
130:
131:            public boolean isWritable(int column) throws SQLException {
132:                return getColumn(column).isWriteable;
133:            }
134:
135:            public String getCatalogName(int column) throws SQLException {
136:                ColInfo col = getColumn(column);
137:
138:                return (col.catalog == null) ? "" : col.catalog;
139:            }
140:
141:            public String getColumnClassName(int column) throws SQLException {
142:                String c = Support.getClassName(getColumnType(column));
143:
144:                if (!useLOBs) {
145:                    if ("java.sql.Clob".equals(c)) {
146:                        return "java.lang.String";
147:                    }
148:
149:                    if ("java.sql.Blob".equals(c)) {
150:                        return "[B";
151:                    }
152:                }
153:
154:                return c;
155:            }
156:
157:            public String getColumnLabel(int column) throws SQLException {
158:                return getColumn(column).name;
159:            }
160:
161:            public String getColumnName(int column) throws SQLException {
162:                return getColumn(column).name;
163:            }
164:
165:            public String getColumnTypeName(int column) throws SQLException {
166:                return getColumn(column).sqlType;
167:            }
168:
169:            public String getSchemaName(int column) throws SQLException {
170:                ColInfo col = getColumn(column);
171:
172:                return (col.schema == null) ? "" : col.schema;
173:            }
174:
175:            public String getTableName(int column) throws SQLException {
176:                ColInfo col = getColumn(column);
177:
178:                return (col.tableName == null) ? "" : col.tableName;
179:            }
180:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.