Source Code Cross Referenced for EmbedResultSet20.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » 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 » db derby 10.2 » org.apache.derby.impl.jdbc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Derby - Class org.apache.derby.impl.jdbc.EmbedResultSet20
004:
005:           Licensed to the Apache Software Foundation (ASF) under one or more
006:           contributor license agreements.  See the NOTICE file distributed with
007:           this work for additional information regarding copyright ownership.
008:           The ASF licenses this file to you under the Apache License, Version 2.0
009:           (the "License"); you may not use this file except in compliance with
010:           the License.  You may obtain a copy of the License at
011:
012:              http://www.apache.org/licenses/LICENSE-2.0
013:
014:           Unless required by applicable law or agreed to in writing, software
015:           distributed under the License is distributed on an "AS IS" BASIS,
016:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:           See the License for the specific language governing permissions and
018:           limitations under the License.
019:
020:         */
021:
022:        package org.apache.derby.impl.jdbc;
023:
024:        import org.apache.derby.iapi.reference.JDBC20Translation;
025:        import org.apache.derby.iapi.reference.SQLState;
026:
027:        import org.apache.derby.iapi.sql.ResultSet;
028:
029:        import org.apache.derby.iapi.sql.execute.ExecCursorTableReference;
030:
031:        import org.apache.derby.iapi.error.StandardException;
032:        import org.apache.derby.impl.jdbc.Util;
033:        import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
034:        import org.apache.derby.iapi.sql.conn.StatementContext;
035:
036:        import org.apache.derby.iapi.types.DataValueDescriptor;
037:
038:        import java.sql.Statement;
039:        import java.sql.SQLException;
040:        import java.sql.Types;
041:
042:        /* ---- New jdbc 2.0 types ----- */
043:        import java.sql.Array;
044:        import java.sql.Blob;
045:        import java.sql.Clob;
046:        import java.sql.Ref;
047:
048:        import java.math.BigDecimal;
049:        import java.net.URL;
050:
051:        /**
052:         * This class extends the EmbedResultSet class in order to support new
053:         * methods and classes that come with JDBC 2.0.
054:         <P><B>Supports</B>
055:         <UL>
056:         <LI> JDBC 2.0/2.1
057:         <LI> JDBC 3.0
058:         </UL>
059:         *      @see org.apache.derby.impl.jdbc.EmbedResultSet
060:         *
061:         *      @author francois
062:         */
063:
064:        public class EmbedResultSet20 extends
065:                org.apache.derby.impl.jdbc.EmbedResultSet {
066:
067:            //////////////////////////////////////////////////////////////
068:            //
069:            // CONSTRUCTORS
070:            //
071:            //////////////////////////////////////////////////////////////
072:
073:            /**
074:             * This class provides the glue between the Derby
075:             * resultset and the JDBC resultset, mapping calls-to-calls.
076:             */
077:            public EmbedResultSet20(
078:                    org.apache.derby.impl.jdbc.EmbedConnection conn,
079:                    ResultSet resultsToWrap, boolean forMetaData,
080:                    org.apache.derby.impl.jdbc.EmbedStatement stmt,
081:                    boolean isAtomic) throws SQLException {
082:                super (conn, resultsToWrap, forMetaData, stmt, isAtomic);
083:            }
084:
085:            /*
086:             ** Methods using java.math.BigDecimal, not supported in JSR169
087:             */
088:            /**
089:             * Get the value of a column in the current row as a java.lang.BigDecimal object.
090:             *
091:             * @param columnIndex the first column is 1, the second is 2, ...
092:             * @param scale the number of digits to the right of the decimal
093:             * @return the column value; if the value is SQL NULL, the result is null
094:             * @exception SQLException thrown on failure.
095:             */
096:            public final BigDecimal getBigDecimal(int columnIndex, int scale)
097:                    throws SQLException {
098:
099:                BigDecimal ret = getBigDecimal(columnIndex);
100:                if (ret != null) {
101:                    return ret.setScale(scale, BigDecimal.ROUND_HALF_DOWN);
102:                }
103:                return null;
104:            }
105:
106:            public final BigDecimal getBigDecimal(int columnIndex)
107:                    throws SQLException {
108:                checkIfClosed("getBigDecimal");
109:                try {
110:
111:                    DataValueDescriptor dvd = getColumn(columnIndex);
112:
113:                    if (wasNull = dvd.isNull())
114:                        return null;
115:
116:                    return org.apache.derby.iapi.types.SQLDecimal
117:                            .getBigDecimal(dvd);
118:
119:                } catch (StandardException t) {
120:                    throw noStateChangeException(t);
121:                }
122:            }
123:
124:            /**
125:             * Get the value of a column in the current row as a java.lang.BigDecimal object.
126:             *
127:             * @param columnName is the SQL name of the column
128:             * @param scale the number of digits to the right of the decimal
129:             * @return the column value; if the value is SQL NULL, the result is null
130:             * @exception SQLException thrown on failure.
131:             */
132:            public final BigDecimal getBigDecimal(String columnName, int scale)
133:                    throws SQLException {
134:                checkIfClosed("getBigDecimal");
135:                return (getBigDecimal(findColumnName(columnName), scale));
136:            }
137:
138:            /**
139:             * JDBC 2.0
140:             *
141:            	Deprecated in JDBC 2.0, not supported by JCC.
142:             * @exception SQLException thrown on failure.
143:             */
144:            public final java.io.InputStream getUnicodeStream(int columnIndex)
145:                    throws SQLException {
146:                throw Util.notImplemented("getUnicodeStream");
147:            }
148:
149:            /**
150:            	Deprecated in JDBC 2.0, not supported by JCC.
151:             * @exception SQLException thrown on failure.
152:             */
153:            public final java.io.InputStream getUnicodeStream(String columnName)
154:                    throws SQLException {
155:                throw Util.notImplemented("getUnicodeStream");
156:            }
157:
158:            /**
159:             * JDBC 2.0
160:             *
161:             * Get the value of a column in the current row as a java.math.BigDecimal 
162:             * object.
163:             *
164:             * @exception SQLException Feature not implemented for now.
165:             */
166:            public final BigDecimal getBigDecimal(String columnName)
167:                    throws SQLException {
168:                checkIfClosed("getBigDecimal");
169:                return getBigDecimal(findColumnName(columnName));
170:            }
171:
172:            public void updateBigDecimal(int columnIndex, BigDecimal x)
173:                    throws SQLException {
174:                try {
175:                    getDVDforColumnToBeUpdated(columnIndex, "updateBigDecimal")
176:                            .setBigDecimal(x);
177:                } catch (StandardException t) {
178:                    throw noStateChangeException(t);
179:                }
180:            }
181:
182:            /**
183:             * JDBC 2.0
184:             * 
185:             * Update a column with an Object value.
186:             * 
187:             * The updateXXX() methods are used to update column values in the current
188:             * row, or the insert row. The updateXXX() methods do not update the
189:             * underlying database, instead the updateRow() or insertRow() methods are
190:             * called to update the database.
191:             * 
192:             * @param columnIndex
193:             *            the first column is 1, the second is 2, ...
194:             * @param x
195:             *            the new column value
196:             * @exception SQLException
197:             *                if a database-access error occurs
198:             */
199:            public void updateObject(int columnIndex, Object x)
200:                    throws SQLException {
201:                //If the Object x is the right datatype, this method will eventually call getDVDforColumnToBeUpdated which will check for
202:                //the read only resultset. But for other datatypes of x, we want to catch if this updateObject is being
203:                //issued against a read only resultset. And that is the reason for call to checksBeforeUpdateOrDelete here.
204:                checksBeforeUpdateOrDelete("updateObject", columnIndex);
205:                int colType = getColumnType(columnIndex);
206:
207:                if (x instanceof  BigDecimal) {
208:                    updateBigDecimal(columnIndex, (BigDecimal) x);
209:                    return;
210:                }
211:                super .updateObject(columnIndex, x);
212:            }
213:
214:            /**
215:             * JDBC 2.0
216:             *
217:             * Update a column with a BigDecimal value.
218:             *
219:             * The updateXXX() methods are used to update column values in the
220:             * current row, or the insert row.  The updateXXX() methods do not 
221:             * update the underlying database, instead the updateRow() or insertRow()
222:             * methods are called to update the database.
223:             *
224:             * @param columnName the name of the column
225:             * @param x the new column value
226:             * @exception SQLException if a database-access error occurs
227:             */
228:            public void updateBigDecimal(String columnName, BigDecimal x)
229:                    throws SQLException {
230:                checkIfClosed("updateBigDecimal");
231:                updateBigDecimal(findColumnName(columnName), x);
232:            }
233:
234:            /**
235:             * JDBC 2.0
236:             *
237:             * Returns the value of column @i as a Java object.  Use the
238:             * param map to determine the class from which to construct data of 
239:             * SQL structured and distinct types.
240:             *
241:             * @param columnIndex the first column is 1, the second is 2, ...
242:             * @param map the mapping from SQL type names to Java classes
243:             * @return an object representing the SQL value
244:             * @exception SQLException Feature not implemented for now.
245:             */
246:            public Object getObject(int columnIndex, java.util.Map map)
247:                    throws SQLException {
248:                checkIfClosed("getObject");
249:                if (map == null)
250:                    throw Util.generateCsSQLException(
251:                            SQLState.INVALID_API_PARAMETER, map, "map",
252:                            "java.sql.ResultSet.getObject");
253:                if (!(map.isEmpty()))
254:                    throw Util.notImplemented();
255:                // Map is empty call the normal getObject method.
256:                return getObject(columnIndex);
257:            }
258:
259:            /**
260:             * JDBC 2.0
261:             *
262:             * Get a REF(&lt;structured-type&gt;) column.
263:             *
264:             * @param i the first column is 1, the second is 2, ...
265:             * @return an object representing data of an SQL REF type
266:             * @exception SQLException Feature not implemented for now.
267:             */
268:            public Ref getRef(int i) throws SQLException {
269:                throw Util.notImplemented();
270:            }
271:
272:            /**
273:             * JDBC 2.0
274:             *
275:             * Get an array column.
276:             *
277:             * @param i the first column is 1, the second is 2, ...
278:             * @return an object representing an SQL array
279:             * @exception SQLException Feature not implemented for now.
280:             */
281:            public Array getArray(int i) throws SQLException {
282:                throw Util.notImplemented();
283:            }
284:
285:            /**
286:             * JDBC 2.0
287:             *
288:             * Returns the value of column @i as a Java object.  Use the 
289:             * param map to determine the class from which to construct data of 
290:             * SQL structured and distinct types.
291:             *
292:             * @param colName the column name
293:             * @param map the mapping from SQL type names to Java classes
294:             * @return an object representing the SQL value
295:             * @exception SQLException Feature not implemented for now.
296:             */
297:            public Object getObject(String colName, java.util.Map map)
298:                    throws SQLException {
299:                checkIfClosed("getObject");
300:                return getObject(findColumn(colName), map);
301:            }
302:
303:            /**
304:             * JDBC 2.0
305:             *
306:             * Get a REF(&lt;structured-type&gt;) column.
307:             *
308:             * @param colName the column name
309:             * @return an object representing data of an SQL REF type
310:             * @exception SQLException Feature not implemented for now.
311:             */
312:            public Ref getRef(String colName) throws SQLException {
313:                throw Util.notImplemented();
314:            }
315:
316:            /**
317:             * JDBC 2.0
318:             *
319:             * Get an array column.
320:             *
321:             * @param colName the column name
322:             * @return an object representing an SQL array
323:             * @exception SQLException Feature not implemented for now.
324:             */
325:            public Array getArray(String colName) throws SQLException {
326:                throw Util.notImplemented();
327:            }
328:
329:            /**
330:            Following methods are for the new JDBC 3.0 methods in java.sql.ResultSet
331:            (see the JDBC 3.0 spec). We have the JDBC 3.0 methods in Local20
332:            package, so we don't have to have a new class in Local30.
333:            The new JDBC 3.0 methods don't make use of any new JDBC3.0 classes and
334:            so this will work fine in jdbc2.0 configuration.
335:             */
336:
337:            /////////////////////////////////////////////////////////////////////////
338:            //
339:            //      JDBC 3.0        -       New public methods
340:            //
341:            /////////////////////////////////////////////////////////////////////////
342:
343:            /**
344:             * JDBC 3.0
345:             *
346:             * Updates the designated column with a java.sql.Ref value. The updater methods are
347:             * used to update column values in the current row or the insert row. The
348:             * updater methods do not update the underlying database; instead the updateRow
349:             * or insertRow methods are called to update the database.
350:             *
351:             * @param columnIndex - the first column is 1, the second is 2
352:             * @param x - the new column value
353:             * @exception SQLException Feature not implemented for now.
354:             */
355:            public void updateRef(int columnIndex, Ref x) throws SQLException {
356:                throw Util.notImplemented();
357:            }
358:
359:            /**
360:             * JDBC 3.0
361:             *
362:             * Updates the designated column with a java.sql.Ref value. The updater methods are
363:             * used to update column values in the current row or the insert row. The
364:             * updater methods do not update the underlying database; instead the updateRow
365:             * or insertRow methods are called to update the database.
366:             *
367:             * @param columnName - the SQL name of the column
368:             * @param x - the new column value
369:             * @exception SQLException Feature not implemented for now.
370:             */
371:            public void updateRef(String columnName, Ref x) throws SQLException {
372:                throw Util.notImplemented();
373:            }
374:
375:            /**
376:             * JDBC 3.0
377:             *
378:             * Updates the designated column with a java.sql.Array value. The updater methods are
379:             * used to update column values in the current row or the insert row. The
380:             * updater methods do not update the underlying database; instead the updateRow
381:             * or insertRow methods are called to update the database.
382:             *
383:             * @param columnIndex - the first column is 1, the second is 2
384:             * @param x - the new column value
385:             * @exception SQLException Feature not implemented for now.
386:             */
387:            public void updateArray(int columnIndex, Array x)
388:                    throws SQLException {
389:                throw Util.notImplemented();
390:            }
391:
392:            /**
393:             * JDBC 3.0
394:             *
395:             * Updates the designated column with a java.sql.Array value. The updater methods are
396:             * used to update column values in the current row or the insert row. The
397:             * updater methods do not update the underlying database; instead the updateRow
398:             * or insertRow methods are called to update the database.
399:             *
400:             * @param columnName - the SQL name of the column
401:             * @param x - the new column value
402:             * @exception SQLException Feature not implemented for now.
403:             */
404:            public void updateArray(String columnName, Array x)
405:                    throws SQLException {
406:                throw Util.notImplemented();
407:            }
408:
409:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.