Source Code Cross Referenced for CsvResultSetMetaData.java in  » Database-JDBC-Connection-Pool » octopus » org » relique » jdbc » csv » 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 » org.relique.jdbc.csv 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:            Copyright (C) 2002-2003  Together
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 org.relique.jdbc.csv;
019:
020:        import java.sql.ResultSetMetaData;
021:        import java.sql.SQLException;
022:        import java.sql.Types;
023:        import java.util.Map;
024:
025:        /**
026:         *This class implements the ResultSetMetaData interface for the CsvJdbc driver.
027:         *
028:         * @author     Zoran Milakovic
029:         */
030:        public class CsvResultSetMetaData implements  ResultSetMetaData {
031:            /** Default value for getColumnDisplaySize */
032:            final static int DISPLAY_SIZE = 20;
033:            /** Names of columns */
034:            protected String[] columnNames;
035:            /** Types of columns */
036:            protected Map columnTypes;
037:            /** Name of table */
038:            protected String tableName;
039:
040:            /**Constructor for the CsvResultSetMetaData object
041:             *
042:             * @param  tableName    Name of table
043:             * @param  columnNames  Names of columns in table
044:             */
045:            CsvResultSetMetaData(String tableName, String[] columnNames,
046:                    Map columnTypes) {
047:                this .tableName = tableName;
048:                this .columnNames = columnNames;
049:                this .columnTypes = columnTypes;
050:            }
051:
052:            /**Returns the name of the class for the specified column. Always returns
053:             * String.
054:             *
055:             * @param  column            The column number
056:             * @return                   The name of the class for the requested column
057:             * @exception  SQLException  Thrown if there was a problem
058:             */
059:            public String getColumnClassName(int column) throws SQLException {
060:                return String.class.getName();
061:            }
062:
063:            /** Returns the number of columns in the table.
064:             *
065:             * @return                   The number of columns in the table
066:             * @exception  SQLException  Thrown if there is a a problem
067:             */
068:            public int getColumnCount() throws SQLException {
069:                return columnNames.length;
070:            }
071:
072:            /** Returns the name of the catalog for the specified column. Returns "".
073:             *
074:             * @param  column            The column to get the catalog for
075:             * @return                   The catalog name (always "")
076:             * @exception  SQLException  Thrown if there is a problem
077:             */
078:            public String getCatalogName(int column) throws SQLException {
079:                return "";
080:            }
081:
082:            /**Returns the display column size for the specified column. Always returns 20.
083:             *
084:             * @param  column            The column to get the size of
085:             * @return                   The size of the requested column
086:             * @exception  SQLException  Thrown if there is a problem.
087:             */
088:            public int getColumnDisplaySize(int column) throws SQLException {
089:                return DISPLAY_SIZE;
090:            }
091:
092:            /**Gets the auto increment falg for the specfied column.
093:             *
094:             * @param  column            The column to get the flag for
095:             * @return                   The autoIncrement flag (always false)
096:             * @exception  SQLException  Thrown if there is a problem
097:             */
098:            public boolean isAutoIncrement(int column) throws SQLException {
099:                return false;
100:            }
101:
102:            /**Returns the case sensitivity flag for the specfied column
103:             *
104:             * @param  column            The column to return the flag for
105:             * @return                   The caseSensitive flag (always false)
106:             * @exception  SQLException  Thrown if there is a problem
107:             */
108:            public boolean isCaseSensitive(int column) throws SQLException {
109:                //all columns are uppercase
110:                return false;
111:            }
112:
113:            /** Returns the searchable flag for the specified column
114:             *
115:             * @param  column            the column to return the flag form
116:             * @return                   The searchable flag (always false)
117:             * @exception  SQLException  Thrown if there is a problem
118:             */
119:            public boolean isSearchable(int column) throws SQLException {
120:                return true;
121:            }
122:
123:            /**Returns the currency flag for the specified column
124:             *
125:             * @param  column            The column to get the flag for
126:             * @return                   The currency flag (always false)
127:             * @exception  SQLException  Thrown if there is a problem
128:             */
129:            public boolean isCurrency(int column) throws SQLException {
130:                return false;
131:            }
132:
133:            /** Returns the nullable flag for the specfied column
134:             *
135:             * @param  column            The column to return the flag for
136:             * @return                   The nullable flag (always unknown)
137:             * @exception  SQLException  Thrown if there is a problem
138:             */
139:            public int isNullable(int column) throws SQLException {
140:                return ResultSetMetaData.columnNullableUnknown;
141:            }
142:
143:            /**Returns the signed flag for the specfied column
144:             *
145:             * @param  column            The column to return the flag for
146:             * @return                   The signed flag (always false)
147:             * @exception  SQLException  Thrown if there is a problem
148:             */
149:            public boolean isSigned(int column) throws SQLException {
150:                return false;
151:            }
152:
153:            /** Returns the label for the specified column
154:             *
155:             * @param  column            The column to get the label for
156:             * @return                   the label for the specified column
157:             * @exception  SQLException  Thrown if there is a problem
158:             */
159:            public String getColumnLabel(int column) throws SQLException {
160:                // SQL column numbers start at 1
161:                return columnNames[column - 1];
162:            }
163:
164:            /**Returns the name of the specified column
165:             *
166:             * @param  column            The column to get the name of
167:             * @return                   The name of the column
168:             * @exception  SQLException  Thrown if there is a problem
169:             */
170:            public String getColumnName(int column) throws SQLException {
171:                // SQL column numbers start at 1
172:                return columnNames[column - 1];
173:            }
174:
175:            /**Comments to be done
176:             */
177:            public String getSchemaName(int column) throws SQLException {
178:                return "";
179:            }
180:
181:            /**Comments to be done
182:             */
183:            public int getPrecision(int column) throws SQLException {
184:                // All the fields are text, should this throw an SQLException?
185:                return 0;
186:            }
187:
188:            /**Comments to be done
189:             */
190:            public int getScale(int column) throws SQLException {
191:                // All the fields are text, should this throw an SQLException?
192:                return 0;
193:            }
194:
195:            /**Comments to be done
196:             */
197:            public String getTableName(int column) throws SQLException {
198:                return tableName;
199:            }
200:
201:            /**Comments to be done
202:             */
203:            public int getColumnType(int column) throws SQLException {
204:                return Types.VARCHAR;
205:            }
206:
207:            /**Comments to be done
208:             */
209:            public String getColumnTypeName(int column) throws SQLException {
210:                return (String) columnTypes.get(columnNames[column - 1]);
211:            }
212:
213:            /**Comments to be done
214:             */
215:            public boolean isReadOnly(int column) throws SQLException {
216:                return true;
217:            }
218:
219:            /**Comments to be done
220:             */
221:            public boolean isWritable(int column) throws SQLException {
222:                return false;
223:            }
224:
225:            /**Comments to be done
226:             */
227:            public boolean isDefinitelyWritable(int column) throws SQLException {
228:                return false;
229:            }
230:
231:            public boolean isWrapperFor(Class<?> iface) throws SQLException {
232:                // TODO Auto-generated method stub
233:                return false;
234:            }
235:
236:            public <T> T unwrap(Class<T> iface) throws SQLException {
237:                // TODO Auto-generated method stub
238:                return null;
239:            }
240:
241:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.