Source Code Cross Referenced for JdbcParameterMetaData.java in  » Database-DBMS » h2database » org » h2 » 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 DBMS » h2database » org.h2.jdbc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
003:         * (http://h2database.com/html/license.html).
004:         * Initial Developer: H2 Group
005:         */
006:        package org.h2.jdbc;
007:
008:        import java.sql.ParameterMetaData;
009:        import java.sql.ResultSetMetaData;
010:        import java.sql.SQLException;
011:        import java.sql.Types;
012:
013:        import org.h2.command.CommandInterface;
014:        import org.h2.engine.SessionInterface;
015:        import org.h2.message.Message;
016:        import org.h2.message.TraceObject;
017:
018:        /**
019:         * Information about the parameters of a prepared statement.
020:         */
021:        public class JdbcParameterMetaData extends TraceObject
022:        //#ifdef JDK14
023:                implements  ParameterMetaData
024:        //#endif
025:        {
026:
027:            private JdbcPreparedStatement prep;
028:            private int paramCount;
029:
030:            /**
031:             * Returns the number of parameters.
032:             *
033:             * @return the number
034:             */
035:            public int getParameterCount() throws SQLException {
036:                try {
037:                    debugCodeCall("getParameterCount");
038:                    checkClosed();
039:                    return paramCount;
040:                } catch (Throwable e) {
041:                    throw logAndConvert(e);
042:                }
043:            }
044:
045:            /**
046:             * Returns the parameter mode.
047:             * Always returns parameterModeIn
048:             *
049:             * @return parameterModeIn
050:             */
051:            //#ifdef JDK14
052:            public int getParameterMode(int param) throws SQLException {
053:                try {
054:                    debugCodeCall("getParameterMode", param);
055:                    checkParameterIndex(param);
056:                    return parameterModeIn;
057:                } catch (Throwable e) {
058:                    throw logAndConvert(e);
059:                }
060:            }
061:
062:            //#endif
063:
064:            /**
065:             * Returns the parameter type.
066:             * Always returns Types.VARCHAR as everything can be passed as a VARCHAR.
067:             *
068:             * @return Types.VARCHAR
069:             */
070:            public int getParameterType(int param) throws SQLException {
071:                try {
072:                    debugCodeCall("getParameterType", param);
073:                    checkParameterIndex(param);
074:                    return Types.VARCHAR;
075:                } catch (Throwable e) {
076:                    throw logAndConvert(e);
077:                }
078:            }
079:
080:            /**
081:             * Returns the parameter precision.
082:             * Always returns 0.
083:             *
084:             * @return 0
085:             */
086:            public int getPrecision(int param) throws SQLException {
087:                try {
088:                    debugCodeCall("getPrecision", param);
089:                    checkParameterIndex(param);
090:                    return 0;
091:                } catch (Throwable e) {
092:                    throw logAndConvert(e);
093:                }
094:            }
095:
096:            /**
097:             * Returns the parameter precision.
098:             * Always returns 0.
099:             *
100:             * @return 0
101:             */
102:            public int getScale(int param) throws SQLException {
103:                try {
104:                    debugCodeCall("getScale", param);
105:                    checkParameterIndex(param);
106:                    return 0;
107:                } catch (Throwable e) {
108:                    throw logAndConvert(e);
109:                }
110:            }
111:
112:            /**
113:             * Checks if this is nullable parameter.
114:             * Returns ResultSetMetaData.columnNullableUnknown..
115:             *
116:             * @return ResultSetMetaData.columnNullableUnknown
117:             */
118:            public int isNullable(int param) throws SQLException {
119:                try {
120:                    debugCodeCall("isNullable", param);
121:                    checkParameterIndex(param);
122:                    return ResultSetMetaData.columnNullableUnknown;
123:                } catch (Throwable e) {
124:                    throw logAndConvert(e);
125:                }
126:            }
127:
128:            /**
129:             * Checks if this parameter is signed.
130:             * It always returns true.
131:             *
132:             * @return true
133:             */
134:            public boolean isSigned(int param) throws SQLException {
135:                try {
136:                    debugCodeCall("isSigned", param);
137:                    checkParameterIndex(param);
138:                    return true;
139:                } catch (Throwable e) {
140:                    throw logAndConvert(e);
141:                }
142:            }
143:
144:            /**
145:             * Returns the parameter class name.
146:             * Always returns java.lang.String.
147:             *
148:             * @return "java.lang.String"
149:             */
150:            public String getParameterClassName(int param) throws SQLException {
151:                try {
152:                    debugCodeCall("getParameterClassName", param);
153:                    checkParameterIndex(param);
154:                    return String.class.getName();
155:                } catch (Throwable e) {
156:                    throw logAndConvert(e);
157:                }
158:            }
159:
160:            /**
161:             * Returns the parameter type name.
162:             * Always returns VARCHAR.
163:             *
164:             * @return "VARCHAR"
165:             */
166:            public String getParameterTypeName(int param) throws SQLException {
167:                try {
168:                    debugCodeCall("getParameterTypeName", param);
169:                    checkParameterIndex(param);
170:                    return "VARCHAR";
171:                } catch (Throwable e) {
172:                    throw logAndConvert(e);
173:                }
174:            }
175:
176:            JdbcParameterMetaData(SessionInterface session,
177:                    JdbcPreparedStatement prep, CommandInterface command, int id) {
178:                setTrace(session.getTrace(), TraceObject.PARAMETER_META_DATA,
179:                        id);
180:                this .prep = prep;
181:                this .paramCount = command.getParameters().size();
182:            }
183:
184:            void checkParameterIndex(int param) throws SQLException {
185:                checkClosed();
186:                if (param < 1 || param > paramCount) {
187:                    throw Message.getInvalidValueException("" + param, "param");
188:                }
189:            }
190:
191:            void checkClosed() throws SQLException {
192:                prep.checkClosed();
193:            }
194:
195:            /**
196:             * [Not supported] Return an object of this class if possible.
197:             */
198:            //#ifdef JDK16
199:            /*
200:             public <T> T unwrap(Class<T> iface) throws SQLException {
201:             debugCodeCall("unwrap");
202:             throw Message.getUnsupportedException();
203:             }
204:             */
205:            //#endif
206:            /**
207:             * [Not supported] Checks if unwrap can return an object of this class.
208:             */
209:            //#ifdef JDK16
210:            /*
211:             public boolean isWrapperFor(Class< ? > iface) throws SQLException {
212:             debugCodeCall("isWrapperFor");
213:             throw Message.getUnsupportedException();
214:             }
215:             */
216:            //#endif
217:            /**
218:             * INTERNAL
219:             */
220:            public String toString() {
221:                return getTraceObjectName() + ": parameterCount=" + paramCount;
222:            }
223:
224:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.