Source Code Cross Referenced for CachedRowSetImpl.java in  » 6.0-JDK-Modules-com.sun » rowset » com » sun » rowset » 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 » 6.0 JDK Modules com.sun » rowset » com.sun.rowset 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


00001:        /*
00002:         * Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
00003:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
00004:         *
00005:         * This code is free software; you can redistribute it and/or modify it
00006:         * under the terms of the GNU General Public License version 2 only, as
00007:         * published by the Free Software Foundation.  Sun designates this
00008:         * particular file as subject to the "Classpath" exception as provided
00009:         * by Sun in the LICENSE file that accompanied this code.
00010:         *
00011:         * This code is distributed in the hope that it will be useful, but WITHOUT
00012:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00014:         * version 2 for more details (a copy is included in the LICENSE file that
00015:         * accompanied this code).
00016:         *
00017:         * You should have received a copy of the GNU General Public License version
00018:         * 2 along with this work; if not, write to the Free Software Foundation,
00019:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
00020:         *
00021:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
00022:         * CA 95054 USA or visit www.sun.com if you need additional information or
00023:         * have any questions.
00024:         */
00025:
00026:        package com.sun.rowset;
00027:
00028:        import java.sql.*;
00029:        import javax.sql.*;
00030:        import java.io.*;
00031:        import java.math.*;
00032:        import java.util.*;
00033:        import java.text.*;
00034:
00035:        import javax.sql.rowset.*;
00036:        import javax.sql.rowset.spi.*;
00037:        import javax.sql.rowset.serial.*;
00038:        import com.sun.rowset.internal.*;
00039:        import com.sun.rowset.providers.*;
00040:
00041:        /**
00042:         * The standard implementation of the <code>CachedRowSet</code> interface.
00043:         *
00044:         * See interface defintion for full behaviour and implementation requirements.
00045:         * This reference implementation has made provision for a one-to-one write back
00046:         * facility and it is curremtly be possible to change the peristence provider
00047:         * during the life-time of any CachedRowSetImpl.
00048:         *
00049:         * @author Jonathan Bruce, Amit Handa
00050:         */
00051:
00052:        public class CachedRowSetImpl extends BaseRowSet implements  RowSet,
00053:                RowSetInternal, Serializable, Cloneable, CachedRowSet {
00054:
00055:            /**
00056:             * The <code>SyncProvider</code> used by the CachedRowSet
00057:             */
00058:            private SyncProvider provider;
00059:
00060:            /**
00061:             * The <code>RowSetReaderImpl</code> object that is the reader
00062:             * for this rowset.  The method <code>execute</code> uses this
00063:             * reader as part of its implementation.
00064:             * @serial
00065:             */
00066:            private RowSetReader rowSetReader;
00067:
00068:            /**
00069:             * The <code>RowSetWriterImpl</code> object that is the writer
00070:             * for this rowset.  The method <code>acceptChanges</code> uses
00071:             * this writer as part of its implementation.
00072:             * @serial
00073:             */
00074:            private RowSetWriter rowSetWriter;
00075:
00076:            /**
00077:             * The <code>Connection</code> object that connects with this
00078:             * <code>CachedRowSetImpl</code> object's current underlying data source.
00079:             */
00080:            private transient Connection conn;
00081:
00082:            /**
00083:             * The <code>ResultSetMetaData</code> object that contains information
00084:             * about the columns in the <code>ResultSet</code> object that is the
00085:             * current source of data for this <code>CachedRowSetImpl</code> object.
00086:             */
00087:            private transient ResultSetMetaData RSMD;
00088:
00089:            /**
00090:             * The <code>RowSetMetaData</code> object that contains information about
00091:             * the columns in this <code>CachedRowSetImpl</code> object.
00092:             * @serial
00093:             */
00094:            private RowSetMetaDataImpl RowSetMD;
00095:
00096:            // Properties of this RowSet
00097:
00098:            /**
00099:             * An array containing the columns in this <code>CachedRowSetImpl</code>
00100:             * object that form a unique identifier for a row. This array
00101:             * is used by the writer.
00102:             * @serial
00103:             */
00104:            private int keyCols[];
00105:
00106:            /**
00107:             * The name of the table in the underlying database to which updates
00108:             * should be written.  This name is needed because most drivers
00109:             * do not return this information in a <code>ResultSetMetaData</code>
00110:             * object.
00111:             * @serial
00112:             */
00113:            private String tableName;
00114:
00115:            /**
00116:             * A <code>Vector</code> object containing the <code>Row</code>
00117:             * objects that comprise  this <code>CachedRowSetImpl</code> object.
00118:             * @serial
00119:             */
00120:            private Vector rvh;
00121:            /**
00122:             * The current postion of the cursor in this <code>CachedRowSetImpl</code>
00123:             * object.
00124:             * @serial
00125:             */
00126:            private int cursorPos;
00127:
00128:            /**
00129:             * The current postion of the cursor in this <code>CachedRowSetImpl</code>
00130:             * object not counting rows that have been deleted, if any.
00131:             * <P>
00132:             * For example, suppose that the cursor is on the last row of a rowset
00133:             * that started with five rows and subsequently had the second and third
00134:             * rows deleted. The <code>absolutePos</code> would be <code>3</code>,
00135:             * whereas the <code>cursorPos</code> would be <code>5</code>.
00136:             * @serial
00137:             */
00138:            private int absolutePos;
00139:
00140:            /**
00141:             * The number of deleted rows currently in this <code>CachedRowSetImpl</code>
00142:             * object.
00143:             * @serial
00144:             */
00145:            private int numDeleted;
00146:
00147:            /**
00148:             * The total number of rows currently in this <code>CachedRowSetImpl</code>
00149:             * object.
00150:             * @serial
00151:             */
00152:            private int numRows;
00153:
00154:            /**
00155:             * A special row used for constructing a new row. A new
00156:             * row is constructed by using <code>ResultSet.updateXXX</code>
00157:             * methods to insert column values into the insert row.
00158:             * @serial
00159:             */
00160:            private InsertRow insertRow;
00161:
00162:            /**
00163:             * A <code>boolean</code> indicating whether the cursor is
00164:             * currently on the insert row.
00165:             * @serial
00166:             */
00167:            private boolean onInsertRow;
00168:
00169:            /**
00170:             * The field that temporarily holds the last position of the
00171:             * cursor before it moved to the insert row, thus preserving
00172:             * the number of the current row to which the cursor may return.
00173:             * @serial
00174:             */
00175:            private int currentRow;
00176:
00177:            /**
00178:             * A <code>boolean</code> indicating whether the last value
00179:             * returned was an SQL <code>NULL</code>.
00180:             * @serial
00181:             */
00182:            private boolean lastValueNull;
00183:
00184:            /**
00185:             * A <code>SQLWarning</code> which logs on the warnings
00186:             */
00187:            private SQLWarning sqlwarn;
00188:
00189:            /**
00190:             * Used to track match column for JoinRowSet consumption
00191:             */
00192:            private String strMatchColumn = "";
00193:
00194:            /**
00195:             * Used to track match column for JoinRowSet consumption
00196:             */
00197:            private int iMatchColumn = -1;
00198:
00199:            /**
00200:             * A <code>RowSetWarning</code> which logs on the warnings
00201:             */
00202:            private RowSetWarning rowsetWarning;
00203:
00204:            /**
00205:             * The default SyncProvider for the RI CachedRowSetImpl
00206:             */
00207:            private String DEFAULT_SYNC_PROVIDER = "com.sun.rowset.providers.RIOptimisticProvider";
00208:
00209:            /**
00210:             * The boolean variable indicating locatorsUpdateValue
00211:             */
00212:            private boolean dbmslocatorsUpdateCopy;
00213:
00214:            /**
00215:             * The <code>ResultSet</code> object that is used to maintain the data when
00216:             * a ResultSet and start position are passed as parameters to the populate function
00217:             */
00218:            private transient ResultSet resultSet;
00219:
00220:            /**
00221:             * The integer value indicating the end position in the ResultSetwhere the picking
00222:             * up of rows for populating a CachedRowSet object was left off.
00223:             */
00224:            private int endPos;
00225:
00226:            /**
00227:             * The integer value indicating the end position in the ResultSetwhere the picking
00228:             * up of rows for populating a CachedRowSet object was left off.
00229:             */
00230:            private int prevEndPos;
00231:
00232:            /**
00233:             * The integer value indicating the position in the ResultSet, to populate the
00234:             * CachedRowSet object.
00235:             */
00236:            private int startPos;
00237:
00238:            /**
00239:             * The integer value indicating the positon from where the page prior to this
00240:             * was populated.
00241:             */
00242:            private int startPrev;
00243:
00244:            /**
00245:             * The integer value indicating size of the page.
00246:             */
00247:            private int pageSize;
00248:
00249:            /**
00250:             * The integer value indicating number of rows that have been processed so far.
00251:             * Used for checking whether maxRows has been reached or not.
00252:             */
00253:            private int maxRowsreached;
00254:            /**
00255:             * The boolean value when true signifies that pages are still to follow and a
00256:             * false value indicates that this is the last page.
00257:             */
00258:            private boolean pagenotend = true;
00259:
00260:            /**
00261:             * The boolean value indicating whether this is the first page or not.
00262:             */
00263:            private boolean onFirstPage;
00264:
00265:            /**
00266:             * The boolean value indicating whether this is the last page or not.
00267:             */
00268:            private boolean onLastPage;
00269:
00270:            /**
00271:             * The integer value indicating how many times the populate function has been called.
00272:             */
00273:            private int populatecallcount;
00274:
00275:            /**
00276:             * The integer value indicating the total number of rows to be processed in the
00277:             * ResultSet object passed to the populate function.
00278:             */
00279:            private int totalRows;
00280:
00281:            /**
00282:             * The boolean value indicating how the CahedRowSet object has been populated for
00283:             * paging purpose. True indicates that connection parameter is passed.
00284:             */
00285:            private boolean callWithCon;
00286:
00287:            /**
00288:             * CachedRowSet reader object to read the data from the ResultSet when a connection
00289:             * parameter is passed to populate the CachedRowSet object for paging.
00290:             */
00291:            private CachedRowSetReader crsReader;
00292:
00293:            /**
00294:             * The Vector holding the Match Columns
00295:             */
00296:            private Vector iMatchColumns;
00297:
00298:            /**
00299:             * The Vector that will hold the Match Column names.
00300:             */
00301:            private Vector strMatchColumns;
00302:
00303:            /**
00304:             * Trigger that indicates whether the active SyncProvider is exposes the
00305:             * additional TransactionalWriter method
00306:             */
00307:            private boolean tXWriter = false;
00308:
00309:            /**
00310:             * The field object for a transactional RowSet writer
00311:             */
00312:            private TransactionalWriter tWriter = null;
00313:
00314:            protected transient JdbcRowSetResourceBundle resBundle;
00315:
00316:            private boolean updateOnInsert;
00317:
00318:            /**
00319:             * Constructs a new default <code>CachedRowSetImpl</code> object with
00320:             * the capacity to hold 100 rows. This new object has no metadata
00321:             * and has the following default values:
00322:             * <pre>
00323:             *     onInsertRow = false
00324:             *     insertRow = null
00325:             *     cursorPos = 0
00326:             *     numRows = 0
00327:             *     showDeleted = false
00328:             *     queryTimeout = 0
00329:             *     maxRows = 0
00330:             *     maxFieldSize = 0
00331:             *     rowSetType = ResultSet.TYPE_SCROLL_INSENSITIVE
00332:             *     concurrency = ResultSet.CONCUR_UPDATABLE
00333:             *     readOnly = false
00334:             *     isolation = Connection.TRANSACTION_READ_COMMITTED
00335:             *     escapeProcessing = true
00336:             *     onInsertRow = false
00337:             *     insertRow = null
00338:             *     cursorPos = 0
00339:             *     absolutePos = 0
00340:             *     numRows = 0
00341:             * </pre>
00342:             * A <code>CachedRowSetImpl</code> object is configured to use the default
00343:             * <code>RIOptimisticProvider</code> implementation to provide connectivity
00344:             * and synchronization capabilities to the set data source.
00345:             * <P>
00346:             * @throws SQLException if an error occurs
00347:             */
00348:            public CachedRowSetImpl() throws SQLException {
00349:
00350:                try {
00351:                    resBundle = JdbcRowSetResourceBundle
00352:                            .getJdbcRowSetResourceBundle();
00353:                } catch (IOException ioe) {
00354:                    throw new RuntimeException(ioe);
00355:                }
00356:
00357:                // set the Reader, this maybe overridden latter
00358:                provider = (SyncProvider) SyncFactory
00359:                        .getInstance(DEFAULT_SYNC_PROVIDER);
00360:
00361:                if (!(provider instanceof  RIOptimisticProvider)) {
00362:                    throw new SQLException(resBundle.handleGetObject(
00363:                            "cachedrowsetimpl.invalidp").toString());
00364:                }
00365:
00366:                rowSetReader = (CachedRowSetReader) provider.getRowSetReader();
00367:                rowSetWriter = (CachedRowSetWriter) provider.getRowSetWriter();
00368:
00369:                // allocate the parameters collection
00370:                initParams();
00371:
00372:                initContainer();
00373:
00374:                // set up some default values
00375:                initProperties();
00376:
00377:                // insert row setup
00378:                onInsertRow = false;
00379:                insertRow = null;
00380:
00381:                // set the warninings
00382:                sqlwarn = new SQLWarning();
00383:                rowsetWarning = new RowSetWarning();
00384:
00385:            }
00386:
00387:            /**
00388:             * Provides a <code>CachedRowSetImpl</code> instance with the same default properties as
00389:             * as the zero parameter constructor.
00390:             * <pre>
00391:             *     onInsertRow = false
00392:             *     insertRow = null
00393:             *     cursorPos = 0
00394:             *     numRows = 0
00395:             *     showDeleted = false
00396:             *     queryTimeout = 0
00397:             *     maxRows = 0
00398:             *     maxFieldSize = 0
00399:             *     rowSetType = ResultSet.TYPE_SCROLL_INSENSITIVE
00400:             *     concurrency = ResultSet.CONCUR_UPDATABLE
00401:             *     readOnly = false
00402:             *     isolation = Connection.TRANSACTION_READ_COMMITTED
00403:             *     escapeProcessing = true
00404:             *     onInsertRow = false
00405:             *     insertRow = null
00406:             *     cursorPos = 0
00407:             *     absolutePos = 0
00408:             *     numRows = 0
00409:             * </pre>
00410:             *
00411:             * However, applications will have the means to specify at runtime the
00412:             * desired <code>SyncProvider</code> object.
00413:             * <p>
00414:             * For example, creating a <code>CachedRowSetImpl</code> object as follows ensures
00415:             * that a it is established with the <code>com.foo.provider.Impl</code> synchronization
00416:             * implementation providing the synchronization mechanism for this disconnected
00417:             * <code>RowSet</code> object.
00418:             * <pre>
00419:             *     Hashtable env = new Hashtable();
00420:             *     env.put(javax.sql.rowset.spi.SyncFactory.ROWSET_PROVIDER_NAME,
00421:             *         "com.foo.provider.Impl");
00422:             *     CachedRowSetImpl crs = new CachedRowSet(env);
00423:             * </pre>
00424:             * <p>
00425:             * Calling this constructor with a <code>null</code> parameter will
00426:             * cause the <code>SyncFactory</code> to provide the reference
00427:             * optimistic provider <code>com.sun.rowset.providers.RIOptimisticProvider</code>.
00428:             * <p>
00429:             * In addition, the following properties can be associated with the
00430:             * provider to assist in determining the choice of the synchronizaton
00431:             * provider such as:
00432:             * <ul>
00433:             * <li><code>ROWSET_SYNC_PROVIDER</code> - the property specifying the the
00434:             * <code>SyncProvider</code> class name to be instantiated by the
00435:             * <code>SyncFacttory</code>
00436:             * <li><code>ROWSET_SYNC_VENDOR</code> - the property specifying the software
00437:             * vendor associated with a <code>SyncProvider</code> implementation.
00438:             * <li><code>ROWSET_SYNC_PROVIDER_VER</code> - the property specifying the
00439:             * version of the <code>SyncProvider</code> implementation provided by the
00440:             * software vendor.
00441:             * </ul>
00442:             * More specific detailes are available in the <code>SyncFactory</code>
00443:             * and <code>SyncProvider</code> specificiations later in this document.
00444:             * <p>
00445:             * @param env a <code>Hashtable</code> object with a list of desired
00446:             *        synchronization providers
00447:             * @throws SQLException if the requested provider cannot be found by the
00448:             * synchonization factory
00449:             * @see SyncProvider
00450:             */
00451:
00452:            public CachedRowSetImpl(Hashtable env) throws SQLException {
00453:
00454:                try {
00455:                    resBundle = JdbcRowSetResourceBundle
00456:                            .getJdbcRowSetResourceBundle();
00457:                } catch (IOException ioe) {
00458:                    throw new RuntimeException(ioe);
00459:                }
00460:
00461:                if (env == null) {
00462:                    throw new SQLException(resBundle.handleGetObject(
00463:                            "cachedrowsetimpl.nullhash").toString());
00464:                }
00465:
00466:                String providerName = (String) env
00467:                        .get(javax.sql.rowset.spi.SyncFactory.ROWSET_SYNC_PROVIDER);
00468:
00469:                // set the Reader, this maybe overridden latter
00470:                provider = (SyncProvider) SyncFactory.getInstance(providerName);
00471:
00472:                rowSetReader = provider.getRowSetReader();
00473:                rowSetWriter = provider.getRowSetWriter();
00474:
00475:                initParams(); // allocate the parameters collection
00476:                initContainer();
00477:                initProperties(); // set up some default values
00478:            }
00479:
00480:            /**
00481:             * Sets the <code>rvh</code> field to a new <code>Vector</code>
00482:             * object with a capacity of 100 and sets the
00483:             * <code>cursorPos</code> and <code>numRows</code> fields to zero.
00484:             */
00485:            private void initContainer() {
00486:
00487:                rvh = new Vector(100);
00488:                cursorPos = 0;
00489:                absolutePos = 0;
00490:                numRows = 0;
00491:                numDeleted = 0;
00492:            }
00493:
00494:            /**
00495:             * Sets the properties for this <code>CachedRowSetImpl</code> object to
00496:             * their default values. This method is called internally by the
00497:             * default constructor.
00498:             */
00499:
00500:            private void initProperties() throws SQLException {
00501:
00502:                if (resBundle == null) {
00503:                    try {
00504:                        resBundle = JdbcRowSetResourceBundle
00505:                                .getJdbcRowSetResourceBundle();
00506:                    } catch (IOException ioe) {
00507:                        throw new RuntimeException(ioe);
00508:                    }
00509:                }
00510:                setShowDeleted(false);
00511:                setQueryTimeout(0);
00512:                setMaxRows(0);
00513:                setMaxFieldSize(0);
00514:                setType(ResultSet.TYPE_SCROLL_INSENSITIVE);
00515:                setConcurrency(ResultSet.CONCUR_UPDATABLE);
00516:                if ((rvh.size() > 0) && (isReadOnly() == false))
00517:                    setReadOnly(false);
00518:                else
00519:                    setReadOnly(true);
00520:                setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
00521:                setEscapeProcessing(true);
00522:                setTypeMap(null);
00523:                checkTransactionalWriter();
00524:
00525:                //Instantiating the vector for MatchColumns
00526:
00527:                iMatchColumns = new Vector(10);
00528:                for (int i = 0; i < 10; i++) {
00529:                    iMatchColumns.add(i, new Integer(-1));
00530:                }
00531:
00532:                strMatchColumns = new Vector(10);
00533:                for (int j = 0; j < 10; j++) {
00534:                    strMatchColumns.add(j, null);
00535:                }
00536:            }
00537:
00538:            /**
00539:             * Determine whether the SyncProvider's writer implements the
00540:             * <code>TransactionalWriter<code> interface
00541:             */
00542:            private void checkTransactionalWriter() {
00543:                if (rowSetWriter != null) {
00544:                    Class c = rowSetWriter.getClass();
00545:                    if (c != null) {
00546:                        Class[] theInterfaces = c.getInterfaces();
00547:                        for (int i = 0; i < theInterfaces.length; i++) {
00548:                            if ((theInterfaces[i].getName())
00549:                                    .indexOf("TransactionalWriter") > 0) {
00550:                                tXWriter = true;
00551:                                establishTransactionalWriter();
00552:                            }
00553:                        }
00554:                    }
00555:                }
00556:            }
00557:
00558:            /**
00559:             * Sets an private field to all transaction bounddaries to be set
00560:             */
00561:            private void establishTransactionalWriter() {
00562:                tWriter = (TransactionalWriter) provider.getRowSetWriter();
00563:            }
00564:
00565:            //-----------------------------------------------------------------------
00566:            // Properties
00567:            //-----------------------------------------------------------------------
00568:
00569:            /**
00570:             * Sets this <code>CachedRowSetImpl</code> object's command property
00571:             * to the given <code>String</code> object and clears the parameters,
00572:             * if any, that were set for the previous command.
00573:             * <P>
00574:             * The command property may not be needed
00575:             * if the rowset is produced by a data source, such as a spreadsheet,
00576:             * that does not support commands. Thus, this property is optional
00577:             * and may be <code>null</code>.
00578:             *
00579:             * @param cmd a <code>String</code> object containing an SQL query
00580:             *            that will be set as the command; may be <code>null</code>
00581:             * @throws SQLException if an error occurs
00582:             */
00583:            public void setCommand(String cmd) throws SQLException {
00584:
00585:                super .setCommand(cmd);
00586:
00587:                if (!buildTableName(cmd).equals("")) {
00588:                    this .setTableName(buildTableName(cmd));
00589:                }
00590:            }
00591:
00592:            //---------------------------------------------------------------------
00593:            // Reading and writing data
00594:            //---------------------------------------------------------------------
00595:
00596:            /**
00597:             * Populates this <code>CachedRowSetImpl</code> object with data from
00598:             * the given <code>ResultSet</code> object.  This
00599:             * method is an alternative to the method <code>execute</code>
00600:             * for filling the rowset with data.  The method <code>populate</code>
00601:             * does not require that the properties needed by the method
00602:             * <code>execute</code>, such as the <code>command</code> property,
00603:             * be set. This is true because the method <code>populate</code>
00604:             * is given the <code>ResultSet</code> object from
00605:             * which to get data and thus does not need to use the properties
00606:             * required for setting up a connection and executing this
00607:             * <code>CachedRowSetImpl</code> object's command.
00608:             * <P>
00609:             * After populating this rowset with data, the method
00610:             * <code>populate</code> sets the rowset's metadata and
00611:             * then sends a <code>RowSetChangedEvent</code> object
00612:             * to all registered listeners prior to returning.
00613:             *
00614:             * @param data the <code>ResultSet</code> object containing the data
00615:             *             to be read into this <code>CachedRowSetImpl</code> object
00616:             * @throws SQLException if an error occurs; or the max row setting is
00617:             *          violated while populating the RowSet
00618:             * @see #execute
00619:             */
00620:
00621:            public void populate(ResultSet data) throws SQLException {
00622:                int rowsFetched;
00623:                Row currentRow;
00624:                int numCols;
00625:                int i;
00626:                Map map = getTypeMap();
00627:                Object obj;
00628:                int mRows;
00629:
00630:                if (data == null) {
00631:                    throw new SQLException(resBundle.handleGetObject(
00632:                            "cachedrowsetimpl.populate").toString());
00633:                }
00634:                this .resultSet = data;
00635:
00636:                // get the meta data for this ResultSet
00637:                RSMD = data.getMetaData();
00638:
00639:                // set up the metadata
00640:                RowSetMD = new RowSetMetaDataImpl();
00641:                initMetaData(RowSetMD, RSMD);
00642:
00643:                // release the meta-data so that aren't tempted to use it.
00644:                RSMD = null;
00645:                numCols = RowSetMD.getColumnCount();
00646:                mRows = this .getMaxRows();
00647:                rowsFetched = 0;
00648:                currentRow = null;
00649:
00650:                while (data.next()) {
00651:
00652:                    currentRow = new Row(numCols);
00653:
00654:                    if (rowsFetched > mRows && mRows > 0) {
00655:                        rowsetWarning
00656:                                .setNextWarning(new RowSetWarning(
00657:                                        "Populating rows "
00658:                                                + "setting has exceeded max row setting"));
00659:                    }
00660:                    for (i = 1; i <= numCols; i++) {
00661:                        /*
00662:                         * check if the user has set a map. If no map
00663:                         * is set then use plain getObject. This lets
00664:                         * us work with drivers that do not support
00665:                         * getObject with a map in fairly sensible way
00666:                         */
00667:                        if (map == null) {
00668:                            obj = data.getObject(i);
00669:                        } else {
00670:                            obj = data.getObject(i, map);
00671:                        }
00672:                        /*
00673:                         * the following block checks for the various
00674:                         * types that we have to serialize in order to
00675:                         * store - right now only structs have been tested
00676:                         */
00677:                        if (obj instanceof  Struct) {
00678:                            obj = new SerialStruct((Struct) obj, map);
00679:                        } else if (obj instanceof  SQLData) {
00680:                            obj = new SerialStruct((SQLData) obj, map);
00681:                        } else if (obj instanceof  Blob) {
00682:                            obj = new SerialBlob((Blob) obj);
00683:                        } else if (obj instanceof  Clob) {
00684:                            obj = new SerialClob((Clob) obj);
00685:                        } else if (obj instanceof  java.sql.Array) {
00686:                            obj = new SerialArray((java.sql.Array) obj, map);
00687:                        }
00688:
00689:                        ((Row) currentRow).initColumnObject(i, obj);
00690:                    }
00691:                    rowsFetched++;
00692:                    rvh.add(currentRow);
00693:                }
00694:
00695:                numRows = rowsFetched;
00696:                // Also rowsFetched should be equal to rvh.size()
00697:
00698:                // notify any listeners that the rowset has changed
00699:                notifyRowSetChanged();
00700:
00701:            }
00702:
00703:            /**
00704:             * Initializes the given <code>RowSetMetaData</code> object with the values
00705:             * in the given <code>ResultSetMetaData</code> object.
00706:             *
00707:             * @param md the <code>RowSetMetaData</code> object for this
00708:             *           <code>CachedRowSetImpl</code> object, which will be set with
00709:             *           values from rsmd
00710:             * @param rsmd the <code>ResultSetMetaData</code> object from which new
00711:             *             values for md will be read
00712:             * @throws SQLException if an error occurs
00713:             */
00714:            private void initMetaData(RowSetMetaDataImpl md,
00715:                    ResultSetMetaData rsmd) throws SQLException {
00716:                int numCols = rsmd.getColumnCount();
00717:
00718:                md.setColumnCount(numCols);
00719:                for (int col = 1; col <= numCols; col++) {
00720:                    md.setAutoIncrement(col, rsmd.isAutoIncrement(col));
00721:                    if (rsmd.isAutoIncrement(col))
00722:                        updateOnInsert = true;
00723:                    md.setCaseSensitive(col, rsmd.isCaseSensitive(col));
00724:                    md.setCurrency(col, rsmd.isCurrency(col));
00725:                    md.setNullable(col, rsmd.isNullable(col));
00726:                    md.setSigned(col, rsmd.isSigned(col));
00727:                    md.setSearchable(col, rsmd.isSearchable(col));
00728:                    /*
00729:                     * The PostgreSQL drivers sometimes return negative columnDisplaySize,
00730:                     * which causes an exception to be thrown.  Check for it.
00731:                     */
00732:                    int size = rsmd.getColumnDisplaySize(col);
00733:                    if (size < 0) {
00734:                        size = 0;
00735:                    }
00736:                    md.setColumnDisplaySize(col, size);
00737:                    md.setColumnLabel(col, rsmd.getColumnLabel(col));
00738:                    md.setColumnName(col, rsmd.getColumnName(col));
00739:                    md.setSchemaName(col, rsmd.getSchemaName(col));
00740:                    /*
00741:                     * Drivers return some strange values for precision, for non-numeric data, including reports of
00742:                     * non-integer values; maybe we should check type, & set to 0 for non-numeric types.
00743:                     */
00744:                    int precision = rsmd.getPrecision(col);
00745:                    if (precision < 0) {
00746:                        precision = 0;
00747:                    }
00748:                    md.setPrecision(col, precision);
00749:
00750:                    /*
00751:                     * It seems, from a bug report, that a driver can sometimes return a negative
00752:                     * value for scale.  javax.sql.rowset.RowSetMetaDataImpl will throw an exception
00753:                     * if we attempt to set a negative value.  As such, we'll check for this case.
00754:                     */
00755:                    int scale = rsmd.getScale(col);
00756:                    if (scale < 0) {
00757:                        scale = 0;
00758:                    }
00759:                    md.setScale(col, scale);
00760:                    md.setTableName(col, rsmd.getTableName(col));
00761:                    md.setCatalogName(col, rsmd.getCatalogName(col));
00762:                    md.setColumnType(col, rsmd.getColumnType(col));
00763:                    md.setColumnTypeName(col, rsmd.getColumnTypeName(col));
00764:                }
00765:
00766:                if (conn != null) {
00767:                    // JDBC 4.0 mandates as does the Java EE spec that all DataBaseMetaData methods
00768:                    // must be implemented, therefore, the previous fix for 5055528 is being backed out        
00769:                    dbmslocatorsUpdateCopy = conn.getMetaData()
00770:                            .locatorsUpdateCopy();
00771:                }
00772:            }
00773:
00774:            /**
00775:             * Populates this <code>CachedRowSetImpl</code> object with data,
00776:             * using the given connection to produce the result set from
00777:             * which data will be read.  A second form of this method,
00778:             * which takes no arguments, uses the values from this rowset's
00779:             * user, password, and either url or data source properties to
00780:             * create a new database connection. The form of <code>execute</code>
00781:             * that is given a connection ignores these properties.
00782:             *
00783:             * @param conn A standard JDBC <code>Connection</code> object that this
00784:             * <code>CachedRowSet</code> object can pass to a synchronization provider
00785:             * to establish a connection to the data source
00786:             * @throws SQLException if an invalid <code>Connection</code> is supplied
00787:             *           or an error occurs in establishing the connection to the
00788:             *           data source
00789:             * @see #populate
00790:             * @see java.sql.Connection
00791:             */
00792:            public void execute(Connection conn) throws SQLException {
00793:                // store the connection so the reader can find it.
00794:                setConnection(conn);
00795:
00796:                if (getPageSize() != 0) {
00797:                    crsReader = (CachedRowSetReader) provider.getRowSetReader();
00798:                    crsReader.setStartPosition(1);
00799:                    callWithCon = true;
00800:                    crsReader.readData((RowSetInternal) this );
00801:                }
00802:
00803:                // Now call the current reader's readData method
00804:                else {
00805:                    rowSetReader.readData((RowSetInternal) this );
00806:                }
00807:                RowSetMD = (RowSetMetaDataImpl) this .getMetaData();
00808:
00809:                if (conn != null) {
00810:                    // JDBC 4.0 mandates as does the Java EE spec that all DataBaseMetaData methods
00811:                    // must be implemented, therefore, the previous fix for 5055528 is being backed out        
00812:                    dbmslocatorsUpdateCopy = conn.getMetaData()
00813:                            .locatorsUpdateCopy();
00814:                }
00815:
00816:            }
00817:
00818:            /**
00819:             * Sets this <code>CachedRowSetImpl</code> object's connection property
00820:             * to the given <code>Connection</code> object.  This method is called
00821:             * internally by the version of the method <code>execute</code> that takes a
00822:             * <code>Connection</code> object as an argument. The reader for this
00823:             * <code>CachedRowSetImpl</code> object can retrieve the connection stored
00824:             * in the rowset's connection property by calling its
00825:             * <code>getConnection</code> method.
00826:             *
00827:             * @param connection the <code>Connection</code> object that was passed in
00828:             *                   to the method <code>execute</code> and is to be stored
00829:             *                   in this <code>CachedRowSetImpl</code> object's connection
00830:             *                   property
00831:             */
00832:            private void setConnection(Connection connection) {
00833:                conn = connection;
00834:            }
00835:
00836:            /**
00837:             * Propagates all row update, insert, and delete changes to the
00838:             * underlying data source backing this <code>CachedRowSetImpl</code>
00839:             * object.
00840:             * <P>
00841:             * <b>Note</b>In the reference implementation an optimistic concurrency implementation
00842:             * is provided as a sample implementation of a the <code>SyncProvider</code>
00843:             * abstract class.
00844:             * <P>
00845:             * This method fails if any of the updates cannot be propagated back
00846:             * to the data source.  When it fails, the caller can assume that
00847:             * none of the updates are reflected in the data source.
00848:             * When an exception is thrown, the current row
00849:             * is set to the first "updated" row that resulted in an exception
00850:             * unless the row that caused the exception is a "deleted" row.
00851:             * In that case, when deleted rows are not shown, which is usually true,
00852:             * the current row is not affected.
00853:             * <P>
00854:             * If no <code>SyncProvider</code> is configured, the reference implementation
00855:             * leverages the <code>RIOptimisticProvider</code> available which provides the
00856:             * default and reference synchronization capabilities for disconnected
00857:             * <code>RowSets</code>.
00858:             *
00859:             * @throws SQLException if the cursor is on the insert row or the underlying
00860:             * 		reference synchronization provider fails to commit the updates
00861:             * 		to the datasource
00862:             * @throws SyncProviderException if an internal error occurs within the
00863:             *          <code>SyncProvider</code> instance during either during the
00864:             *          process or at any time when the <code>SyncProvider</code>
00865:             *          instance touches the data source.
00866:             * @see #acceptChanges(java.sql.Connection)
00867:             * @see javax.sql.RowSetWriter
00868:             * @see javax.sql.rowset.spi.SyncProvider
00869:             */
00870:            public void acceptChanges() throws SyncProviderException {
00871:                if (onInsertRow == true) {
00872:                    throw new SyncProviderException(resBundle.handleGetObject(
00873:                            "cachedrowsetimpl.invalidop").toString());
00874:                }
00875:
00876:                int saveCursorPos = cursorPos;
00877:                boolean success = false;
00878:                boolean conflict = false;
00879:
00880:                try {
00881:                    if (rowSetWriter != null) {
00882:                        saveCursorPos = cursorPos;
00883:                        conflict = rowSetWriter
00884:                                .writeData((RowSetInternal) this );
00885:                        cursorPos = saveCursorPos;
00886:                    }
00887:
00888:                    if ((tXWriter) && this .COMMIT_ON_ACCEPT_CHANGES) {
00889:                        // do commit/rollback's here
00890:                        if (!conflict) {
00891:                            tWriter = (TransactionalWriter) rowSetWriter;
00892:                            tWriter.rollback();
00893:                            success = false;
00894:                        } else {
00895:                            tWriter = (TransactionalWriter) rowSetWriter;
00896:                            ((CachedRowSetWriter) tWriter).commit(this ,
00897:                                    updateOnInsert);
00898:                            success = true;
00899:                        }
00900:                    }
00901:
00902:                    if (success == true) {
00903:                        setOriginal();
00904:                    } else if (!(success) && !(this .COMMIT_ON_ACCEPT_CHANGES)) {
00905:                        throw new SyncProviderException(resBundle
00906:                                .handleGetObject("cachedrowsetimpl.accfailed")
00907:                                .toString());
00908:                    }
00909:
00910:                } catch (SyncProviderException spe) {
00911:                    throw spe;
00912:                } catch (SQLException e) {
00913:                    e.printStackTrace();
00914:                    throw new SyncProviderException(e.getMessage());
00915:                } catch (SecurityException e) {
00916:                    throw new SyncProviderException(e.getMessage());
00917:                }
00918:            }
00919:
00920:            /**
00921:             * Propagates all row update, insert, and delete changes to the
00922:             * data source backing this <code>CachedRowSetImpl</code> object
00923:             * using the given <code>Connection</code> object.
00924:             * <P>
00925:             * The reference implementation <code>RIOptimisticProvider</code>
00926:             * modifies its synchronization to a write back function given
00927:             * the updated connection
00928:             * The reference implementation modifies its synchronization behaviour
00929:             * via the <code>SyncProvider</code> to ensure the synchronization
00930:             * occurs according to the updated JDBC <code>Connection</code>
00931:             * properties.
00932:             *
00933:             * @param con a standard JDBC <code>Connection</code> object
00934:             * @throws SQLException if the cursor is on the insert row or the underlying
00935:             *                   synchronization provider fails to commit the updates
00936:             *                   back to the data source
00937:             * @see #acceptChanges
00938:             * @see javax.sql.RowSetWriter
00939:             * @see javax.sql.rowset.spi.SyncFactory
00940:             * @see javax.sql.rowset.spi.SyncProvider
00941:             */
00942:            public void acceptChanges(Connection con)
00943:                    throws SyncProviderException {
00944:
00945:                try {
00946:                    setConnection(con);
00947:                    acceptChanges();
00948:                } catch (SyncProviderException spe) {
00949:                    throw spe;
00950:                } catch (SQLException sqle) {
00951:                    throw new SyncProviderException(sqle.getMessage());
00952:                }
00953:            }
00954:
00955:            /**
00956:             * Restores this <code>CachedRowSetImpl</code> object to its original state,
00957:             * that is, its state before the last set of changes.
00958:             * <P>
00959:             * Before returning, this method moves the cursor before the first row
00960:             * and sends a <code>rowSetChanged</code> event to all registered
00961:             * listeners.
00962:             * @throws SQLException if an error is occurs rolling back the RowSet
00963:             *           state to the definied original value.
00964:             * @see javax.sql.RowSetListener#rowSetChanged
00965:             */
00966:            public void restoreOriginal() throws SQLException {
00967:                Row currentRow;
00968:                for (Iterator i = rvh.iterator(); i.hasNext();) {
00969:                    currentRow = (Row) i.next();
00970:                    if (currentRow.getInserted() == true) {
00971:                        i.remove();
00972:                        --numRows;
00973:                    } else {
00974:                        if (currentRow.getDeleted() == true) {
00975:                            currentRow.clearDeleted();
00976:                        }
00977:                        if (currentRow.getUpdated() == true) {
00978:                            currentRow.clearUpdated();
00979:                        }
00980:                    }
00981:                }
00982:                // move to before the first
00983:                cursorPos = 0;
00984:
00985:                // notify any listeners
00986:                notifyRowSetChanged();
00987:            }
00988:
00989:            /**
00990:             * Releases the current contents of this <code>CachedRowSetImpl</code>
00991:             * object and sends a <code>rowSetChanged</code> event object to all
00992:             * registered listeners.
00993:             *
00994:             * @throws SQLException if an error occurs flushing the contents of
00995:             *           RowSet.
00996:             * @see javax.sql.RowSetListener#rowSetChanged
00997:             */
00998:            public void release() throws SQLException {
00999:                initContainer();
01000:                notifyRowSetChanged();
01001:            }
01002:
01003:            /**
01004:             * Cancels deletion of the current row and notifies listeners that
01005:             * a row has changed.
01006:             * <P>
01007:             * Note:  This method can be ignored if deleted rows are not being shown,
01008:             * which is the normal case.
01009:             *
01010:             * @throws SQLException if the cursor is not on a valid row
01011:             */
01012:            public void undoDelete() throws SQLException {
01013:                if (getShowDeleted() == false) {
01014:                    return;
01015:                }
01016:                // make sure we are on a row
01017:                checkCursor();
01018:
01019:                // don't want this to happen...
01020:                if (onInsertRow == true) {
01021:                    throw new SQLException(resBundle.handleGetObject(
01022:                            "cachedrowsetimpl.invalidcp").toString());
01023:                }
01024:
01025:                Row currentRow = (Row) getCurrentRow();
01026:                if (currentRow.getDeleted() == true) {
01027:                    currentRow.clearDeleted();
01028:                    --numDeleted;
01029:                    notifyRowChanged();
01030:                }
01031:            }
01032:
01033:            /**
01034:             * Immediately removes the current row from this
01035:             * <code>CachedRowSetImpl</code> object if the row has been inserted, and
01036:             * also notifies listeners the a row has changed.  An exception is thrown
01037:             * if the row is not a row that has been inserted or the cursor is before
01038:             * the first row, after the last row, or on the insert row.
01039:             * <P>
01040:             * This operation cannot be undone.
01041:             *
01042:             * @throws SQLException if an error occurs,
01043:             *                         the cursor is not on a valid row,
01044:             *                         or the row has not been inserted
01045:             */
01046:            public void undoInsert() throws SQLException {
01047:                // make sure we are on a row
01048:                checkCursor();
01049:
01050:                // don't want this to happen...
01051:                if (onInsertRow == true) {
01052:                    throw new SQLException(resBundle.handleGetObject(
01053:                            "cachedrowsetimpl.invalidcp").toString());
01054:                }
01055:
01056:                Row currentRow = (Row) getCurrentRow();
01057:                if (currentRow.getInserted() == true) {
01058:                    rvh.remove(cursorPos - 1);
01059:                    --numRows;
01060:                    notifyRowChanged();
01061:                } else {
01062:                    throw new SQLException(resBundle.handleGetObject(
01063:                            "cachedrowsetimpl.illegalop").toString());
01064:                }
01065:            }
01066:
01067:            /**
01068:             * Immediately reverses the last update operation if the
01069:             * row has been modified. This method can be
01070:             * called to reverse updates on a all columns until all updates in a row have
01071:             * been rolled back to their originating state since the last synchronization
01072:             * (<code>acceptChanges</code>) or population. This method may also be called
01073:             * while performing updates to the insert row.
01074:             * <P>
01075:             * <code>undoUpdate</code may be called at any time during the life-time of a
01076:             * rowset, however after a synchronization has occurs this method has no
01077:             * affect until further modification to the RowSet data occurs.
01078:             *
01079:             * @throws SQLException if cursor is before the first row, after the last
01080:             *     row in rowset.
01081:             * @see #undoDelete
01082:             * @see #undoInsert
01083:             * @see java.sql.ResultSet#cancelRowUpdates
01084:             */
01085:            public void undoUpdate() throws SQLException {
01086:                // if on insert row, cancel the insert row
01087:                // make the insert row flag,
01088:                // cursorPos back to the current row
01089:                moveToCurrentRow();
01090:
01091:                // else if not on insert row
01092:                // call undoUpdate or undoInsert
01093:                undoDelete();
01094:
01095:                undoInsert();
01096:
01097:            }
01098:
01099:            //--------------------------------------------------------------------
01100:            // Views
01101:            //--------------------------------------------------------------------
01102:
01103:            /**
01104:             * Returns a new <code>RowSet</code> object backed by the same data as
01105:             * that of this <code>CachedRowSetImpl</code> object and sharing a set of cursors
01106:             * with it. This allows cursors to interate over a shared set of rows, providing
01107:             * multiple views of the underlying data.
01108:             *
01109:             * @return a <code>RowSet</code> object that is a copy of this <code>CachedRowSetImpl</code>
01110:             * object and shares a set of cursors with it
01111:             * @throws SQLException if an error occurs or cloning is
01112:             *                         not supported
01113:             * @see javax.sql.RowSetEvent
01114:             * @see javax.sql.RowSetListener
01115:             */
01116:            public RowSet createShared() throws SQLException {
01117:                RowSet clone;
01118:                try {
01119:                    clone = (RowSet) clone();
01120:                } catch (CloneNotSupportedException ex) {
01121:                    throw new SQLException(ex.getMessage());
01122:                }
01123:                return clone;
01124:            }
01125:
01126:            /**
01127:             * Returns a new <code>RowSet</code> object containing by the same data
01128:             * as this <code>CachedRowSetImpl</code> object.  This method
01129:             * differs from the method <code>createCopy</code> in that it throws a
01130:             * <code>CloneNotSupportedException</code> object instead of an
01131:             * <code>SQLException</code> object, as the method <code>createShared</code>
01132:             * does.  This <code>clone</code>
01133:             * method is called internally by the method <code>createShared</code>,
01134:             * which catches the <code>CloneNotSupportedException</code> object
01135:             * and in turn throws a new <code>SQLException</code> object.
01136:             *
01137:             * @return a copy of this <code>CachedRowSetImpl</code> object
01138:             * @throws CloneNotSupportedException if an error occurs when
01139:             * attempting to clone this <code>CachedRowSetImpl</code> object
01140:             * @see #createShared
01141:             */
01142:            protected Object clone() throws CloneNotSupportedException {
01143:                return (super .clone());
01144:            }
01145:
01146:            /**
01147:             * Creates a <code>RowSet</code> object that is a deep copy of
01148:             * this <code>CachedRowSetImpl</code> object's data, including
01149:             * constraints.  Updates made
01150:             * on a copy are not visible to the original rowset;
01151:             * a copy of a rowset is completely independent from the original.
01152:             * <P>
01153:             * Making a copy saves the cost of creating an identical rowset
01154:             * from first principles, which can be quite expensive.
01155:             * For example, it can eliminate the need to query a
01156:             * remote database server.
01157:             * @return a new <code>CachedRowSet</code> object that is a deep copy
01158:             *           of this <code>CachedRowSet</code> object and is
01159:             *           completely independent from this <code>CachedRowSetImpl</code>
01160:             *           object.
01161:             * @throws SQLException if an error occurs in generating the copy of this
01162:             *           of the <code>CachedRowSetImpl</code>
01163:             * @see #createShared
01164:             * @see javax.sql.RowSetEvent
01165:             * @see javax.sql.RowSetListener
01166:             */
01167:            public CachedRowSet createCopy() throws SQLException {
01168:                ObjectOutputStream out;
01169:                ByteArrayOutputStream bOut = new ByteArrayOutputStream();
01170:                try {
01171:                    out = new ObjectOutputStream(bOut);
01172:                    out.writeObject(this );
01173:                } catch (IOException ex) {
01174:                    throw new SQLException(MessageFormat.format(resBundle
01175:                            .handleGetObject("cachedrowsetimpl.clonefail")
01176:                            .toString(), ex.getMessage()));
01177:                }
01178:
01179:                ObjectInputStream in;
01180:
01181:                try {
01182:                    ByteArrayInputStream bIn = new ByteArrayInputStream(bOut
01183:                            .toByteArray());
01184:                    in = new ObjectInputStream(bIn);
01185:                } catch (StreamCorruptedException ex) {
01186:                    throw new SQLException(MessageFormat.format(resBundle
01187:                            .handleGetObject("cachedrowsetimpl.clonefail")
01188:                            .toString(), ex.getMessage()));
01189:                } catch (IOException ex) {
01190:                    throw new SQLException(MessageFormat.format(resBundle
01191:                            .handleGetObject("cachedrowsetimpl.clonefail")
01192:                            .toString(), ex.getMessage()));
01193:                }
01194:
01195:                try {
01196:                    //return ((CachedRowSet)(in.readObject()));            
01197:                    CachedRowSetImpl crsTemp = (CachedRowSetImpl) in
01198:                            .readObject();
01199:                    crsTemp.resBundle = this .resBundle;
01200:                    return ((CachedRowSet) crsTemp);
01201:
01202:                } catch (ClassNotFoundException ex) {
01203:                    throw new SQLException(MessageFormat.format(resBundle
01204:                            .handleGetObject("cachedrowsetimpl.clonefail")
01205:                            .toString(), ex.getMessage()));
01206:                } catch (OptionalDataException ex) {
01207:                    throw new SQLException(MessageFormat.format(resBundle
01208:                            .handleGetObject("cachedrowsetimpl.clonefail")
01209:                            .toString(), ex.getMessage()));
01210:                } catch (IOException ex) {
01211:                    throw new SQLException(MessageFormat.format(resBundle
01212:                            .handleGetObject("cachedrowsetimpl.clonefail")
01213:                            .toString(), ex.getMessage()));
01214:                }
01215:            }
01216:
01217:            /**
01218:             * Creates a <code>RowSet</code> object that is a copy of
01219:             * this <code>CachedRowSetImpl</code> object's table structure
01220:             * and the constraints only.
01221:             * There will be no data in the object being returned.
01222:             * Updates made on a copy are not visible to the original rowset.
01223:             * <P>
01224:             * This helps in getting the underlying XML schema which can
01225:             * be used as the basis for populating a <code>WebRowSet</code>.
01226:             *
01227:             * @return a new <code>CachedRowSet</code> object that is a copy
01228:             * of this <code>CachedRowSetImpl</code> object's schema and
01229:             * retains all the constraints on the original rowset but contains
01230:             * no data
01231:             * @throws SQLException if an error occurs in generating the copy
01232:             * of the <code>CachedRowSet</code> object
01233:             * @see #createShared
01234:             * @see #createCopy
01235:             * @see #createCopyNoConstraints
01236:             * @see javax.sql.RowSetEvent
01237:             * @see javax.sql.RowSetListener
01238:             */
01239:            public CachedRowSet createCopySchema() throws SQLException {
01240:                // Copy everything except data i.e all constraints
01241:
01242:                // Store the number of rows of "this"
01243:                // and make numRows equals zero.
01244:                // and make data also zero.
01245:                int nRows = numRows;
01246:                numRows = 0;
01247:
01248:                CachedRowSet crs = this .createCopy();
01249:
01250:                // reset this object back to number of rows.
01251:                numRows = nRows;
01252:
01253:                return crs;
01254:            }
01255:
01256:            /**
01257:             * Creates a <code>CachedRowSet</code> object that is a copy of
01258:             * this <code>CachedRowSetImpl</code> object's data only.
01259:             * All constraints set in this object will not be there
01260:             * in the returning object.  Updates made
01261:             * on a copy are not visible to the original rowset.
01262:             *
01263:             * @return a new <code>CachedRowSet</code> object that is a deep copy
01264:             * of this <code>CachedRowSetImpl</code> object and is
01265:             * completely independent from this <code>CachedRowSetImpl</code> object
01266:             * @throws SQLException if an error occurs in generating the copy of the
01267:             * of the <code>CachedRowSet</code>
01268:             * @see #createShared
01269:             * @see #createCopy
01270:             * @see #createCopySchema
01271:             * @see javax.sql.RowSetEvent
01272:             * @see javax.sql.RowSetListener
01273:             */
01274:            public CachedRowSet createCopyNoConstraints() throws SQLException {
01275:                // Copy the whole data ONLY without any constraints.
01276:                CachedRowSetImpl crs;
01277:                crs = (CachedRowSetImpl) this .createCopy();
01278:
01279:                crs.initProperties();
01280:                try {
01281:                    crs.unsetMatchColumn(crs.getMatchColumnIndexes());
01282:                } catch (SQLException sqle) {
01283:                    //do nothing, if the setMatchColumn is not set.
01284:                }
01285:
01286:                try {
01287:                    crs.unsetMatchColumn(crs.getMatchColumnNames());
01288:                } catch (SQLException sqle) {
01289:                    //do nothing, if the setMatchColumn is not set.
01290:                }
01291:
01292:                return crs;
01293:            }
01294:
01295:            /**
01296:             * Converts this <code>CachedRowSetImpl</code> object to a collection
01297:             * of tables. The sample implementation utilitizes the <code>TreeMap</code>
01298:             * collection type.
01299:             * This class guarantees that the map will be in ascending key order,
01300:             * sorted according to the natural order for the key's class.
01301:             *
01302:             * @return a <code>Collection</code> object consisting of tables,
01303:             *         each of which is a copy of a row in this
01304:             *         <code>CachedRowSetImpl</code> object
01305:             * @throws SQLException if an error occurs in generating the collection
01306:             * @see #toCollection(int)
01307:             * @see #toCollection(String)
01308:             * @see java.util.TreeMap
01309:             */
01310:            public Collection<?> toCollection() throws SQLException {
01311:
01312:                TreeMap tMap;
01313:                int count = 0;
01314:                Row origRow;
01315:                Vector newRow;
01316:
01317:                int colCount = ((RowSetMetaDataImpl) this .getMetaData())
01318:                        .getColumnCount();
01319:
01320:                tMap = new TreeMap();
01321:
01322:                for (int i = 0; i < numRows; i++) {
01323:                    tMap.put(new Integer(i), rvh.get(i));
01324:                }
01325:
01326:                return (tMap.values());
01327:            }
01328:
01329:            /**
01330:             * Returns the specified column of this <code>CachedRowSetImpl</code> object
01331:             * as a <code>Collection</code> object.  This method makes a copy of the
01332:             * column's data and utilitizes the <code>Vector</code> to establish the
01333:             * collection. The <code>Vector</code> class implements a growable array
01334:             * objects allowing the individual components to be accessed using an
01335:             * an integer index similar to that of an array.
01336:             *
01337:             * @return a <code>Collection</code> object that contains the value(s)
01338:             *         stored in the specified column of this
01339:             * 	       <code>CachedRowSetImpl</code>
01340:             *         object
01341:             * @throws SQLException if an error occurs generated the collection; or
01342:             * 		an invalid column is provided.
01343:             * @see #toCollection()
01344:             * @see #toCollection(String)
01345:             * @see java.util.Vector
01346:             */
01347:            public Collection<?> toCollection(int column) throws SQLException {
01348:
01349:                Vector vec;
01350:                Row origRow;
01351:                int nRows = numRows;
01352:                vec = new Vector(nRows);
01353:
01354:                // create a copy
01355:                CachedRowSetImpl crsTemp;
01356:                crsTemp = (CachedRowSetImpl) this .createCopy();
01357:
01358:                while (nRows != 0) {
01359:                    crsTemp.next();
01360:                    vec.add(crsTemp.getObject(column));
01361:                    nRows--;
01362:                }
01363:
01364:                return (Collection) vec;
01365:            }
01366:
01367:            /**
01368:             * Returns the specified column of this <code>CachedRowSetImpl</code> object
01369:             * as a <code>Collection</code> object.  This method makes a copy of the
01370:             * column's data and utilitizes the <code>Vector</code> to establish the
01371:             * collection. The <code>Vector</code> class implements a growable array
01372:             * objects allowing the individual components to be accessed using an
01373:             * an integer index similar to that of an array.
01374:             *
01375:             * @return a <code>Collection</code> object that contains the value(s)
01376:             *         stored in the specified column of this
01377:             * 	       <code>CachedRowSetImpl</code>
01378:             *         object
01379:             * @throws SQLException if an error occurs generated the collection; or
01380:             * 		an invalid column is provided.
01381:             * @see #toCollection()
01382:             * @see #toCollection(int)
01383:             * @see java.util.Vector
01384:             */
01385:            public Collection<?> toCollection(String column)
01386:                    throws SQLException {
01387:                return toCollection(getColIdxByName(column));
01388:            }
01389:
01390:            //--------------------------------------------------------------------
01391:            // Advanced features
01392:            //--------------------------------------------------------------------
01393:
01394:            /**
01395:             * Returns the <code>SyncProvider</code> implementation being used
01396:             * with this <code>CachedRowSetImpl</code> implementation rowset.
01397:             *
01398:             * @return the SyncProvider used by the rowset. If not provider was
01399:             * 		set when the rowset was instantiated, the reference
01400:             *		implementation (default) provider is returned.
01401:             * @throws SQLException if error occurs while return the
01402:             *		<code>SyncProvider</code> instance.
01403:             */
01404:            public SyncProvider getSyncProvider() throws SQLException {
01405:                return provider;
01406:            }
01407:
01408:            /**
01409:             * Sets the active <code>SyncProvider</code> and attempts to load
01410:             * load the new provider using the <code>SyncFactory</code> SPI.
01411:             *
01412:             * @throws SQLException if an error occurs while resetting the
01413:             * 		<code>SyncProvider</code>.
01414:             */
01415:            public void setSyncProvider(String providerStr) throws SQLException {
01416:                provider = (SyncProvider) SyncFactory.getInstance(providerStr);
01417:
01418:                rowSetReader = provider.getRowSetReader();
01419:                rowSetWriter = provider.getRowSetWriter();
01420:            }
01421:
01422:            //-----------------
01423:            // methods inherited from RowSet
01424:            //-----------------
01425:
01426:            //---------------------------------------------------------------------
01427:            // Reading and writing data
01428:            //---------------------------------------------------------------------
01429:
01430:            /**
01431:             * Populates this <code>CachedRowSetImpl</code> object with data.
01432:             * This form of the method uses the rowset's user, password, and url or
01433:             * data source name properties to create a database
01434:             * connection.  If properties that are needed
01435:             * have not been set, this method will throw an exception.
01436:             * <P>
01437:             * Another form of this method uses an existing JDBC <code>Connection</code>
01438:             * object instead of creating a new one; therefore, it ignores the
01439:             * properties used for establishing a new connection.
01440:             * <P>
01441:             * The query specified by the command property is executed to create a
01442:             * <code>ResultSet</code> object from which to retrieve data.
01443:             * The current contents of the rowset are discarded, and the
01444:             * rowset's metadata is also (re)set.  If there are outstanding updates,
01445:             * they are also ignored.
01446:             * <P>
01447:             * The method <code>execute</code> closes any database connections that it
01448:             * creates.
01449:             *
01450:             * @throws SQLException if an error occurs or the
01451:             *                         necessary properties have not been set
01452:             */
01453:            public void execute() throws SQLException {
01454:                execute(null);
01455:            }
01456:
01457:            //-----------------------------------
01458:            // Methods inherited from ResultSet
01459:            //-----------------------------------
01460:
01461:            /**
01462:             * Moves the cursor down one row from its current position and
01463:             * returns <code>true</code> if the new cursor position is a
01464:             * valid row.
01465:             * The cursor for a new <code>ResultSet</code> object is initially
01466:             * positioned before the first row. The first call to the method
01467:             * <code>next</code> moves the cursor to the first row, making it
01468:             * the current row; the second call makes the second row the
01469:             * current row, and so on.
01470:             *
01471:             * <P>If an input stream from the previous row is open, it is
01472:             * implicitly closed. The <code>ResultSet</code> object's warning
01473:             * chain is cleared when a new row is read.
01474:             *
01475:             * @return <code>true</code> if the new current row is valid;
01476:             *         <code>false</code> if there are no more rows
01477:             * @throws SQLException if an error occurs or
01478:             *            the cursor is not positioned in the rowset, before
01479:             *            the first row, or after the last row
01480:             */
01481:            public boolean next() throws SQLException {
01482:                /*
01483:                 * make sure things look sane. The cursor must be
01484:                 * positioned in the rowset or before first (0) or
01485:                 * after last (numRows + 1)
01486:                 */
01487:                if (cursorPos < 0 || cursorPos >= numRows + 1) {
01488:                    throw new SQLException(resBundle.handleGetObject(
01489:                            "cachedrowsetimpl.invalidcp").toString());
01490:                }
01491:                // now move and notify
01492:                boolean ret = this .internalNext();
01493:                notifyCursorMoved();
01494:
01495:                return ret;
01496:            }
01497:
01498:            /**
01499:             * Moves this <code>CachedRowSetImpl</code> object's cursor to the next
01500:             * row and returns <code>true</code> if the cursor is still in the rowset;
01501:             * returns <code>false</code> if the cursor has moved to the position after
01502:             * the last row.
01503:             * <P>
01504:             * This method handles the cases where the cursor moves to a row that
01505:             * has been deleted.
01506:             * If this rowset shows deleted rows and the cursor moves to a row
01507:             * that has been deleted, this method moves the cursor to the next
01508:             * row until the cursor is on a row that has not been deleted.
01509:             * <P>
01510:             * The method <code>internalNext</code> is called by methods such as
01511:             * <code>next</code>, <code>absolute</code>, and <code>relative</code>,
01512:             * and, as its name implies, is only called internally.
01513:             * <p>
01514:             * This is a implementation only method and is not required as a standard
01515:             * implementation of the <code>CachedRowSet</code> interface.
01516:             *
01517:             * @return <code>true</code> if the cursor is on a valid row in this
01518:             *         rowset; <code>false</code> if it is after the last row
01519:             * @throws SQLException if an error occurs
01520:             */
01521:            protected boolean internalNext() throws SQLException {
01522:                boolean ret = false;
01523:
01524:                do {
01525:                    if (cursorPos < numRows) {
01526:                        ++cursorPos;
01527:                        ret = true;
01528:                    } else if (cursorPos == numRows) {
01529:                        // increment to after last
01530:                        ++cursorPos;
01531:                        ret = false;
01532:                        break;
01533:                    }
01534:                } while ((getShowDeleted() == false) && (rowDeleted() == true));
01535:
01536:                /* each call to internalNext may increment cursorPos multiple
01537:                 * times however, the absolutePos only increments once per call.
01538:                 */
01539:                if (ret == true)
01540:                    absolutePos++;
01541:                else
01542:                    absolutePos = 0;
01543:
01544:                return ret;
01545:            }
01546:
01547:            /**
01548:             * Closes this <code>CachedRowSetImpl</code> objecy and releases any resources
01549:             * it was using.
01550:             *
01551:             * @throws SQLException if an error occurs when releasing any resources in use
01552:             * by this <code>CachedRowSetImpl</code> object
01553:             */
01554:            public void close() throws SQLException {
01555:
01556:                // close all data structures holding
01557:                // the disconnected rowset
01558:
01559:                cursorPos = 0;
01560:                absolutePos = 0;
01561:                numRows = 0;
01562:                numDeleted = 0;
01563:
01564:                // set all insert(s), update(s) & delete(s),
01565:                // if at all, to their initial values.
01566:                initProperties();
01567:
01568:                // clear the vector of it's present contents
01569:                rvh.clear();
01570:
01571:                // this will make it eligible for gc
01572:                // rvh = null;
01573:            }
01574:
01575:            /**
01576:             * Reports whether the last column read was SQL <code>NULL</code>.
01577:             * Note that you must first call the method <code>getXXX</code>
01578:             * on a column to try to read its value and then call the method
01579:             * <code>wasNull</code> to determine whether the value was
01580:             * SQL <code>NULL</code>.
01581:             *
01582:             * @return <code>true</code> if the value in the last column read
01583:             *         was SQL <code>NULL</code>; <code>false</code> otherwise
01584:             * @throws SQLException if an error occurs
01585:             */
01586:            public boolean wasNull() throws SQLException {
01587:                return lastValueNull;
01588:            }
01589:
01590:            /**
01591:             * Sets the field <code>lastValueNull</code> to the given
01592:             * <code>boolean</code> value.
01593:             *
01594:             * @param value <code>true</code> to indicate that the value of
01595:             *        the last column read was SQL <code>NULL</code>;
01596:             *        <code>false</code> to indicate that it was not
01597:             */
01598:            private void setLastValueNull(boolean value) {
01599:                lastValueNull = value;
01600:            }
01601:
01602:            // Methods for accessing results by column index
01603:
01604:            /**
01605:             * Checks to see whether the given index is a valid column number
01606:             * in this <code>CachedRowSetImpl</code> object and throws
01607:             * an <code>SQLException</code> if it is not. The index is out of bounds
01608:             * if it is less than <code>1</code> or greater than the number of
01609:             * columns in this rowset.
01610:             * <P>
01611:             * This method is called internally by the <code>getXXX</code> and
01612:             * <code>updateXXX</code> methods.
01613:             *
01614:             * @param idx the number of a column in this <code>CachedRowSetImpl</code>
01615:             *            object; must be between <code>1</code> and the number of
01616:             *            rows in this rowset
01617:             * @throws SQLException if the given index is out of bounds
01618:             */
01619:            private void checkIndex(int idx) throws SQLException {
01620:                if (idx < 1 || idx > RowSetMD.getColumnCount()) {
01621:                    throw new SQLException(resBundle.handleGetObject(
01622:                            "cachedrowsetimpl.invalidcol").toString());
01623:                }
01624:            }
01625:
01626:            /**
01627:             * Checks to see whether the cursor for this <code>CachedRowSetImpl</code>
01628:             * object is on a row in the rowset and throws an
01629:             * <code>SQLException</code> if it is not.
01630:             * <P>
01631:             * This method is called internally by <code>getXXX</code> methods, by
01632:             * <code>updateXXX</code> methods, and by methods that update, insert,
01633:             * or delete a row or that cancel a row update, insert, or delete.
01634:             *
01635:             * @throws SQLException if the cursor for this <code>CachedRowSetImpl</code>
01636:             *         object is not on a valid row
01637:             */
01638:            private void checkCursor() throws SQLException {
01639:                if (isAfterLast() == true || isBeforeFirst() == true) {
01640:                    throw new SQLException(resBundle.handleGetObject(
01641:                            "cachedrowsetimpl.invalidcp").toString());
01642:                }
01643:            }
01644:
01645:            /**
01646:             * Returns the column number of the column with the given name in this
01647:             * <code>CachedRowSetImpl</code> object.  This method throws an
01648:             * <code>SQLException</code> if the given name is not the name of
01649:             * one of the columns in this rowset.
01650:             *
01651:             * @param name a <code>String</code> object that is the name of a column in
01652:             *              this <code>CachedRowSetImpl</code> object
01653:             * @throws SQLException if the given name does not match the name of one of
01654:             *         the columns in this rowset
01655:             */
01656:            private int getColIdxByName(String name) throws SQLException {
01657:                RowSetMD = (RowSetMetaDataImpl) this .getMetaData();
01658:                int cols = RowSetMD.getColumnCount();
01659:
01660:                for (int i = 1; i <= cols; ++i) {
01661:                    String colName = RowSetMD.getColumnName(i);
01662:                    if (colName != null)
01663:                        if (name.equalsIgnoreCase(colName))
01664:                            return (i);
01665:                        else
01666:                            continue;
01667:                }
01668:                throw new SQLException(resBundle.handleGetObject(
01669:                        "cachedrowsetimpl.invalcolnm").toString());
01670:
01671:            }
01672:
01673:            /**
01674:             * Returns the insert row or the current row of this
01675:             * <code>CachedRowSetImpl</code>object.
01676:             *
01677:             * @return the <code>Row</code> object on which this <code>CachedRowSetImpl</code>
01678:             * objects's cursor is positioned
01679:             */
01680:            protected BaseRow getCurrentRow() {
01681:                if (onInsertRow == true) {
01682:                    return (BaseRow) insertRow;
01683:                } else {
01684:                    return (BaseRow) (rvh.get(cursorPos - 1));
01685:                }
01686:            }
01687:
01688:            /**
01689:             * Removes the row on which the cursor is positioned.
01690:             * <p>
01691:             * This is a implementation only method and is not required as a standard
01692:             * implementation of the <code>CachedRowSet</code> interface.
01693:             *
01694:             * @throws SQLException if the cursor is positioned on the insert
01695:             *            row
01696:             */
01697:            protected void removeCurrentRow() {
01698:                ((Row) getCurrentRow()).setDeleted();
01699:                rvh.remove(cursorPos);
01700:                --numRows;
01701:            }
01702:
01703:            /**
01704:             * Retrieves the value of the designated column in the current row
01705:             * of this <code>CachedRowSetImpl</code> object as a
01706:             * <code>String</code> object.
01707:             *
01708:             * @param columnIndex the first column is <code>1</code>, the second
01709:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
01710:             *        and equal to or less than the number of columns in the rowset
01711:             * @return the column value; if the value is SQL <code>NULL</code>, the
01712:             *         result is <code>null</code>
01713:             * @throws SQLException if (1) the given column index is out of bounds,
01714:             * (2) the cursor is not on one of this rowset's rows or its
01715:             * insert row, or (3) the designated column does not store an
01716:             * SQL <code>TINYINT, SMALLINT, INTEGER, BIGINT, REAL,
01717:             * FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, <b>CHAR</b>, <b>VARCHAR</b></code>
01718:             * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
01719:             * recommended return type.
01720:             */
01721:            public String getString(int columnIndex) throws SQLException {
01722:                Object value;
01723:
01724:                // sanity check.
01725:                checkIndex(columnIndex);
01726:                // make sure the cursor is on a valid row
01727:                checkCursor();
01728:
01729:                setLastValueNull(false);
01730:                value = getCurrentRow().getColumnObject(columnIndex);
01731:
01732:                // check for SQL NULL
01733:                if (value == null) {
01734:                    setLastValueNull(true);
01735:                    return null;
01736:                }
01737:
01738:                return value.toString();
01739:            }
01740:
01741:            /**
01742:             * Retrieves the value of the designated column in the current row
01743:             * of this <code>CachedRowSetImpl</code> object as a
01744:             * <code>boolean</code> value.
01745:             *
01746:             * @param columnIndex the first column is <code>1</code>, the second
01747:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
01748:             *        and equal to or less than the number of columns in the rowset
01749:             * @return the column value as a <code>boolean</code> in the Java progamming language;
01750:             *        if the value is SQL <code>NULL</code>, the result is <code>false</code>
01751:             * @throws SQLException if (1) the given column index is out of bounds,
01752:             *            (2) the cursor is not on one of this rowset's rows or its
01753:             *            insert row, or (3) the designated column does not store an
01754:             *            SQL <code>BOOLEAN</code> value
01755:             * @see #getBoolean(String)
01756:             */
01757:            public boolean getBoolean(int columnIndex) throws SQLException {
01758:                Object value;
01759:
01760:                // sanity check.
01761:                checkIndex(columnIndex);
01762:                // make sure the cursor is on a valid row
01763:                checkCursor();
01764:
01765:                setLastValueNull(false);
01766:                value = getCurrentRow().getColumnObject(columnIndex);
01767:
01768:                // check for SQL NULL
01769:                if (value == null) {
01770:                    setLastValueNull(true);
01771:                    return false;
01772:                }
01773:
01774:                // check for Boolean...
01775:                if (value instanceof  Boolean) {
01776:                    return ((Boolean) value).booleanValue();
01777:                }
01778:
01779:                // convert to a Double and compare to zero
01780:                try {
01781:                    Double d = new Double(value.toString());
01782:                    if (d.compareTo(new Double((double) 0)) == 0) {
01783:                        return false;
01784:                    } else {
01785:                        return true;
01786:                    }
01787:                } catch (NumberFormatException ex) {
01788:                    throw new SQLException(MessageFormat.format(resBundle
01789:                            .handleGetObject("cachedrowsetimpl.boolfail")
01790:                            .toString(), new Object[] {
01791:                            value.toString().trim(), columnIndex }));
01792:                }
01793:            }
01794:
01795:            /**
01796:             * Retrieves the value of the designated column in the current row
01797:             * of this <code>CachedRowSetImpl</code> object as a
01798:             * <code>byte</code> value.
01799:             *
01800:             * @param columnIndex the first column is <code>1</code>, the second
01801:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
01802:             *        and equal to or less than the number of columns in the rowset
01803:             * @return the column value as a <code>byte</code> in the Java programming
01804:             * language; if the value is SQL <code>NULL</code>, the result is <code>0</code>
01805:             * @throws SQLException if (1) the given column index is out of bounds,
01806:             *            (2) the cursor is not on one of this rowset's rows or its
01807:             *            insert row, or (3) the designated column does not store an
01808:             *            SQL <code><b>TINYINT</b>, SMALLINT, INTEGER, BIGINT, REAL,
01809:             *            FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
01810:             *            or <code>LONGVARCHAR</code> value. The bold SQL type
01811:             *            designates the recommended return type.
01812:             * @see #getByte(String)
01813:             */
01814:            public byte getByte(int columnIndex) throws SQLException {
01815:                Object value;
01816:
01817:                // sanity check.
01818:                checkIndex(columnIndex);
01819:                // make sure the cursor is on a valid row
01820:                checkCursor();
01821:
01822:                setLastValueNull(false);
01823:                value = getCurrentRow().getColumnObject(columnIndex);
01824:
01825:                // check for SQL NULL
01826:                if (value == null) {
01827:                    setLastValueNull(true);
01828:                    return (byte) 0;
01829:                }
01830:                try {
01831:                    return ((new Byte(value.toString())).byteValue());
01832:                } catch (NumberFormatException ex) {
01833:                    throw new SQLException(MessageFormat.format(resBundle
01834:                            .handleGetObject("cachedrowsetimpl.bytefail")
01835:                            .toString(), new Object[] {
01836:                            value.toString().trim(), columnIndex }));
01837:                }
01838:            }
01839:
01840:            /**
01841:             * Retrieves the value of the designated column in the current row
01842:             * of this <code>CachedRowSetImpl</code> object as a
01843:             * <code>short</code> value.
01844:             *
01845:             * @param columnIndex the first column is <code>1</code>, the second
01846:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
01847:             *        and equal to or less than the number of columns in the rowset
01848:             * @return the column value; if the value is SQL <code>NULL</code>, the
01849:             *         result is <code>0</code>
01850:             * @throws SQLException if (1) the given column index is out of bounds,
01851:             * (2) the cursor is not on one of this rowset's rows or its
01852:             * insert row, or (3) the designated column does not store an
01853:             * SQL <code>TINYINT, <b>SMALLINT</b>, INTEGER, BIGINT, REAL
01854:             * FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
01855:             * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
01856:             * recommended return type.
01857:             * @see #getShort(String)
01858:             */
01859:            public short getShort(int columnIndex) throws SQLException {
01860:                Object value;
01861:
01862:                // sanity check.
01863:                checkIndex(columnIndex);
01864:                // make sure the cursor is on a valid row
01865:                checkCursor();
01866:
01867:                setLastValueNull(false);
01868:                value = getCurrentRow().getColumnObject(columnIndex);
01869:
01870:                // check for SQL NULL
01871:                if (value == null) {
01872:                    setLastValueNull(true);
01873:                    return (short) 0;
01874:                }
01875:
01876:                try {
01877:                    return ((new Short(value.toString().trim())).shortValue());
01878:                } catch (NumberFormatException ex) {
01879:                    throw new SQLException(MessageFormat.format(resBundle
01880:                            .handleGetObject("cachedrowsetimpl.shortfail")
01881:                            .toString(), new Object[] {
01882:                            value.toString().trim(), columnIndex }));
01883:                }
01884:            }
01885:
01886:            /**
01887:             * Retrieves the value of the designated column in the current row
01888:             * of this <code>CachedRowSetImpl</code> object as an
01889:             * <code>int</code> value.
01890:             *
01891:             * @param columnIndex the first column is <code>1</code>, the second
01892:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
01893:             *        and equal to or less than the number of columns in the rowset
01894:             * @return the column value; if the value is SQL <code>NULL</code>, the
01895:             *         result is <code>0</code>
01896:             * @throws SQLException if (1) the given column index is out of bounds,
01897:             * (2) the cursor is not on one of this rowset's rows or its
01898:             * insert row, or (3) the designated column does not store an
01899:             * SQL <code>TINYINT, SMALLINT, <b>INTEGER</b>, BIGINT, REAL
01900:             * FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
01901:             * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
01902:             * recommended return type.
01903:             */
01904:            public int getInt(int columnIndex) throws SQLException {
01905:                Object value;
01906:
01907:                // sanity check.
01908:                checkIndex(columnIndex);
01909:                // make sure the cursor is on a valid row
01910:                checkCursor();
01911:
01912:                setLastValueNull(false);
01913:                value = getCurrentRow().getColumnObject(columnIndex);
01914:
01915:                // check for SQL NULL
01916:                if (value == null) {
01917:                    setLastValueNull(true);
01918:                    return (int) 0;
01919:                }
01920:
01921:                try {
01922:                    return ((new Integer(value.toString().trim())).intValue());
01923:                } catch (NumberFormatException ex) {
01924:                    throw new SQLException(MessageFormat.format(resBundle
01925:                            .handleGetObject("cachedrowsetimpl.intfail")
01926:                            .toString(), new Object[] {
01927:                            value.toString().trim(), columnIndex }));
01928:                }
01929:            }
01930:
01931:            /**
01932:             * Retrieves the value of the designated column in the current row
01933:             * of this <code>CachedRowSetImpl</code> object as a
01934:             * <code>long</code> value.
01935:             *
01936:             * @param columnIndex the first column is <code>1</code>, the second
01937:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
01938:             *        and equal to or less than the number of columns in the rowset
01939:             * @return the column value; if the value is SQL <code>NULL</code>, the
01940:             *         result is <code>0</code>
01941:             * @throws SQLException if (1) the given column index is out of bounds,
01942:             * (2) the cursor is not on one of this rowset's rows or its
01943:             * insert row, or (3) the designated column does not store an
01944:             * SQL <code>TINYINT, SMALLINT, INTEGER, <b>BIGINT</b>, REAL
01945:             * FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
01946:             * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
01947:             * recommended return type.
01948:             * @see #getLong(String)
01949:             */
01950:            public long getLong(int columnIndex) throws SQLException {
01951:                Object value;
01952:
01953:                // sanity check.
01954:                checkIndex(columnIndex);
01955:                // make sure the cursor is on a valid row
01956:                checkCursor();
01957:
01958:                setLastValueNull(false);
01959:                value = getCurrentRow().getColumnObject(columnIndex);
01960:
01961:                // check for SQL NULL
01962:                if (value == null) {
01963:                    setLastValueNull(true);
01964:                    return (long) 0;
01965:                }
01966:                try {
01967:                    return ((new Long(value.toString().trim())).longValue());
01968:                } catch (NumberFormatException ex) {
01969:                    throw new SQLException(MessageFormat.format(resBundle
01970:                            .handleGetObject("cachedrowsetimpl.longfail")
01971:                            .toString(), new Object[] {
01972:                            value.toString().trim(), columnIndex }));
01973:                }
01974:            }
01975:
01976:            /**
01977:             * Retrieves the value of the designated column in the current row
01978:             * of this <code>CachedRowSetImpl</code> object as a
01979:             * <code>float</code> value.
01980:             *
01981:             * @param columnIndex the first column is <code>1</code>, the second
01982:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
01983:             *        and equal to or less than the number of columns in the rowset
01984:             * @return the column value; if the value is SQL <code>NULL</code>, the
01985:             *         result is <code>0</code>
01986:             * @throws SQLException if (1) the given column index is out of bounds,
01987:             * (2) the cursor is not on one of this rowset's rows or its
01988:             * insert row, or (3) the designated column does not store an
01989:             * SQL <code>TINYINT, SMALLINT, INTEGER, BIGINT, <b>REAL</b>,
01990:             * FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
01991:             * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
01992:             * recommended return type.
01993:             * @see #getFloat(String)
01994:             */
01995:            public float getFloat(int columnIndex) throws SQLException {
01996:                Object value;
01997:
01998:                // sanity check.
01999:                checkIndex(columnIndex);
02000:                // make sure the cursor is on a valid row
02001:                checkCursor();
02002:
02003:                setLastValueNull(false);
02004:                value = getCurrentRow().getColumnObject(columnIndex);
02005:
02006:                // check for SQL NULL
02007:                if (value == null) {
02008:                    setLastValueNull(true);
02009:                    return (float) 0;
02010:                }
02011:                try {
02012:                    return ((new Float(value.toString())).floatValue());
02013:                } catch (NumberFormatException ex) {
02014:                    throw new SQLException(MessageFormat.format(resBundle
02015:                            .handleGetObject("cachedrowsetimpl.floatfail")
02016:                            .toString(), new Object[] {
02017:                            value.toString().trim(), columnIndex }));
02018:                }
02019:            }
02020:
02021:            /**
02022:             * Retrieves the value of the designated column in the current row
02023:             * of this <code>CachedRowSetImpl</code> object as a
02024:             * <code>double</code> value.
02025:             *
02026:             * @param columnIndex the first column is <code>1</code>, the second
02027:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
02028:             *        and equal to or less than the number of columns in the rowset
02029:             * @return the column value; if the value is SQL <code>NULL</code>, the
02030:             *         result is <code>0</code>
02031:             * @throws SQLException if (1) the given column index is out of bounds,
02032:             * (2) the cursor is not on one of this rowset's rows or its
02033:             * insert row, or (3) the designated column does not store an
02034:             * SQL <code>TINYINT, SMALLINT, INTEGER, BIGINT, REAL,
02035:             * <b>FLOAT</b>, <b>DOUBLE</b>, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
02036:             * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
02037:             * recommended return type.
02038:             * @see #getDouble(String)
02039:             *
02040:             */
02041:            public double getDouble(int columnIndex) throws SQLException {
02042:                Object value;
02043:
02044:                // sanity check.
02045:                checkIndex(columnIndex);
02046:                // make sure the cursor is on a valid row
02047:                checkCursor();
02048:
02049:                setLastValueNull(false);
02050:                value = getCurrentRow().getColumnObject(columnIndex);
02051:
02052:                // check for SQL NULL
02053:                if (value == null) {
02054:                    setLastValueNull(true);
02055:                    return (double) 0;
02056:                }
02057:                try {
02058:                    return ((new Double(value.toString().trim())).doubleValue());
02059:                } catch (NumberFormatException ex) {
02060:                    throw new SQLException(MessageFormat.format(resBundle
02061:                            .handleGetObject("cachedrowsetimpl.doublefail")
02062:                            .toString(), new Object[] {
02063:                            value.toString().trim(), columnIndex }));
02064:                }
02065:            }
02066:
02067:            /**
02068:             * Retrieves the value of the designated column in the current row
02069:             * of this <code>CachedRowSetImpl</code> object as a
02070:             * <code>java.math.BigDecimal</code> object.
02071:             * <P>
02072:             * This method is deprecated; use the version of <code>getBigDecimal</code>
02073:             * that does not take a scale parameter and returns a value with full
02074:             * precision.
02075:             *
02076:             * @param columnIndex the first column is <code>1</code>, the second
02077:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
02078:             *        and equal to or less than the number of columns in the rowset
02079:             * @param scale the number of digits to the right of the decimal point in the
02080:             *        value returned
02081:             * @return the column value with the specified number of digits to the right
02082:             *         of the decimal point; if the value is SQL <code>NULL</code>, the
02083:             *         result is <code>null</code>
02084:             * @throws SQLException if the given column index is out of bounds,
02085:             *            the cursor is not on a valid row, or this method fails
02086:             * @deprecated
02087:             */
02088:            public BigDecimal getBigDecimal(int columnIndex, int scale)
02089:                    throws SQLException {
02090:                Object value;
02091:                BigDecimal bDecimal, retVal;
02092:
02093:                // sanity check.
02094:                checkIndex(columnIndex);
02095:                // make sure the cursor is on a valid row
02096:                checkCursor();
02097:
02098:                setLastValueNull(false);
02099:                value = getCurrentRow().getColumnObject(columnIndex);
02100:
02101:                // check for SQL NULL
02102:                if (value == null) {
02103:                    setLastValueNull(true);
02104:                    return (new BigDecimal(0));
02105:                }
02106:
02107:                bDecimal = this .getBigDecimal(columnIndex);
02108:
02109:                retVal = bDecimal.setScale(scale);
02110:
02111:                return retVal;
02112:            }
02113:
02114:            /**
02115:             * Retrieves the value of the designated column in the current row
02116:             * of this <code>CachedRowSetImpl</code> object as a
02117:             * <code>byte</code> array value.
02118:             *
02119:             * @param columnIndex the first column is <code>1</code>, the second
02120:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
02121:             *        and equal to or less than the number of columns in the rowset
02122:             * @return the column value as a <code>byte</code> array in the Java programming
02123:             * language; if the value is SQL <code>NULL</code>, the
02124:             * result is <code>null</code>
02125:             *
02126:             * @throws SQLException if (1) the given column index is out of bounds,
02127:             * (2) the cursor is not on one of this rowset's rows or its
02128:             * insert row, or (3) the designated column does not store an
02129:             * SQL <code><b>BINARY</b>, <b>VARBINARY</b> or
02130:             * LONGVARBINARY</code> value.
02131:             * The bold SQL type designates the recommended return type.
02132:             * @see #getBytes(String)
02133:             */
02134:            public byte[] getBytes(int columnIndex) throws SQLException {
02135:                // sanity check.
02136:                checkIndex(columnIndex);
02137:                // make sure the cursor is on a valid row
02138:                checkCursor();
02139:
02140:                if (isBinary(RowSetMD.getColumnType(columnIndex)) == false) {
02141:                    throw new SQLException(resBundle.handleGetObject(
02142:                            "cachedrowsetimpl.dtypemismt").toString());
02143:                }
02144:
02145:                return (byte[]) (getCurrentRow().getColumnObject(columnIndex));
02146:            }
02147:
02148:            /**
02149:             * Retrieves the value of the designated column in the current row
02150:             * of this <code>CachedRowSetImpl</code> object as a
02151:             * <code>java.sql.Date</code> object.
02152:             *
02153:             * @param columnIndex the first column is <code>1</code>, the second
02154:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
02155:             *        and equal to or less than the number of columns in the rowset
02156:             * @return the column value as a <code>java.sql.Data</code> object; if
02157:             *        the value is SQL <code>NULL</code>, the
02158:             *        result is <code>null</code>
02159:             * @throws SQLException if the given column index is out of bounds,
02160:             *            the cursor is not on a valid row, or this method fails
02161:             */
02162:            public java.sql.Date getDate(int columnIndex) throws SQLException {
02163:                Object value;
02164:
02165:                // sanity check.
02166:                checkIndex(columnIndex);
02167:                // make sure the cursor is on a valid row
02168:                checkCursor();
02169:
02170:                setLastValueNull(false);
02171:                value = getCurrentRow().getColumnObject(columnIndex);
02172:
02173:                // check for SQL NULL
02174:                if (value == null) {
02175:                    setLastValueNull(true);
02176:                    return null;
02177:                }
02178:
02179:                /*
02180:                 * The object coming back from the db could be
02181:                 * a date, a timestamp, or a char field variety.
02182:                 * If it's a date type return it, a timestamp
02183:                 * we turn into a long and then into a date,
02184:                 * char strings we try to parse. Yuck.
02185:                 */
02186:                switch (RowSetMD.getColumnType(columnIndex)) {
02187:                case java.sql.Types.DATE: {
02188:                    long sec = ((java.sql.Date) value).getTime();
02189:                    return new java.sql.Date(sec);
02190:                }
02191:                case java.sql.Types.TIMESTAMP: {
02192:                    long sec = ((java.sql.Timestamp) value).getTime();
02193:                    return new java.sql.Date(sec);
02194:                }
02195:                case java.sql.Types.CHAR:
02196:                case java.sql.Types.VARCHAR:
02197:                case java.sql.Types.LONGVARCHAR: {
02198:                    try {
02199:                        DateFormat df = DateFormat.getDateInstance();
02200:                        return ((java.sql.Date) (df.parse(value.toString())));
02201:                    } catch (ParseException ex) {
02202:                        throw new SQLException(MessageFormat.format(resBundle
02203:                                .handleGetObject("cachedrowsetimpl.datefail")
02204:                                .toString(), new Object[] {
02205:                                value.toString().trim(), columnIndex }));
02206:                    }
02207:                }
02208:                default: {
02209:                    throw new SQLException(MessageFormat.format(resBundle
02210:                            .handleGetObject("cachedrowsetimpl.datefail")
02211:                            .toString(), new Object[] {
02212:                            value.toString().trim(), columnIndex }));
02213:                }
02214:                }
02215:            }
02216:
02217:            /**
02218:             * Retrieves the value of the designated column in the current row
02219:             * of this <code>CachedRowSetImpl</code> object as a
02220:             * <code>java.sql.Time</code> object.
02221:             *
02222:             * @param columnIndex the first column is <code>1</code>, the second
02223:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
02224:             *        and equal to or less than the number of columns in the rowset
02225:             * @return the column value; if the value is SQL <code>NULL</code>, the
02226:             *         result is <code>null</code>
02227:             * @throws SQLException if the given column index is out of bounds,
02228:             *         the cursor is not on a valid row, or this method fails
02229:             */
02230:            public java.sql.Time getTime(int columnIndex) throws SQLException {
02231:                Object value;
02232:
02233:                // sanity check.
02234:                checkIndex(columnIndex);
02235:                // make sure the cursor is on a valid row
02236:                checkCursor();
02237:
02238:                setLastValueNull(false);
02239:                value = getCurrentRow().getColumnObject(columnIndex);
02240:
02241:                // check for SQL NULL
02242:                if (value == null) {
02243:                    setLastValueNull(true);
02244:                    return null;
02245:                }
02246:
02247:                /*
02248:                 * The object coming back from the db could be
02249:                 * a date, a timestamp, or a char field variety.
02250:                 * If it's a date type return it, a timestamp
02251:                 * we turn into a long and then into a date,
02252:                 * char strings we try to parse. Yuck.
02253:                 */
02254:                switch (RowSetMD.getColumnType(columnIndex)) {
02255:                case java.sql.Types.TIME: {
02256:                    return (java.sql.Time) value;
02257:                }
02258:                case java.sql.Types.TIMESTAMP: {
02259:                    long sec = ((java.sql.Timestamp) value).getTime();
02260:                    return new java.sql.Time(sec);
02261:                }
02262:                case java.sql.Types.CHAR:
02263:                case java.sql.Types.VARCHAR:
02264:                case java.sql.Types.LONGVARCHAR: {
02265:                    try {
02266:                        DateFormat tf = DateFormat.getTimeInstance();
02267:                        return ((java.sql.Time) (tf.parse(value.toString())));
02268:                    } catch (ParseException ex) {
02269:                        throw new SQLException(MessageFormat.format(resBundle
02270:                                .handleGetObject("cachedrowsetimpl.timefail")
02271:                                .toString(), new Object[] {
02272:                                value.toString().trim(), columnIndex }));
02273:                    }
02274:                }
02275:                default: {
02276:                    throw new SQLException(MessageFormat.format(resBundle
02277:                            .handleGetObject("cachedrowsetimpl.timefail")
02278:                            .toString(), new Object[] {
02279:                            value.toString().trim(), columnIndex }));
02280:                }
02281:                }
02282:            }
02283:
02284:            /**
02285:             * Retrieves the value of the designated column in the current row
02286:             * of this <code>CachedRowSetImpl</code> object as a
02287:             * <code>java.sql.Timestamp</code> object.
02288:             *
02289:             * @param columnIndex the first column is <code>1</code>, the second
02290:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
02291:             *        and equal to or less than the number of columns in the rowset
02292:             * @return the column value; if the value is SQL <code>NULL</code>, the
02293:             *         result is <code>null</code>
02294:             * @throws SQLException if the given column index is out of bounds,
02295:             *            the cursor is not on a valid row, or this method fails
02296:             */
02297:            public java.sql.Timestamp getTimestamp(int columnIndex)
02298:                    throws SQLException {
02299:                Object value;
02300:
02301:                // sanity check.
02302:                checkIndex(columnIndex);
02303:                // make sure the cursor is on a valid row
02304:                checkCursor();
02305:
02306:                setLastValueNull(false);
02307:                value = getCurrentRow().getColumnObject(columnIndex);
02308:
02309:                // check for SQL NULL
02310:                if (value == null) {
02311:                    setLastValueNull(true);
02312:                    return null;
02313:                }
02314:
02315:                /*
02316:                 * The object coming back from the db could be
02317:                 * a date, a timestamp, or a char field variety.
02318:                 * If it's a date type return it; a timestamp
02319:                 * we turn into a long and then into a date;
02320:                 * char strings we try to parse. Yuck.
02321:                 */
02322:                switch (RowSetMD.getColumnType(columnIndex)) {
02323:                case java.sql.Types.TIMESTAMP: {
02324:                    return (java.sql.Timestamp) value;
02325:                }
02326:                case java.sql.Types.TIME: {
02327:                    long sec = ((java.sql.Time) value).getTime();
02328:                    return new java.sql.Timestamp(sec);
02329:                }
02330:                case java.sql.Types.DATE: {
02331:                    long sec = ((java.sql.Date) value).getTime();
02332:                    return new java.sql.Timestamp(sec);
02333:                }
02334:                case java.sql.Types.CHAR:
02335:                case java.sql.Types.VARCHAR:
02336:                case java.sql.Types.LONGVARCHAR: {
02337:                    try {
02338:                        DateFormat tf = DateFormat.getTimeInstance();
02339:                        return ((java.sql.Timestamp) (tf
02340:                                .parse(value.toString())));
02341:                    } catch (ParseException ex) {
02342:                        throw new SQLException(MessageFormat.format(resBundle
02343:                                .handleGetObject("cachedrowsetimpl.timefail")
02344:                                .toString(), new Object[] {
02345:                                value.toString().trim(), columnIndex }));
02346:                    }
02347:                }
02348:                default: {
02349:                    throw new SQLException(MessageFormat.format(resBundle
02350:                            .handleGetObject("cachedrowsetimpl.timefail")
02351:                            .toString(), new Object[] {
02352:                            value.toString().trim(), columnIndex }));
02353:                }
02354:                }
02355:            }
02356:
02357:            /**
02358:             * Retrieves the value of the designated column in the current row of this
02359:             * <code>CachedRowSetImpl</code> object as a <code>java.io.InputStream</code>
02360:             * object.
02361:             *
02362:             * A column value can be retrieved as a stream of ASCII characters
02363:             * and then read in chunks from the stream.  This method is particularly
02364:             * suitable for retrieving large <code>LONGVARCHAR</code> values.  The JDBC
02365:             * driver will do any necessary conversion from the database format into ASCII.
02366:             *
02367:             * <P><B>Note:</B> All the data in the returned stream must be
02368:             * read prior to getting the value of any other column. The next
02369:             * call to a get method implicitly closes the stream. . Also, a
02370:             * stream may return <code>0</code> for <code>CachedRowSetImpl.available()</code>
02371:             * whether there is data available or not.
02372:             *
02373:             * @param columnIndex the first column is <code>1</code>, the second
02374:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
02375:             *        and equal to or less than the number of columns in this rowset
02376:             * @return a Java input stream that delivers the database column value
02377:             *         as a stream of one-byte ASCII characters.  If the value is SQL
02378:             *         <code>NULL</code>, the result is <code>null</code>.
02379:             * @throws SQLException if (1) the given column index is out of bounds,
02380:             * (2) the cursor is not on one of this rowset's rows or its
02381:             * insert row, or (3) the designated column does not store an
02382:             * SQL <code>CHAR, VARCHAR</code>, <code><b>LONGVARCHAR</b></code>
02383:             * <code>BINARY, VARBINARY</code> or <code>LONGVARBINARY</code> value. The
02384:             * bold SQL type designates the recommended return types that this method is
02385:             * used to retrieve.
02386:             * @see #getAsciiStream(String)
02387:             */
02388:            public java.io.InputStream getAsciiStream(int columnIndex)
02389:                    throws SQLException {
02390:                Object value;
02391:
02392:                // always free an old stream
02393:                asciiStream = null;
02394:
02395:                // sanity check
02396:                checkIndex(columnIndex);
02397:                //make sure the cursor is on a vlid row
02398:                checkCursor();
02399:
02400:                value = getCurrentRow().getColumnObject(columnIndex);
02401:                if (value == null) {
02402:                    lastValueNull = true;
02403:                    return null;
02404:                }
02405:
02406:                try {
02407:                    if (isString(RowSetMD.getColumnType(columnIndex))) {
02408:                        asciiStream = new ByteArrayInputStream(((String) value)
02409:                                .getBytes("ASCII"));
02410:                    } else {
02411:                        throw new SQLException(resBundle.handleGetObject(
02412:                                "cachedrowsetimpl.dtypemismt").toString());
02413:                    }
02414:                } catch (java.io.UnsupportedEncodingException ex) {
02415:                    throw new SQLException(ex.getMessage());
02416:                }
02417:
02418:                return (java.io.InputStream) asciiStream;
02419:            }
02420:
02421:            /**
02422:             * A column value can be retrieved as a stream of Unicode characters
02423:             * and then read in chunks from the stream.  This method is particularly
02424:             * suitable for retrieving large LONGVARCHAR values.  The JDBC driver will
02425:             * do any necessary conversion from the database format into Unicode.
02426:             *
02427:             * <P><B>Note:</B> All the data in the returned stream must be
02428:             * read prior to getting the value of any other column. The next
02429:             * call to a get method implicitly closes the stream. . Also, a
02430:             * stream may return 0 for available() whether there is data
02431:             * available or not.
02432:             *
02433:             * @param columnIndex the first column is <code>1</code>, the second
02434:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
02435:             *        and equal to or less than the number of columns in this rowset
02436:             * @return a Java input stream that delivers the database column value
02437:             * as a stream of two byte Unicode characters.  If the value is SQL NULL
02438:             * then the result is null.
02439:             * @throws SQLException if an error occurs
02440:             * @deprecated
02441:             */
02442:            public java.io.InputStream getUnicodeStream(int columnIndex)
02443:                    throws SQLException {
02444:                // always free an old stream
02445:                unicodeStream = null;
02446:
02447:                // sanity check.
02448:                checkIndex(columnIndex);
02449:                // make sure the cursor is on a valid row
02450:                checkCursor();
02451:
02452:                if (isBinary(RowSetMD.getColumnType(columnIndex)) == false
02453:                        && isString(RowSetMD.getColumnType(columnIndex)) == false) {
02454:                    throw new SQLException(resBundle.handleGetObject(
02455:                            "cachedrowsetimpl.dtypemismt").toString());
02456:                }
02457:
02458:                Object value = getCurrentRow().getColumnObject(columnIndex);
02459:                if (value == null) {
02460:                    lastValueNull = true;
02461:                    return null;
02462:                }
02463:
02464:                unicodeStream = new StringBufferInputStream(value.toString());
02465:
02466:                return (java.io.InputStream) unicodeStream;
02467:            }
02468:
02469:            /**
02470:             * Retrieves the value of the designated column in the current row of this
02471:             * <code>CachedRowSetImpl</code> object as a <code>java.io.InputStream</code>
02472:             * object.
02473:             * <P>
02474:             * A column value can be retrieved as a stream of uninterpreted bytes
02475:             * and then read in chunks from the stream.  This method is particularly
02476:             * suitable for retrieving large <code>LONGVARBINARY</code> values.
02477:             *
02478:             * <P><B>Note:</B> All the data in the returned stream must be
02479:             * read prior to getting the value of any other column. The next
02480:             * call to a get method implicitly closes the stream. Also, a
02481:             * stream may return <code>0</code> for
02482:             * <code>CachedRowSetImpl.available()</code> whether there is data
02483:             * available or not.
02484:             *
02485:             * @param columnIndex the first column is <code>1</code>, the second
02486:             * is <code>2</code>, and so on; must be <code>1</code> or larger
02487:             * and equal to or less than the number of columns in the rowset
02488:             * @return a Java input stream that delivers the database column value
02489:             * as a stream of uninterpreted bytes.  If the value is SQL <code>NULL</code>
02490:             * then the result is <code>null</code>.
02491:             * @throws SQLException if (1) the given column index is out of bounds,
02492:             * (2) the cursor is not on one of this rowset's rows or its
02493:             * insert row, or (3) the designated column does not store an
02494:             * SQL <code>BINARY, VARBINARY</code> or <code><b>LONGVARBINARY</b></code>
02495:             * The bold type indicates the SQL type that this method is recommened
02496:             * to retrieve.
02497:             * @see #getBinaryStream(String)
02498:             */
02499:            public java.io.InputStream getBinaryStream(int columnIndex)
02500:                    throws SQLException {
02501:
02502:                // always free an old stream
02503:                binaryStream = null;
02504:
02505:                // sanity check.
02506:                checkIndex(columnIndex);
02507:                // make sure the cursor is on a valid row
02508:                checkCursor();
02509:
02510:                if (isBinary(RowSetMD.getColumnType(columnIndex)) == false) {
02511:                    throw new SQLException(resBundle.handleGetObject(
02512:                            "cachedrowsetimpl.dtypemismt").toString());
02513:                }
02514:
02515:                Object value = getCurrentRow().getColumnObject(columnIndex);
02516:                if (value == null) {
02517:                    lastValueNull = true;
02518:                    return null;
02519:                }
02520:
02521:                binaryStream = new ByteArrayInputStream((byte[]) value);
02522:
02523:                return (java.io.InputStream) binaryStream;
02524:
02525:            }
02526:
02527:            // Methods for accessing results by column name
02528:
02529:            /**
02530:             * Retrieves the value stored in the designated column
02531:             * of the current row as a <code>String</code> object.
02532:             *
02533:             * @param columnName a <code>String</code> object giving the SQL name of
02534:             *        a column in this <code>CachedRowSetImpl</code> object
02535:             * @return the column value; if the value is SQL <code>NULL</code>,
02536:             *         the result is <code>null</code>
02537:             * @throws SQLException if (1) the given column name is not the name of
02538:             * a column in this rowset, (2) the cursor is not on one of
02539:             * this rowset's rows or its insert row, or (3) the designated
02540:             * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
02541:             * BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, <b>CHAR</b>,
02542:             * <b>VARCHAR</b></code> or <code>LONGVARCHAR<</code> value. The bold SQL type
02543:             * designates the recommended return type.
02544:             */
02545:            public String getString(String columnName) throws SQLException {
02546:                return getString(getColIdxByName(columnName));
02547:            }
02548:
02549:            /**
02550:             * Retrieves the value stored in the designated column
02551:             * of the current row as a <code>boolean</code> value.
02552:             *
02553:             * @param columnName a <code>String</code> object giving the SQL name of
02554:             *        a column in this <code>CachedRowSetImpl</code> object
02555:             * @return the column value as a <code>boolean</code> in the Java programming
02556:             *        language; if the value is SQL <code>NULL</code>,
02557:             *        the result is <code>false</code>
02558:             * @throws SQLException if (1) the given column name is not the name of
02559:             *            a column in this rowset, (2) the cursor is not on one of
02560:             *            this rowset's rows or its insert row, or (3) the designated
02561:             *            column does not store an SQL <code>BOOLEAN</code> value
02562:             * @see #getBoolean(int)
02563:             */
02564:            public boolean getBoolean(String columnName) throws SQLException {
02565:                return getBoolean(getColIdxByName(columnName));
02566:            }
02567:
02568:            /**
02569:             * Retrieves the value stored in the designated column
02570:             * of the current row as a <code>byte</code> value.
02571:             *
02572:             * @param columnName a <code>String</code> object giving the SQL name of
02573:             *        a column in this <code>CachedRowSetImpl</code> object
02574:             * @return the column value as a <code>byte</code> in the Java programming
02575:             * language; if the value is SQL <code>NULL</code>, the result is <code>0</code>
02576:             * @throws SQLException if (1) the given column name is not the name of
02577:             * a column in this rowset, (2) the cursor is not on one of
02578:             * this rowset's rows or its insert row, or (3) the designated
02579:             * column does not store an SQL <code><B>TINYINT</B>, SMALLINT, INTEGER,
02580:             * BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR,
02581:             * VARCHAR</code> or <code>LONGVARCHAR</code> value. The
02582:             * bold type designates the recommended return type
02583:             */
02584:            public byte getByte(String columnName) throws SQLException {
02585:                return getByte(getColIdxByName(columnName));
02586:            }
02587:
02588:            /**
02589:             * Retrieves the value stored in the designated column
02590:             * of the current row as a <code>short</code> value.
02591:             *
02592:             * @param columnName a <code>String</code> object giving the SQL name of
02593:             *        a column in this <code>CachedRowSetImpl</code> object
02594:             * @return the column value; if the value is SQL <code>NULL</code>,
02595:             *         the result is <code>0</code>
02596:             * @throws SQLException if (1) the given column name is not the name of
02597:             * a column in this rowset, (2) the cursor is not on one of
02598:             * this rowset's rows or its insert row, or (3) the designated
02599:             * column does not store an SQL <code>TINYINT, <b>SMALLINT</b>, INTEGER
02600:             * BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR,
02601:             * VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type
02602:             * designates the recommended return type.
02603:             * @see #getShort(int)
02604:             */
02605:            public short getShort(String columnName) throws SQLException {
02606:                return getShort(getColIdxByName(columnName));
02607:            }
02608:
02609:            /**
02610:             * Retrieves the value stored in the designated column
02611:             * of the current row as an <code>int</code> value.
02612:             *
02613:             * @param columnName a <code>String</code> object giving the SQL name of
02614:             *        a column in this <code>CachedRowSetImpl</code> object
02615:             * @return the column value; if the value is SQL <code>NULL</code>,
02616:             *         the result is <code>0</code>
02617:             * @throws SQLException if (1) the given column name is not the name
02618:             * of a column in this rowset,
02619:             * (2) the cursor is not on one of this rowset's rows or its
02620:             * insert row, or (3) the designated column does not store an
02621:             * SQL <code>TINYINT, SMALLINT, <b>INTEGER</b>, BIGINT, REAL
02622:             * FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
02623:             * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
02624:             * recommended return type.
02625:             */
02626:            public int getInt(String columnName) throws SQLException {
02627:                return getInt(getColIdxByName(columnName));
02628:            }
02629:
02630:            /**
02631:             * Retrieves the value stored in the designated column
02632:             * of the current row as a <code>long</code> value.
02633:             *
02634:             * @param columnName a <code>String</code> object giving the SQL name of
02635:             *        a column in this <code>CachedRowSetImpl</code> object
02636:             * @return the column value; if the value is SQL <code>NULL</code>,
02637:             *         the result is <code>0</code>
02638:             * @throws SQLException if (1) the given column name is not the name of
02639:             * a column in this rowset, (2) the cursor is not on one of
02640:             * this rowset's rows or its insert row, or (3) the designated
02641:             * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
02642:             * <b>BIGINT</b>, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR,
02643:             * VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type
02644:             * designates the recommended return type.
02645:             * @see #getLong(int)
02646:             */
02647:            public long getLong(String columnName) throws SQLException {
02648:                return getLong(getColIdxByName(columnName));
02649:            }
02650:
02651:            /**
02652:             * Retrieves the value stored in the designated column
02653:             * of the current row as a <code>float</code> value.
02654:             *
02655:             * @param columnName a <code>String</code> object giving the SQL name of
02656:             *        a column in this <code>CachedRowSetImpl</code> object
02657:             * @return the column value; if the value is SQL <code>NULL</code>,
02658:             *         the result is <code>0</code>
02659:             * @throws SQLException if (1) the given column name is not the name of
02660:             * a column in this rowset, (2) the cursor is not on one of
02661:             * this rowset's rows or its insert row, or (3) the designated
02662:             * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
02663:             * BIGINT, <b>REAL</b>, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR,
02664:             * VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type
02665:             * designates the recommended return type.
02666:             * @see #getFloat(String)
02667:             */
02668:            public float getFloat(String columnName) throws SQLException {
02669:                return getFloat(getColIdxByName(columnName));
02670:            }
02671:
02672:            /**
02673:             * Retrieves the value stored in the designated column
02674:             * of the current row of this <code>CachedRowSetImpl</code> object
02675:             * as a <code>double</code> value.
02676:             *
02677:             * @param columnName a <code>String</code> object giving the SQL name of
02678:             *        a column in this <code>CachedRowSetImpl</code> object
02679:             * @return the column value; if the value is SQL <code>NULL</code>,
02680:             *         the result is <code>0</code>
02681:             * @throws SQLException if (1) the given column name is not the name of
02682:             * a column in this rowset, (2) the cursor is not on one of
02683:             * this rowset's rows or its insert row, or (3) the designated
02684:             * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
02685:             * BIGINT, REAL, <b>FLOAT</b>, <b>DOUBLE</b>, DECIMAL, NUMERIC, BIT, CHAR,
02686:             * VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type
02687:             * designates the recommended return types.
02688:             * @see #getDouble(int)
02689:             */
02690:            public double getDouble(String columnName) throws SQLException {
02691:                return getDouble(getColIdxByName(columnName));
02692:            }
02693:
02694:            /**
02695:             * Retrieves the value stored in the designated column
02696:             * of the current row as a <code>java.math.BigDecimal</code> object.
02697:             *
02698:             * @param columnName a <code>String</code> object giving the SQL name of
02699:             *        a column in this <code>CachedRowSetImpl</code> object
02700:             * @param scale the number of digits to the right of the decimal point
02701:             * @return a java.math.BugDecimal object with <code><i>scale</i></code>
02702:             * number of digits to the right of the decimal point.
02703:             * @throws SQLException if (1) the given column name is not the name of
02704:             * a column in this rowset, (2) the cursor is not on one of
02705:             * this rowset's rows or its insert row, or (3) the designated
02706:             * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
02707:             * BIGINT, REAL, FLOAT, DOUBLE, <b>DECIMAL</b>, <b>NUMERIC</b>, BIT CHAR,
02708:             * VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type
02709:             * designates the recommended return type that this method is used to
02710:             * retrieve.
02711:             * @deprecated Use the <code>getBigDecimal(String columnName)</code>
02712:             *             method instead
02713:             */
02714:            public BigDecimal getBigDecimal(String columnName, int scale)
02715:                    throws SQLException {
02716:                return getBigDecimal(getColIdxByName(columnName), scale);
02717:            }
02718:
02719:            /**
02720:             * Retrieves the value stored in the designated column
02721:             * of the current row as a <code>byte</code> array.
02722:             * The bytes represent the raw values returned by the driver.
02723:             *
02724:             * @param columnName a <code>String</code> object giving the SQL name of
02725:             *        a column in this <code>CachedRowSetImpl</code> object
02726:             * @return the column value as a <code>byte</code> array in the Java programming
02727:             * language; if the value is SQL <code>NULL</code>, the result is <code>null</code>
02728:             * @throws SQLException if (1) the given column name is not the name of
02729:             * a column in this rowset, (2) the cursor is not on one of
02730:             * this rowset's rows or its insert row, or (3) the designated
02731:             * column does not store an SQL <code><b>BINARY</b>, <b>VARBINARY</b>
02732:             * </code> or <code>LONGVARBINARY</code> values
02733:             * The bold SQL type designates the recommended return type.
02734:             * @see #getBytes(int)
02735:             */
02736:            public byte[] getBytes(String columnName) throws SQLException {
02737:                return getBytes(getColIdxByName(columnName));
02738:            }
02739:
02740:            /**
02741:             * Retrieves the value stored in the designated column
02742:             * of the current row as a <code>java.sql.Date</code> object.
02743:             *
02744:             * @param columnName a <code>String</code> object giving the SQL name of
02745:             *        a column in this <code>CachedRowSetImpl</code> object
02746:             * @return the column value; if the value is SQL <code>NULL</code>,
02747:             *         the result is <code>null</code>
02748:             * @throws SQLException if (1) the given column name is not the name of
02749:             *            a column in this rowset, (2) the cursor is not on one of
02750:             *            this rowset's rows or its insert row, or (3) the designated
02751:             *            column does not store an SQL <code>DATE</code> or
02752:             *            <code>TIMESTAMP</code> value
02753:             */
02754:            public java.sql.Date getDate(String columnName) throws SQLException {
02755:                return getDate(getColIdxByName(columnName));
02756:            }
02757:
02758:            /**
02759:             * Retrieves the value stored in the designated column
02760:             * of the current row as a <code>java.sql.Time</code> object.
02761:             *
02762:             * @param columnName a <code>String</code> object giving the SQL name of
02763:             *        a column in this <code>CachedRowSetImpl</code> object
02764:             * @return the column value; if the value is SQL <code>NULL</code>,
02765:             *         the result is <code>null</code>
02766:             * @throws SQLException if the given column name does not match one of
02767:             *            this rowset's column names or the cursor is not on one of
02768:             *            this rowset's rows or its insert row
02769:             */
02770:            public java.sql.Time getTime(String columnName) throws SQLException {
02771:                return getTime(getColIdxByName(columnName));
02772:            }
02773:
02774:            /**
02775:             * Retrieves the value stored in the designated column
02776:             * of the current row as a <code>java.sql.Timestamp</code> object.
02777:             *
02778:             * @param columnName a <code>String</code> object giving the SQL name of
02779:             *        a column in this <code>CachedRowSetImpl</code> object
02780:             * @return the column value; if the value is SQL <code>NULL</code>,
02781:             *         the result is <code>null</code>
02782:             * @throws SQLException if the given column name does not match one of
02783:             *            this rowset's column names or the cursor is not on one of
02784:             *            this rowset's rows or its insert row
02785:             */
02786:            public java.sql.Timestamp getTimestamp(String columnName)
02787:                    throws SQLException {
02788:                return getTimestamp(getColIdxByName(columnName));
02789:            }
02790:
02791:            /**
02792:             * Retrieves the value of the designated column in the current row of this
02793:             * <code>CachedRowSetImpl</code> object as a <code>java.io.InputStream</code>
02794:             * object.
02795:             *
02796:             * A column value can be retrieved as a stream of ASCII characters
02797:             * and then read in chunks from the stream. This method is particularly
02798:             * suitable for retrieving large <code>LONGVARCHAR</code> values. The
02799:             * <code>SyncProvider</code> will rely on the JDBC driver to do any necessary
02800:             * conversion from the database format into ASCII format.
02801:             *
02802:             * <P><B>Note:</B> All the data in the returned stream must
02803:             * be read prior to getting the value of any other column. The
02804:             * next call to a <code>getXXX</code> method implicitly closes the stream.
02805:             *
02806:             * @param columnName a <code>String</code> object giving the SQL name of
02807:             *        a column in this <code>CachedRowSetImpl</code> object
02808:             * @return a Java input stream that delivers the database column value
02809:             *         as a stream of one-byte ASCII characters.  If the value is SQL
02810:             *         <code>NULL</code>, the result is <code>null</code>.
02811:             * @throws SQLException if (1) the given column name is not the name of
02812:             * a column in this rowset
02813:             * (2) the cursor is not on one of this rowset's rows or its
02814:             * insert row, or (3) the designated column does not store an
02815:             * SQL <code>CHAR, VARCHAR</code>, <code><b>LONGVARCHAR</b></code>
02816:             * <code>BINARY, VARBINARY</code> or <code>LONGVARBINARY</code> value. The
02817:             * bold SQL type designates the recommended return types that this method is
02818:             * used to retrieve.
02819:             * @see #getAsciiStream(int)
02820:             */
02821:            public java.io.InputStream getAsciiStream(String columnName)
02822:                    throws SQLException {
02823:                return getAsciiStream(getColIdxByName(columnName));
02824:
02825:            }
02826:
02827:            /**
02828:             * A column value can be retrieved as a stream of Unicode characters
02829:             * and then read in chunks from the stream.  This method is particularly
02830:             * suitable for retrieving large <code>LONGVARCHAR</code> values.
02831:             * The JDBC driver will do any necessary conversion from the database
02832:             * format into Unicode.
02833:             *
02834:             * <P><B>Note:</B> All the data in the returned stream must
02835:             * be read prior to getting the value of any other column. The
02836:             * next call to a <code>getXXX</code> method implicitly closes the stream.
02837:             *
02838:             * @param columnName a <code>String</code> object giving the SQL name of
02839:             *        a column in this <code>CachedRowSetImpl</code> object
02840:             * @return a Java input stream that delivers the database column value
02841:             *         as a stream of two-byte Unicode characters.  If the value is
02842:             *         SQL <code>NULL</code>, the result is <code>null</code>.
02843:             * @throws SQLException if the given column name does not match one of
02844:             *            this rowset's column names or the cursor is not on one of
02845:             *            this rowset's rows or its insert row
02846:             * @deprecated use the method <code>getCharacterStream</code> instead
02847:             */
02848:            public java.io.InputStream getUnicodeStream(String columnName)
02849:                    throws SQLException {
02850:                return getUnicodeStream(getColIdxByName(columnName));
02851:            }
02852:
02853:            /**
02854:             * Retrieves the value of the designated column in the current row of this
02855:             * <code>CachedRowSetImpl</code> object as a <code>java.io.InputStream</code>
02856:             * object.
02857:             * <P>
02858:             * A column value can be retrieved as a stream of uninterpreted bytes
02859:             * and then read in chunks from the stream.  This method is particularly
02860:             * suitable for retrieving large <code>LONGVARBINARY</code> values.
02861:             *
02862:             * <P><B>Note:</B> All the data in the returned stream must be
02863:             * read prior to getting the value of any other column. The next
02864:             * call to a get method implicitly closes the stream. Also, a
02865:             * stream may return <code>0</code> for <code>CachedRowSetImpl.available()</code>
02866:             * whether there is data available or not.
02867:             *
02868:             * @param columnName a <code>String</code> object giving the SQL name of
02869:             *        a column in this <code>CachedRowSetImpl</code> object
02870:             * @return a Java input stream that delivers the database column value
02871:             *         as a stream of uninterpreted bytes.  If the value is SQL
02872:             *         <code>NULL</code>, the result is <code>null</code>.
02873:             * @throws SQLException if (1) the given column name is unknown,
02874:             * (2) the cursor is not on one of this rowset's rows or its
02875:             * insert row, or (3) the designated column does not store an
02876:             * SQL <code>BINARY, VARBINARY</code> or <code><b>LONGVARBINARY</b></code>
02877:             * The bold type indicates the SQL type that this method is recommened
02878:             * to retrieve.
02879:             * @see #getBinaryStream(int)
02880:             *
02881:             */
02882:            public java.io.InputStream getBinaryStream(String columnName)
02883:                    throws SQLException {
02884:                return getBinaryStream(getColIdxByName(columnName));
02885:            }
02886:
02887:            // Advanced features:
02888:
02889:            /**
02890:             * The first warning reported by calls on this <code>CachedRowSetImpl</code>
02891:             * object is returned. Subsequent <code>CachedRowSetImpl</code> warnings will
02892:             * be chained to this <code>SQLWarning</code>.
02893:             *
02894:             * <P>The warning chain is automatically cleared each time a new
02895:             * row is read.
02896:             *
02897:             * <P><B>Note:</B> This warning chain only covers warnings caused
02898:             * by <code>ResultSet</code> methods.  Any warning caused by statement
02899:             * methods (such as reading OUT parameters) will be chained on the
02900:             * <code>Statement</code> object.
02901:             *
02902:             * @return the first SQLWarning or null
02903:             */
02904:            public SQLWarning getWarnings() {
02905:                return sqlwarn;
02906:            }
02907:
02908:            /**
02909:             * Clears all the warnings reporeted for the <code>CachedRowSetImpl</code>
02910:             * object. After a call to this method, the <code>getWarnings</code> method
02911:             * returns <code>null</code> until a new warning is reported for this
02912:             * <code>CachedRowSetImpl</code> object.
02913:             */
02914:            public void clearWarnings() {
02915:                sqlwarn = null;
02916:            }
02917:
02918:            /**
02919:             * Retrieves the name of the SQL cursor used by this
02920:             * <code>CachedRowSetImpl</code> object.
02921:             *
02922:             * <P>In SQL, a result table is retrieved through a cursor that is
02923:             * named. The current row of a <code>ResultSet</code> can be updated or deleted
02924:             * using a positioned update/delete statement that references the
02925:             * cursor name. To ensure that the cursor has the proper isolation
02926:             * level to support an update operation, the cursor's <code>SELECT</code>
02927:             * statement should be of the form <code>select for update</code>.
02928:             * If the <code>for update</code> clause
02929:             * is omitted, positioned updates may fail.
02930:             *
02931:             * <P>JDBC supports this SQL feature by providing the name of the
02932:             * SQL cursor used by a <code>ResultSet</code> object. The current row
02933:             * of a result set is also the current row of this SQL cursor.
02934:             *
02935:             * <P><B>Note:</B> If positioned updates are not supported, an
02936:             * <code>SQLException</code> is thrown.
02937:             *
02938:             * @return the SQL cursor name for this <code>CachedRowSetImpl</code> object's
02939:             *         cursor
02940:             * @throws SQLException if an error occurs
02941:             */
02942:            public String getCursorName() throws SQLException {
02943:                throw new SQLException(resBundle.handleGetObject(
02944:                        "cachedrowsetimpl.posupdate").toString());
02945:            }
02946:
02947:            /**
02948:             * Retrieves a <code>ResultSetMetaData</code> object instance that
02949:             * contains information about the <code>CachedRowSet</code> object.
02950:             * However, applications should cast the returned object to a
02951:             * <code>RowSetMetaData</code> interface implementation. In the
02952:             * reference implementation, this cast can be done on the
02953:             * <code>RowSetMetaDataImpl</code> class.
02954:             * <P>
02955:             * For example:
02956:             * <pre>
02957:             * CachedRowSet crs = new CachedRowSetImpl();
02958:             * RowSetMetaDataImpl metaData =
02959:             *     (RowSetMetaDataImpl)crs.getMetaData();
02960:             * // Set the number of columns in the RowSet object for
02961:             * // which this RowSetMetaDataImpl object was created to the
02962:             * // given number.
02963:             * metaData.setColumnCount(3);
02964:             * crs.setMetaData(metaData);
02965:             * </pre>
02966:             *
02967:             * @return the <code>ResultSetMetaData</code> object that describes this
02968:             *         <code>CachedRowSetImpl</code> object's columns
02969:             * @throws SQLException if an error occurs in generating the RowSet
02970:             * meta data; or if the <code>CachedRowSetImpl</code> is empty.
02971:             * @see javax.sql.RowSetMetaData
02972:             */
02973:            public ResultSetMetaData getMetaData() throws SQLException {
02974:                return (ResultSetMetaData) RowSetMD;
02975:            }
02976:
02977:            /**
02978:             * Retrieves the value of the designated column in the current row
02979:             * of this <code>CachedRowSetImpl</code> object as an
02980:             * <code>Object</code> value.
02981:             * <P>
02982:             * The type of the <code>Object</code> will be the default
02983:             * Java object type corresponding to the column's SQL type,
02984:             * following the mapping for built-in types specified in the JDBC 3.0
02985:             * specification.
02986:             * <P>
02987:             * This method may also be used to read datatabase-specific
02988:             * abstract data types.
02989:             * <P>
02990:             * This implementation of the method <code>getObject</code> extends its
02991:             * behavior so that it gets the attributes of an SQL structured type
02992:             * as an array of <code>Object</code> values.  This method also custom
02993:             * maps SQL user-defined types to classes in the Java programming language.
02994:             * When the specified column contains
02995:             * a structured or distinct value, the behavior of this method is as
02996:             * if it were a call to the method <code>getObject(columnIndex,
02997:             * this.getStatement().getConnection().getTypeMap())</code>.
02998:             *
02999:             * @param columnIndex the first column is <code>1</code>, the second
03000:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
03001:             *        and equal to or less than the number of columns in the rowset
03002:             * @return a <code>java.lang.Object</code> holding the column value;
03003:             *         if the value is SQL <code>NULL</code>, the result is <code>null</code>
03004:             * @throws SQLException if the given column index is out of bounds,
03005:             *            the cursor is not on a valid row, or there is a problem getting
03006:             *            the <code>Class</code> object for a custom mapping
03007:             * @see #getObject(String)
03008:             */
03009:            public Object getObject(int columnIndex) throws SQLException {
03010:                Object value;
03011:                java.util.Map map;
03012:
03013:                // sanity check.
03014:                checkIndex(columnIndex);
03015:                // make sure the cursor is on a valid row
03016:                checkCursor();
03017:
03018:                setLastValueNull(false);
03019:                value = getCurrentRow().getColumnObject(columnIndex);
03020:
03021:                // check for SQL NULL
03022:                if (value == null) {
03023:                    setLastValueNull(true);
03024:                    return null;
03025:                }
03026:                if (value instanceof  Struct) {
03027:                    Struct s = (Struct) value;
03028:                    map = getTypeMap();
03029:                    // look up the class in the map
03030:                    Class c = (Class) map.get(s.getSQLTypeName());
03031:                    if (c != null) {
03032:                        // create new instance of the class
03033:                        SQLData obj = null;
03034:                        try {
03035:                            obj = (SQLData) c.newInstance();
03036:                        } catch (java.lang.InstantiationException ex) {
03037:                            throw new SQLException(MessageFormat.format(
03038:                                    resBundle.handleGetObject(
03039:                                            "cachedrowsetimpl.unableins")
03040:                                            .toString(), ex.getMessage()));
03041:                        } catch (java.lang.IllegalAccessException ex) {
03042:                            throw new SQLException(MessageFormat.format(
03043:                                    resBundle.handleGetObject(
03044:                                            "cachedrowsetimpl.unableins")
03045:                                            .toString(), ex.getMessage()));
03046:                        }
03047:                        // get the attributes from the struct
03048:                        Object attribs[] = s.getAttributes(map);
03049:                        // create the SQLInput "stream"
03050:                        SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
03051:                        // read the values...
03052:                        obj.readSQL(sqlInput, s.getSQLTypeName());
03053:                        return (Object) obj;
03054:                    }
03055:                }
03056:                return value;
03057:            }
03058:
03059:            /**
03060:             * Retrieves the value of the designated column in the current row
03061:             * of this <code>CachedRowSetImpl</code> object as an
03062:             * <code>Object</code> value.
03063:             * <P>
03064:             * The type of the <code>Object</code> will be the default
03065:             * Java object type corresponding to the column's SQL type,
03066:             * following the mapping for built-in types specified in the JDBC 3.0
03067:             * specification.
03068:             * <P>
03069:             * This method may also be used to read datatabase-specific
03070:             * abstract data types.
03071:             * <P>
03072:             * This implementation of the method <code>getObject</code> extends its
03073:             * behavior so that it gets the attributes of an SQL structured type
03074:             * as an array of <code>Object</code> values.  This method also custom
03075:             * maps SQL user-defined types to classes
03076:             * in the Java programming language. When the specified column contains
03077:             * a structured or distinct value, the behavior of this method is as
03078:             * if it were a call to the method <code>getObject(columnIndex,
03079:             * this.getStatement().getConnection().getTypeMap())</code>.
03080:             *
03081:             * @param columnName a <code>String</code> object that must match the
03082:             *        SQL name of a column in this rowset, ignoring case
03083:             * @return a <code>java.lang.Object</code> holding the column value;
03084:             *         if the value is SQL <code>NULL</code>, the result is <code>null</code>
03085:             * @throws SQLException if (1) the given column name does not match one of
03086:             *            this rowset's column names, (2) the cursor is not
03087:             *            on a valid row, or (3) there is a problem getting
03088:             *            the <code>Class</code> object for a custom mapping
03089:             * @see #getObject(int)
03090:             */
03091:            public Object getObject(String columnName) throws SQLException {
03092:                return getObject(getColIdxByName(columnName));
03093:            }
03094:
03095:            //----------------------------------------------------------------
03096:
03097:            /**
03098:             * Maps the given column name for one of this <code>CachedRowSetImpl</code>
03099:             * object's columns to its column number.
03100:             *
03101:             * @param columnName a <code>String</code> object that must match the
03102:             *        SQL name of a column in this rowset, ignoring case
03103:             * @return the column index of the given column name
03104:             * @throws SQLException if the given column name does not match one
03105:             *            of this rowset's column names
03106:             */
03107:            public int findColumn(String columnName) throws SQLException {
03108:                return getColIdxByName(columnName);
03109:            }
03110:
03111:            //--------------------------JDBC 2.0-----------------------------------
03112:
03113:            //---------------------------------------------------------------------
03114:            // Getter's and Setter's
03115:            //---------------------------------------------------------------------
03116:
03117:            /**
03118:             * Retrieves the value stored in the designated column
03119:             * of the current row as a <code>java.io.Reader</code> object.
03120:             *
03121:             * <P><B>Note:</B> All the data in the returned stream must
03122:             * be read prior to getting the value of any other column. The
03123:             * next call to a <code>getXXX</code> method implicitly closes the stream.
03124:             *
03125:             * @param columnIndex the first column is <code>1</code>, the second
03126:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
03127:             *        and equal to or less than the number of columns in the rowset
03128:             * @return a Java character stream that delivers the database column value
03129:             * as a stream of two-byte unicode characters in a
03130:             * <code>java.io.Reader</code> object.  If the value is
03131:             * SQL <code>NULL</code>, the result is <code>null</code>.
03132:             * @throws SQLException if (1) the given column index is out of bounds,
03133:             * (2) the cursor is not on one of this rowset's rows or its
03134:             * insert row, or (3) the designated column does not store an
03135:             * SQL <code>CHAR, VARCHAR, <b>LONGVARCHAR</b>, BINARY, VARBINARY</code> or
03136:             * <code>LONGVARBINARY</code> value.
03137:             * The bold SQL type designates the recommended return type.
03138:             * @see #getCharacterStream(String)
03139:             */
03140:            public java.io.Reader getCharacterStream(int columnIndex)
03141:                    throws SQLException {
03142:
03143:                // sanity check.
03144:                checkIndex(columnIndex);
03145:                // make sure the cursor is on a valid row
03146:                checkCursor();
03147:
03148:                if (isBinary(RowSetMD.getColumnType(columnIndex))) {
03149:                    Object value = getCurrentRow().getColumnObject(columnIndex);
03150:                    if (value == null) {
03151:                        lastValueNull = true;
03152:                        return null;
03153:                    }
03154:                    charStream = new InputStreamReader(
03155:                            new ByteArrayInputStream((byte[]) value));
03156:                } else if (isString(RowSetMD.getColumnType(columnIndex))) {
03157:                    Object value = getCurrentRow().getColumnObject(columnIndex);
03158:                    if (value == null) {
03159:                        lastValueNull = true;
03160:                        return null;
03161:                    }
03162:                    charStream = new StringReader(value.toString());
03163:                } else {
03164:                    throw new SQLException(resBundle.handleGetObject(
03165:                            "cachedrowsetimpl.dtypemismt").toString());
03166:                }
03167:
03168:                return (java.io.Reader) charStream;
03169:            }
03170:
03171:            /**
03172:             * Retrieves the value stored in the designated column
03173:             * of the current row as a <code>java.io.Reader</code> object.
03174:             *
03175:             * <P><B>Note:</B> All the data in the returned stream must
03176:             * be read prior to getting the value of any other column. The
03177:             * next call to a <code>getXXX</code> method implicitly closes the stream.
03178:             *
03179:             * @param columnName a <code>String</code> object giving the SQL name of
03180:             *        a column in this <code>CachedRowSetImpl</code> object
03181:             * @return a Java input stream that delivers the database column value
03182:             *         as a stream of two-byte Unicode characters.  If the value is
03183:             *         SQL <code>NULL</code>, the result is <code>null</code>.
03184:             * @throws SQLException if (1) the given column name is not the name of
03185:             * a column in this rowset, (2) the cursor is not on one of
03186:             * this rowset's rows or its insert row, or (3) the designated
03187:             * column does not store an SQL <code>CHAR, VARCHAR, <b>LONGVARCHAR</b>,
03188:             * BINARY, VARYBINARY</code> or <code>LONGVARBINARY</code> value.
03189:             * The bold SQL type designates the recommended return type.
03190:             */
03191:            public java.io.Reader getCharacterStream(String columnName)
03192:                    throws SQLException {
03193:                return getCharacterStream(getColIdxByName(columnName));
03194:            }
03195:
03196:            /**
03197:             * Retrieves the value of the designated column in the current row
03198:             * of this <code>CachedRowSetImpl</code> object as a
03199:             * <code>java.math.BigDecimal</code> object.
03200:             *
03201:             * @param columnIndex the first column is <code>1</code>, the second
03202:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
03203:             *        and equal to or less than the number of columns in the rowset
03204:             * @return a <code>java.math.BigDecimal</code> value with full precision;
03205:             *         if the value is SQL <code>NULL</code>, the result is <code>null</code>
03206:             * @throws SQLException if (1) the given column index is out of bounds,
03207:             * (2) the cursor is not on one of this rowset's rows or its
03208:             * insert row, or (3) the designated column does not store an
03209:             * SQL <code>TINYINT, SMALLINT, INTEGER, BIGINT, REAL,
03210:             * FLOAT, DOUBLE, <b>DECIMAL</b>, <b>NUMERIC</b>, BIT, CHAR, VARCHAR</code>
03211:             * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
03212:             * recommended return types that this method is used to retrieve.
03213:             * @see #getBigDecimal(String)
03214:             */
03215:            public BigDecimal getBigDecimal(int columnIndex)
03216:                    throws SQLException {
03217:                Object value;
03218:
03219:                // sanity check.
03220:                checkIndex(columnIndex);
03221:                // make sure the cursor is on a valid row
03222:                checkCursor();
03223:
03224:                setLastValueNull(false);
03225:                value = getCurrentRow().getColumnObject(columnIndex);
03226:
03227:                // check for SQL NULL
03228:                if (value == null) {
03229:                    setLastValueNull(true);
03230:                    return null;
03231:                }
03232:                try {
03233:                    return (new BigDecimal(value.toString().trim()));
03234:                } catch (NumberFormatException ex) {
03235:                    throw new SQLException(MessageFormat.format(resBundle
03236:                            .handleGetObject("cachedrowsetimpl.doublefail")
03237:                            .toString(), new Object[] {
03238:                            value.toString().trim(), columnIndex }));
03239:                }
03240:            }
03241:
03242:            /**
03243:             * Retrieves the value of the designated column in the current row
03244:             * of this <code>CachedRowSetImpl</code> object as a
03245:             * <code>java.math.BigDecimal</code> object.
03246:             *
03247:             * @param columnName a <code>String</code> object that must match the
03248:             *        SQL name of a column in this rowset, ignoring case
03249:             * @return a <code>java.math.BigDecimal</code> value with full precision;
03250:             *         if the value is SQL <code>NULL</code>, the result is <code>null</code>
03251:             * @throws SQLException if (1) the given column name is not the name of
03252:             * a column in this rowset, (2) the cursor is not on one of
03253:             * this rowset's rows or its insert row, or (3) the designated
03254:             * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
03255:             * BIGINT, REAL, FLOAT, DOUBLE, <b>DECIMAL</b>, <b>NUMERIC</b>, BIT CHAR,
03256:             * VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type
03257:             * designates the recommended return type that this method is used to
03258:             * retrieve
03259:             * @see #getBigDecimal(int)
03260:             */
03261:            public BigDecimal getBigDecimal(String columnName)
03262:                    throws SQLException {
03263:                return getBigDecimal(getColIdxByName(columnName));
03264:            }
03265:
03266:            //---------------------------------------------------------------------
03267:            // Traversal/Positioning
03268:            //---------------------------------------------------------------------
03269:
03270:            /**
03271:             * Returns the number of rows in this <code>CachedRowSetImpl</code> object.
03272:             *
03273:             * @return number of rows in the rowset
03274:             */
03275:            public int size() {
03276:                return numRows;
03277:            }
03278:
03279:            /**
03280:             * Indicates whether the cursor is before the first row in this
03281:             * <code>CachedRowSetImpl</code> object.
03282:             *
03283:             * @return <code>true</code> if the cursor is before the first row;
03284:             *         <code>false</code> otherwise or if the rowset contains no rows
03285:             * @throws SQLException if an error occurs
03286:             */
03287:            public boolean isBeforeFirst() throws SQLException {
03288:                if (cursorPos == 0 && numRows > 0) {
03289:                    return true;
03290:                } else {
03291:                    return false;
03292:                }
03293:            }
03294:
03295:            /**
03296:             * Indicates whether the cursor is after the last row in this
03297:             * <code>CachedRowSetImpl</code> object.
03298:             *
03299:             * @return <code>true</code> if the cursor is after the last row;
03300:             *         <code>false</code> otherwise or if the rowset contains no rows
03301:             * @throws SQLException if an error occurs
03302:             */
03303:            public boolean isAfterLast() throws SQLException {
03304:                if (cursorPos == numRows + 1 && numRows > 0) {
03305:                    return true;
03306:                } else {
03307:                    return false;
03308:                }
03309:            }
03310:
03311:            /**
03312:             * Indicates whether the cursor is on the first row in this
03313:             * <code>CachedRowSetImpl</code> object.
03314:             *
03315:             * @return <code>true</code> if the cursor is on the first row;
03316:             *         <code>false</code> otherwise or if the rowset contains no rows
03317:             * @throws SQLException if an error occurs
03318:             */
03319:            public boolean isFirst() throws SQLException {
03320:                // this becomes nasty because of deletes.
03321:                int saveCursorPos = cursorPos;
03322:                int saveAbsoluteCursorPos = absolutePos;
03323:                internalFirst();
03324:                if (cursorPos == saveCursorPos) {
03325:                    return true;
03326:                } else {
03327:                    cursorPos = saveCursorPos;
03328:                    absolutePos = saveAbsoluteCursorPos;
03329:                    return false;
03330:                }
03331:            }
03332:
03333:            /**
03334:             * Indicates whether the cursor is on the last row in this
03335:             * <code>CachedRowSetImpl</code> object.
03336:             * <P>
03337:             * Note: Calling the method <code>isLast</code> may be expensive
03338:             * because the JDBC driver might need to fetch ahead one row in order
03339:             * to determine whether the current row is the last row in this rowset.
03340:             *
03341:             * @return <code>true</code> if the cursor is on the last row;
03342:             *         <code>false</code> otherwise or if this rowset contains no rows
03343:             * @throws SQLException if an error occurs
03344:             */
03345:            public boolean isLast() throws SQLException {
03346:                int saveCursorPos = cursorPos;
03347:                int saveAbsoluteCursorPos = absolutePos;
03348:                boolean saveShowDeleted = getShowDeleted();
03349:                setShowDeleted(true);
03350:                internalLast();
03351:                if (cursorPos == saveCursorPos) {
03352:                    setShowDeleted(saveShowDeleted);
03353:                    return true;
03354:                } else {
03355:                    setShowDeleted(saveShowDeleted);
03356:                    cursorPos = saveCursorPos;
03357:                    absolutePos = saveAbsoluteCursorPos;
03358:                    return false;
03359:                }
03360:            }
03361:
03362:            /**
03363:             * Moves this <code>CachedRowSetImpl</code> object's cursor to the front of
03364:             * the rowset, just before the first row. This method has no effect if
03365:             * this rowset contains no rows.
03366:             *
03367:             * @throws SQLException if an error occurs or the type of this rowset
03368:             *            is <code>ResultSet.TYPE_FORWARD_ONLY</code>
03369:             */
03370:            public void beforeFirst() throws SQLException {
03371:                if (getType() == ResultSet.TYPE_FORWARD_ONLY) {
03372:                    throw new SQLException(resBundle.handleGetObject(
03373:                            "cachedrowsetimpl.beforefirst").toString());
03374:                }
03375:                cursorPos = 0;
03376:                absolutePos = 0;
03377:                notifyCursorMoved();
03378:            }
03379:
03380:            /**
03381:             * Moves this <code>CachedRowSetImpl</code> object's cursor to the end of
03382:             * the rowset, just after the last row. This method has no effect if
03383:             * this rowset contains no rows.
03384:             *
03385:             * @throws SQLException if an error occurs
03386:             */
03387:            public void afterLast() throws SQLException {
03388:                if (numRows > 0) {
03389:                    cursorPos = numRows + 1;
03390:                    absolutePos = 0;
03391:                    notifyCursorMoved();
03392:                }
03393:            }
03394:
03395:            /**
03396:             * Moves this <code>CachedRowSetImpl</code> object's cursor to the first row
03397:             * and returns <code>true</code> if the operation was successful.  This
03398:             * method also notifies registered listeners that the cursor has moved.
03399:             *
03400:             * @return <code>true</code> if the cursor is on a valid row;
03401:             *         <code>false</code> otherwise or if there are no rows in this
03402:             *         <code>CachedRowSetImpl</code> object
03403:             * @throws SQLException if the type of this rowset
03404:             *            is <code>ResultSet.TYPE_FORWARD_ONLY</code>
03405:             */
03406:            public boolean first() throws SQLException {
03407:                if (getType() == ResultSet.TYPE_FORWARD_ONLY) {
03408:                    throw new SQLException(resBundle.handleGetObject(
03409:                            "cachedrowsetimpl.first").toString());
03410:                }
03411:
03412:                // move and notify
03413:                boolean ret = this .internalFirst();
03414:                notifyCursorMoved();
03415:
03416:                return ret;
03417:            }
03418:
03419:            /**
03420:             * Moves this <code>CachedRowSetImpl</code> object's cursor to the first
03421:             * row and returns <code>true</code> if the operation is successful.
03422:             * <P>
03423:             * This method is called internally by the methods <code>first</code>,
03424:             * <code>isFirst</code>, and <code>absolute</code>.
03425:             * It in turn calls the method <code>internalNext</code> in order to
03426:             * handle the case where the first row is a deleted row that is not visible.
03427:             * <p>
03428:             * This is a implementation only method and is not required as a standard
03429:             * implementation of the <code>CachedRowSet</code> interface.
03430:             *
03431:             * @return <code>true</code> if the cursor moved to the first row;
03432:             *         <code>false</code> otherwise
03433:             * @throws SQLException if an error occurs
03434:             */
03435:            protected boolean internalFirst() throws SQLException {
03436:                boolean ret = false;
03437:
03438:                if (numRows > 0) {
03439:                    cursorPos = 1;
03440:                    if ((getShowDeleted() == false) && (rowDeleted() == true)) {
03441:                        ret = internalNext();
03442:                    } else {
03443:                        ret = true;
03444:                    }
03445:                }
03446:
03447:                if (ret == true)
03448:                    absolutePos = 1;
03449:                else
03450:                    absolutePos = 0;
03451:
03452:                return ret;
03453:            }
03454:
03455:            /**
03456:             * Moves this <code>CachedRowSetImpl</code> object's cursor to the last row
03457:             * and returns <code>true</code> if the operation was successful.  This
03458:             * method also notifies registered listeners that the cursor has moved.
03459:             *
03460:             * @return <code>true</code> if the cursor is on a valid row;
03461:             *         <code>false</code> otherwise or if there are no rows in this
03462:             *         <code>CachedRowSetImpl</code> object
03463:             * @throws SQLException if the type of this rowset
03464:             *            is <code>ResultSet.TYPE_FORWARD_ONLY</code>
03465:             */
03466:            public boolean last() throws SQLException {
03467:                if (getType() == ResultSet.TYPE_FORWARD_ONLY) {
03468:                    throw new SQLException(resBundle.handleGetObject(
03469:                            "cachedrowsetimpl.last").toString());
03470:                }
03471:
03472:                // move and notify
03473:                boolean ret = this .internalLast();
03474:                notifyCursorMoved();
03475:
03476:                return ret;
03477:            }
03478:
03479:            /**
03480:             * Moves this <code>CachedRowSetImpl</code> object's cursor to the last
03481:             * row and returns <code>true</code> if the operation is successful.
03482:             * <P>
03483:             * This method is called internally by the method <code>last</code>
03484:             * when rows have been deleted and the deletions are not visible.
03485:             * The method <code>internalLast</code> handles the case where the
03486:             * last row is a deleted row that is not visible by in turn calling
03487:             * the method <code>internalPrevious</code>.
03488:             * <p>
03489:             * This is a implementation only method and is not required as a standard
03490:             * implementation of the <code>CachedRowSet</code> interface.
03491:             *
03492:             * @return <code>true</code> if the cursor moved to the last row;
03493:             *         <code>false</code> otherwise
03494:             * @throws SQLException if an error occurs
03495:             */
03496:            protected boolean internalLast() throws SQLException {
03497:                boolean ret = false;
03498:
03499:                if (numRows > 0) {
03500:                    cursorPos = numRows;
03501:                    if ((getShowDeleted() == false) && (rowDeleted() == true)) {
03502:                        ret = internalPrevious();
03503:                    } else {
03504:                        ret = true;
03505:                    }
03506:                }
03507:                if (ret == true)
03508:                    absolutePos = numRows - numDeleted;
03509:                else
03510:                    absolutePos = 0;
03511:                return ret;
03512:            }
03513:
03514:            /**
03515:             * Returns the number of the current row in this <code>CachedRowSetImpl</code>
03516:             * object. The first row is number 1, the second number 2, and so on.
03517:             *
03518:             * @return the number of the current row;  <code>0</code> if there is no
03519:             *         current row
03520:             * @throws SQLException if an error occurs; or if the <code>CacheRowSetImpl</code>
03521:             *         is empty
03522:             */
03523:            public int getRow() throws SQLException {
03524:                // are we on a valid row? Valid rows are between first and last
03525:                if (numRows > 0 && cursorPos > 0 && cursorPos < (numRows + 1)
03526:                        && (getShowDeleted() == false && rowDeleted() == false)) {
03527:                    return absolutePos;
03528:                } else if (getShowDeleted() == true) {
03529:                    return cursorPos;
03530:                } else {
03531:                    return 0;
03532:                }
03533:            }
03534:
03535:            /**
03536:             * Moves this <code>CachedRowSetImpl</code> object's cursor to the row number
03537:             * specified.
03538:             *
03539:             * <p>If the number is positive, the cursor moves to an absolute row with
03540:             * respect to the beginning of the rowset.  The first row is row 1, the second
03541:             * is row 2, and so on.  For example, the following command, in which
03542:             * <code>crs</code> is a <code>CachedRowSetImpl</code> object, moves the cursor
03543:             * to the fourth row, starting from the beginning of the rowset.
03544:             * <PRE><code>
03545:             *
03546:             *    crs.absolute(4);
03547:             *
03548:             * </code> </PRE>
03549:             * <P>
03550:             * If the number is negative, the cursor moves to an absolute row position
03551:             * with respect to the end of the rowset.  For example, calling
03552:             * <code>absolute(-1)</code> positions the cursor on the last row,
03553:             * <code>absolute(-2)</code> moves it on the next-to-last row, and so on.
03554:             * If the <code>CachedRowSetImpl</code> object <code>crs</code> has five rows,
03555:             * the following command moves the cursor to the fourth-to-last row, which
03556:             * in the case of a  rowset with five rows, is also the second row, counting
03557:             * from the beginning.
03558:             * <PRE><code>
03559:             *
03560:             *    crs.absolute(-4);
03561:             *
03562:             * </code> </PRE>
03563:             *
03564:             * If the number specified is larger than the number of rows, the cursor
03565:             * will move to the position after the last row. If the number specified
03566:             * would move the cursor one or more rows before the first row, the cursor
03567:             * moves to the position before the first row.
03568:             * <P>
03569:             * Note: Calling <code>absolute(1)</code> is the same as calling the
03570:             * method <code>first()</code>.  Calling <code>absolute(-1)</code> is the
03571:             * same as calling <code>last()</code>.
03572:             *
03573:             * @param row a positive number to indicate the row, starting row numbering from
03574:             *        the first row, which is <code>1</code>; a negative number to indicate
03575:             *        the row, starting row numbering from the last row, which is
03576:             *        <code>-1</code>; it must not be <code>0</code>
03577:             * @return <code>true</code> if the cursor is on the rowset; <code>false</code>
03578:             *         otherwise
03579:             * @throws SQLException if the given cursor position is <code>0</code> or the
03580:             *            type of this rowset is <code>ResultSet.TYPE_FORWARD_ONLY</code>
03581:             */
03582:            public boolean absolute(int row) throws SQLException {
03583:                if (row == 0 || getType() == ResultSet.TYPE_FORWARD_ONLY) {
03584:                    throw new SQLException(resBundle.handleGetObject(
03585:                            "cachedrowsetimpl.absolute").toString());
03586:                }
03587:
03588:                if (row > 0) { // we are moving foward
03589:                    if (row > numRows) {
03590:                        // fell off the end
03591:                        afterLast();
03592:                        return false;
03593:                    } else {
03594:                        if (absolutePos <= 0)
03595:                            internalFirst();
03596:                    }
03597:                } else { // we are moving backward
03598:                    if (cursorPos + row < 0) {
03599:                        // fell off the front
03600:                        beforeFirst();
03601:                        return false;
03602:                    } else {
03603:                        if (absolutePos >= 0)
03604:                            internalLast();
03605:                    }
03606:                }
03607:
03608:                // Now move towards the absolute row that we're looking for
03609:                while (absolutePos != row) {
03610:                    if (absolutePos < row) {
03611:                        if (!internalNext())
03612:                            break;
03613:                    } else {
03614:                        if (!internalPrevious())
03615:                            break;
03616:                    }
03617:                }
03618:
03619:                notifyCursorMoved();
03620:
03621:                if (isAfterLast() || isBeforeFirst()) {
03622:                    return false;
03623:                } else {
03624:                    return true;
03625:                }
03626:            }
03627:
03628:            /**
03629:             * Moves the cursor the specified number of rows from the current
03630:             * position, with a positive number moving it forward and a
03631:             * negative number moving it backward.
03632:             * <P>
03633:             * If the number is positive, the cursor moves the specified number of
03634:             * rows toward the end of the rowset, starting at the current row.
03635:             * For example, the following command, in which
03636:             * <code>crs</code> is a <code>CachedRowSetImpl</code> object with 100 rows,
03637:             * moves the cursor forward four rows from the current row.  If the
03638:             * current row is 50, the cursor would move to row 54.
03639:             * <PRE><code>
03640:             *
03641:             *    crs.relative(4);
03642:             *
03643:             * </code> </PRE>
03644:             * <P>
03645:             * If the number is negative, the cursor moves back toward the beginning
03646:             * the specified number of rows, starting at the current row.
03647:             * For example, calling the method
03648:             * <code>absolute(-1)</code> positions the cursor on the last row,
03649:             * <code>absolute(-2)</code> moves it on the next-to-last row, and so on.
03650:             * If the <code>CachedRowSetImpl</code> object <code>crs</code> has five rows,
03651:             * the following command moves the cursor to the fourth-to-last row, which
03652:             * in the case of a  rowset with five rows, is also the second row
03653:             * from the beginning.
03654:             * <PRE><code>
03655:             *
03656:             *    crs.absolute(-4);
03657:             *
03658:             * </code> </PRE>
03659:             *
03660:             * If the number specified is larger than the number of rows, the cursor
03661:             * will move to the position after the last row. If the number specified
03662:             * would move the cursor one or more rows before the first row, the cursor
03663:             * moves to the position before the first row. In both cases, this method
03664:             * throws an <code>SQLException</code>.
03665:             * <P>
03666:             * Note: Calling <code>absolute(1)</code> is the same as calling the
03667:             * method <code>first()</code>.  Calling <code>absolute(-1)</code> is the
03668:             * same as calling <code>last()</code>.  Calling <code>relative(0)</code>
03669:             * is valid, but it does not change the cursor position.
03670:             *
03671:             * @param rows an <code>int</code> indicating the number of rows to move
03672:             *             the cursor, starting at the current row; a positive number
03673:             *             moves the cursor forward; a negative number moves the cursor
03674:             *             backward; must not move the cursor past the valid
03675:             *             rows
03676:             * @return <code>true</code> if the cursor is on a row in this
03677:             *         <code>CachedRowSetImpl</code> object; <code>false</code>
03678:             *         otherwise
03679:             * @throws SQLException if there are no rows in this rowset, the cursor is
03680:             *         positioned either before the first row or after the last row, or
03681:             *         the rowset is type <code>ResultSet.TYPE_FORWARD_ONLY</code>
03682:             */
03683:            public boolean relative(int rows) throws SQLException {
03684:                if (numRows == 0 || isBeforeFirst() || isAfterLast()
03685:                        || getType() == ResultSet.TYPE_FORWARD_ONLY) {
03686:                    throw new SQLException(resBundle.handleGetObject(
03687:                            "cachedrowsetimpl.relative").toString());
03688:                }
03689:
03690:                if (rows == 0) {
03691:                    return true;
03692:                }
03693:
03694:                if (rows > 0) { // we are moving forward
03695:                    if (cursorPos + rows > numRows) {
03696:                        // fell off the end
03697:                        afterLast();
03698:                    } else {
03699:                        for (int i = 0; i < rows; i++) {
03700:                            if (!internalNext())
03701:                                break;
03702:                        }
03703:                    }
03704:                } else { // we are moving backward
03705:                    if (cursorPos + rows < 0) {
03706:                        // fell off the front
03707:                        beforeFirst();
03708:                    } else {
03709:                        for (int i = rows; i < 0; i++) {
03710:                            if (!internalPrevious())
03711:                                break;
03712:                        }
03713:                    }
03714:                }
03715:                notifyCursorMoved();
03716:
03717:                if (isAfterLast() || isBeforeFirst()) {
03718:                    return false;
03719:                } else {
03720:                    return true;
03721:                }
03722:            }
03723:
03724:            /**
03725:             * Moves this <code>CachedRowSetImpl</code> object's cursor to the
03726:             * previous row and returns <code>true</code> if the cursor is on
03727:             * a valid row or <code>false</code> if it is not.
03728:             * This method also notifies all listeners registered with this
03729:             * <code>CachedRowSetImpl</code> object that its cursor has moved.
03730:             * <P>
03731:             * Note: calling the method <code>previous()</code> is not the same
03732:             * as calling the method <code>relative(-1)</code>.  This is true
03733:             * because it is possible to call <code>previous()</code> from the insert
03734:             * row, from after the last row, or from the current row, whereas
03735:             * <code>relative</code> may only be called from the current row.
03736:             * <P>
03737:             * The method <code>previous</code> may used in a <code>while</code>
03738:             * loop to iterate through a rowset starting after the last row
03739:             * and moving toward the beginning. The loop ends when <code>previous</code>
03740:             * returns <code>false</code>, meaning that there are no more rows.
03741:             * For example, the following code fragment retrieves all the data in
03742:             * the <code>CachedRowSetImpl</code> object <code>crs</code>, which has
03743:             * three columns.  Note that the cursor must initially be positioned
03744:             * after the last row so that the first call to the method
03745:             * <code>previous</code> places the cursor on the last line.
03746:             * <PRE> <code>
03747:             *
03748:             *     crs.afterLast();
03749:             *     while (previous()) {
03750:             *         String name = crs.getString(1);
03751:             *         int age = crs.getInt(2);
03752:             *         short ssn = crs.getShort(3);
03753:             *         System.out.println(name + "   " + age + "   " + ssn);
03754:             *     }
03755:             *
03756:             * </code> </PRE>
03757:             * This method throws an <code>SQLException</code> if the cursor is not
03758:             * on a row in the rowset, before the first row, or after the last row.
03759:             *
03760:             * @return <code>true</code> if the cursor is on a valid row;
03761:             *         <code>false</code> if it is before the first row or after the
03762:             *         last row
03763:             * @throws SQLException if the cursor is not on a valid position or the
03764:             *           type of this rowset is <code>ResultSet.TYPE_FORWARD_ONLY</code>
03765:             */
03766:            public boolean previous() throws SQLException {
03767:                if (getType() == ResultSet.TYPE_FORWARD_ONLY) {
03768:                    throw new SQLException(resBundle.handleGetObject(
03769:                            "cachedrowsetimpl.last").toString());
03770:                }
03771:                /*
03772:                 * make sure things look sane. The cursor must be
03773:                 * positioned in the rowset or before first (0) or
03774:                 * after last (numRows + 1)
03775:                 */
03776:                if (cursorPos < 0 || cursorPos > numRows + 1) {
03777:                    throw new SQLException(resBundle.handleGetObject(
03778:                            "cachedrowsetimpl.invalidcp").toString());
03779:                }
03780:                // move and notify
03781:                boolean ret = this .internalPrevious();
03782:                notifyCursorMoved();
03783:
03784:                return ret;
03785:            }
03786:
03787:            /**
03788:             * Moves the cursor to the previous row in this <code>CachedRowSetImpl</code>
03789:             * object, skipping past deleted rows that are not visible; returns
03790:             * <code>true</code> if the cursor is on a row in this rowset and
03791:             * <code>false</code> when the cursor goes before the first row.
03792:             * <P>
03793:             * This method is called internally by the method <code>previous</code>.
03794:             * <P>
03795:             * This is a implementation only method and is not required as a standard
03796:             * implementation of the <code>CachedRowSet</code> interface.
03797:             *
03798:             * @return <code>true</code> if the cursor is on a row in this rowset;
03799:             *         <code>false</code> when the cursor reaches the position before
03800:             *         the first row
03801:             * @throws SQLException if an error occurs
03802:             */
03803:            protected boolean internalPrevious() throws SQLException {
03804:                boolean ret = false;
03805:
03806:                do {
03807:                    if (cursorPos > 1) {
03808:                        --cursorPos;
03809:                        ret = true;
03810:                    } else if (cursorPos == 1) {
03811:                        // decrement to before first
03812:                        --cursorPos;
03813:                        ret = false;
03814:                        break;
03815:                    }
03816:                } while ((getShowDeleted() == false) && (rowDeleted() == true));
03817:
03818:                /*
03819:                 * Each call to internalPrevious may move the cursor
03820:                 * over multiple rows, the absolute postion moves one one row
03821:                 */
03822:                if (ret == true)
03823:                    --absolutePos;
03824:                else
03825:                    absolutePos = 0;
03826:
03827:                return ret;
03828:            }
03829:
03830:            //---------------------------------------------------------------------
03831:            // Updates
03832:            //---------------------------------------------------------------------
03833:
03834:            /**
03835:             * Indicates whether the current row of this <code>CachedRowSetImpl</code>
03836:             * object has been updated.  The value returned
03837:             * depends on whether this rowset can detect updates: <code>false</code>
03838:             * will always be returned if it does not detect updates.
03839:             *
03840:             * @return <code>true</code> if the row has been visibly updated
03841:             *         by the owner or another and updates are detected;
03842:             *         <code>false</code> otherwise
03843:             * @throws SQLException if the cursor is on the insert row or not
03844:             *            not on a valid row
03845:             *
03846:             * @see DatabaseMetaData#updatesAreDetected
03847:             */
03848:            public boolean rowUpdated() throws SQLException {
03849:                // make sure the cursor is on a valid row
03850:                checkCursor();
03851:                if (onInsertRow == true) {
03852:                    throw new SQLException(resBundle.handleGetObject(
03853:                            "cachedrowsetimpl.invalidop").toString());
03854:                }
03855:                return (((Row) getCurrentRow()).getUpdated());
03856:            }
03857:
03858:            /**
03859:             * Indicates whether the designated column of the current row of
03860:             * this <code>CachedRowSetImpl</code> object has been updated. The
03861:             * value returned depends on whether this rowset can detcted updates:
03862:             * <code>false</code> will always be returned if it does not detect updates.
03863:             *
03864:             * @param idx the index identifier of the column that may be have been updated.
03865:             * @return <code>true</code> is the designated column has been updated
03866:             * and the rowset detects updates; <code>false</code> if the rowset has not
03867:             * been updated or the rowset does not detect updates
03868:             * @throws SQLException if the cursor is on the insert row or not
03869:             *		on a valid row
03870:             * @see DatabaseMetaData#updatesAreDetected
03871:             */
03872:            public boolean columnUpdated(int idx) throws SQLException {
03873:                // make sure the cursor is on a valid row
03874:                checkCursor();
03875:                if (onInsertRow == true) {
03876:                    throw new SQLException(resBundle.handleGetObject(
03877:                            "cachedrowsetimpl.invalidop").toString());
03878:                }
03879:                return (((Row) getCurrentRow()).getColUpdated(idx - 1));
03880:            }
03881:
03882:            /**
03883:             * Indicates whether the designated column of the current row of
03884:             * this <code>CachedRowSetImpl</code> object has been updated. The
03885:             * value returned depends on whether this rowset can detcted updates:
03886:             * <code>false</code> will always be returned if it does not detect updates.
03887:             *
03888:             * @param columnName the <code>String</code> column name column that may be have
03889:             * been updated.
03890:             * @return <code>true</code> is the designated column has been updated
03891:             * and the rowset detects updates; <code>false</code> if the rowset has not
03892:             * been updated or the rowset does not detect updates
03893:             * @throws SQLException if the cursor is on the insert row or not
03894:             *		on a valid row
03895:             * @see DatabaseMetaData#updatesAreDetected
03896:             */
03897:            public boolean columnUpdated(String columnName) throws SQLException {
03898:                return columnUpdated(getColIdxByName(columnName));
03899:            }
03900:
03901:            /**
03902:             * Indicates whether the current row has been inserted.  The value returned
03903:             * depends on whether or not the rowset can detect visible inserts.
03904:             *
03905:             * @return <code>true</code> if a row has been inserted and inserts are detected;
03906:             *         <code>false</code> otherwise
03907:             * @throws SQLException if the cursor is on the insert row or not
03908:             *            not on a valid row
03909:             *
03910:             * @see DatabaseMetaData#insertsAreDetected
03911:             */
03912:            public boolean rowInserted() throws SQLException {
03913:                // make sure the cursor is on a valid row
03914:                checkCursor();
03915:                if (onInsertRow == true) {
03916:                    throw new SQLException(resBundle.handleGetObject(
03917:                            "cachedrowsetimpl.invalidop").toString());
03918:                }
03919:                return (((Row) getCurrentRow()).getInserted());
03920:            }
03921:
03922:            /**
03923:             * Indicates whether the current row has been deleted.  A deleted row
03924:             * may leave a visible "hole" in a rowset.  This method can be used to
03925:             * detect such holes if the rowset can detect deletions. This method
03926:             * will always return <code>false</code> if this rowset cannot detect
03927:             * deletions.
03928:             *
03929:             * @return <code>true</code> if (1)the current row is blank, indicating that
03930:             *         the row has been deleted, and (2)deletions are detected;
03931:             *         <code>false</code> otherwise
03932:             * @throws SQLException if the cursor is on a valid row in this rowset
03933:             * @see DatabaseMetaData#deletesAreDetected
03934:             */
03935:            public boolean rowDeleted() throws SQLException {
03936:                // make sure the cursor is on a valid row
03937:
03938:                if (isAfterLast() == true || isBeforeFirst() == true
03939:                        || onInsertRow == true) {
03940:
03941:                    throw new SQLException(resBundle.handleGetObject(
03942:                            "cachedrowsetimpl.invalidcp").toString());
03943:                }
03944:                return (((Row) getCurrentRow()).getDeleted());
03945:            }
03946:
03947:            /**
03948:             * Indicates whether the given SQL data type is a numberic type.
03949:             *
03950:             * @param type one of the constants from <code>java.sql.Types</code>
03951:             * @return <code>true</code> if the given type is <code>NUMERIC</code>,'
03952:             *         <code>DECIMAL</code>, <code>BIT</code>, <code>TINYINT</code>,
03953:             *         <code>SMALLINT</code>, <code>INTEGER</code>, <code>BIGINT</code>,
03954:             *         <code>REAL</code>, <code>DOUBLE</code>, or <code>FLOAT</code>;
03955:             *         <code>false</code> otherwise
03956:             */
03957:            private boolean isNumeric(int type) {
03958:                switch (type) {
03959:                case java.sql.Types.NUMERIC:
03960:                case java.sql.Types.DECIMAL:
03961:                case java.sql.Types.BIT:
03962:                case java.sql.Types.TINYINT:
03963:                case java.sql.Types.SMALLINT:
03964:                case java.sql.Types.INTEGER:
03965:                case java.sql.Types.BIGINT:
03966:                case java.sql.Types.REAL:
03967:                case java.sql.Types.DOUBLE:
03968:                case java.sql.Types.FLOAT:
03969:                    return true;
03970:                default:
03971:                    return false;
03972:                }
03973:            }
03974:
03975:            /**
03976:             * Indicates whether the given SQL data type is a string type.
03977:             *
03978:             * @param type one of the constants from <code>java.sql.Types</code>
03979:             * @return <code>true</code> if the given type is <code>CHAR</code>,'
03980:             *         <code>VARCHAR</code>, or <code>LONGVARCHAR</code>;
03981:             *         <code>false</code> otherwise
03982:             */
03983:            private boolean isString(int type) {
03984:                switch (type) {
03985:                case java.sql.Types.CHAR:
03986:                case java.sql.Types.VARCHAR:
03987:                case java.sql.Types.LONGVARCHAR:
03988:                    return true;
03989:                default:
03990:                    return false;
03991:                }
03992:            }
03993:
03994:            /**
03995:             * Indicates whether the given SQL data type is a binary type.
03996:             *
03997:             * @param type one of the constants from <code>java.sql.Types</code>
03998:             * @return <code>true</code> if the given type is <code>BINARY</code>,'
03999:             *         <code>VARBINARY</code>, or <code>LONGVARBINARY</code>;
04000:             *         <code>false</code> otherwise
04001:             */
04002:            private boolean isBinary(int type) {
04003:                switch (type) {
04004:                case java.sql.Types.BINARY:
04005:                case java.sql.Types.VARBINARY:
04006:                case java.sql.Types.LONGVARBINARY:
04007:                    return true;
04008:                default:
04009:                    return false;
04010:                }
04011:            }
04012:
04013:            /**
04014:             * Indicates whether the given SQL data type is a temporal type.
04015:             * This method is called internally by the conversion methods
04016:             * <code>convertNumeric</code> and <code>convertTemporal</code>.
04017:             *
04018:             * @param type one of the constants from <code>java.sql.Types</code>
04019:             * @return <code>true</code> if the given type is <code>DATE</code>,
04020:             *         <code>TIME</code>, or <code>TIMESTAMP</code>;
04021:             *         <code>false</code> otherwise
04022:             */
04023:            private boolean isTemporal(int type) {
04024:                switch (type) {
04025:                case java.sql.Types.DATE:
04026:                case java.sql.Types.TIME:
04027:                case java.sql.Types.TIMESTAMP:
04028:                    return true;
04029:                default:
04030:                    return false;
04031:                }
04032:            }
04033:
04034:            /**
04035:             * Indicates whether the given SQL data type is a boolean type.
04036:             * This method is called internally by the conversion methods
04037:             * <code>convertNumeric</code> and <code>convertBoolean</code>.
04038:             *
04039:             * @param type one of the constants from <code>java.sql.Types</code>
04040:             * @return <code>true</code> if the given type is <code>BIT</code>,
04041:             *         , or <code>BOOLEAN</code>;
04042:             *         <code>false</code> otherwise
04043:             */
04044:            private boolean isBoolean(int type) {
04045:                switch (type) {
04046:                case java.sql.Types.BIT:
04047:                case java.sql.Types.BOOLEAN:
04048:                    return true;
04049:                default:
04050:                    return false;
04051:                }
04052:            }
04053:
04054:            /**
04055:             * Converts the given <code>Object</code> in the Java programming language
04056:             * to the standard mapping for the specified SQL target data type.
04057:             * The conversion must be to a string or numeric type, but there are no
04058:             * restrictions on the type to be converted.  If the source type and target
04059:             * type are the same, the given object is simply returned.
04060:             *
04061:             * @param srcObj the <code>Object</code> in the Java programming language
04062:             *               that is to be converted to the target type
04063:             * @param srcType the data type that is the standard mapping in SQL of the
04064:             *                object to be converted; must be one of the constants in
04065:             *                <code>java.sql.Types</code>
04066:             * @param trgType the SQL data type to which to convert the given object;
04067:             *                must be one of the following constants in
04068:             *                <code>java.sql.Types</code>: <code>NUMERIC</code>,
04069:             *         <code>DECIMAL</code>, <code>BIT</code>, <code>TINYINT</code>,
04070:             *         <code>SMALLINT</code>, <code>INTEGER</code>, <code>BIGINT</code>,
04071:             *         <code>REAL</code>, <code>DOUBLE</code>, <code>FLOAT</code>,
04072:             *         <code>VARCHAR</code>, <code>LONGVARCHAR</code>, or <code>CHAR</code>
04073:             * @return an <code>Object</code> value.that is
04074:             *         the standard object mapping for the target SQL type
04075:             * @throws SQLException if the given target type is not one of the string or
04076:             *         numeric types in <code>java.sql.Types</code>
04077:             */
04078:            private Object convertNumeric(Object srcObj, int srcType,
04079:                    int trgType) throws SQLException {
04080:
04081:                if (srcType == trgType) {
04082:                    return srcObj;
04083:                }
04084:
04085:                if (isNumeric(trgType) == false && isString(trgType) == false) {
04086:                    throw new SQLException(resBundle.handleGetObject(
04087:                            "cachedrowsetimpl.dtypemismt").toString()
04088:                            + trgType);
04089:                }
04090:
04091:                try {
04092:                    switch (trgType) {
04093:                    case java.sql.Types.BIT:
04094:                        Integer i = new Integer(srcObj.toString().trim());
04095:                        return i.equals(new Integer((int) 0)) ? new Boolean(
04096:                                false) : new Boolean(true);
04097:                    case java.sql.Types.TINYINT:
04098:                        return new Byte(srcObj.toString().trim());
04099:                    case java.sql.Types.SMALLINT:
04100:                        return new Short(srcObj.toString().trim());
04101:                    case java.sql.Types.INTEGER:
04102:                        return new Integer(srcObj.toString().trim());
04103:                    case java.sql.Types.BIGINT:
04104:                        return new Long(srcObj.toString().trim());
04105:                    case java.sql.Types.NUMERIC:
04106:                    case java.sql.Types.DECIMAL:
04107:                        return new BigDecimal(srcObj.toString().trim());
04108:                    case java.sql.Types.REAL:
04109:                    case java.sql.Types.FLOAT:
04110:                        return new Float(srcObj.toString().trim());
04111:                    case java.sql.Types.DOUBLE:
04112:                        return new Double(srcObj.toString().trim());
04113:                    case java.sql.Types.CHAR:
04114:                    case java.sql.Types.VARCHAR:
04115:                    case java.sql.Types.LONGVARCHAR:
04116:                        return new String(srcObj.toString());
04117:                    default:
04118:                        throw new SQLException(resBundle.handleGetObject(
04119:                                "cachedrowsetimpl.dtypemismt").toString()
04120:                                + trgType);
04121:                    }
04122:                } catch (NumberFormatException ex) {
04123:                    throw new SQLException(resBundle.handleGetObject(
04124:                            "cachedrowsetimpl.dtypemismt").toString()
04125:                            + trgType);
04126:                }
04127:            }
04128:
04129:            /**
04130:             * Converts the given <code>Object</code> in the Java programming language
04131:             * to the standard object mapping for the specified SQL target data type.
04132:             * The conversion must be to a string or temporal type, and there are also
04133:             * restrictions on the type to be converted.
04134:             * <P>
04135:             * <TABLE ALIGN="CENTER" BORDER CELLPADDING=10 BORDERCOLOR="#0000FF"
04136:             * <CAPTION ALIGN="CENTER"><B>Parameters and Return Values</B></CAPTION>
04137:             * <TR>
04138:             *   <TD><B>Source SQL Type</B>
04139:             *   <TD><B>Target SQL Type</B>
04140:             *   <TD><B>Object Returned</B>
04141:             * </TR>
04142:             * <TR>
04143:             *   <TD><code>TIMESTAMP</code>
04144:             *   <TD><code>DATE</code>
04145:             *   <TD><code>java.sql.Date</code>
04146:             * </TR>
04147:             * <TR>
04148:             *   <TD><code>TIMESTAMP</code>
04149:             *   <TD><code>TIME</code>
04150:             *   <TD><code>java.sql.Time</code>
04151:             * </TR>
04152:             * <TR>
04153:             *   <TD><code>TIME</code>
04154:             *   <TD><code>TIMESTAMP</code>
04155:             *   <TD><code>java.sql.Timestamp</code>
04156:             * </TR>
04157:             * <TR>
04158:             *   <TD><code>DATE</code>, <code>TIME</code>, or <code>TIMESTAMP</code>
04159:             *   <TD><code>CHAR</code>, <code>VARCHAR</code>, or <code>LONGVARCHAR</code>
04160:             *   <TD><code>java.lang.String</code>
04161:             * </TR>
04162:             * </TABLE>
04163:             * <P>
04164:             * If the source type and target type are the same,
04165:             * the given object is simply returned.
04166:             *
04167:             * @param srcObj the <code>Object</code> in the Java programming language
04168:             *               that is to be converted to the target type
04169:             * @param srcType the data type that is the standard mapping in SQL of the
04170:             *                object to be converted; must be one of the constants in
04171:             *                <code>java.sql.Types</code>
04172:             * @param trgType the SQL data type to which to convert the given object;
04173:             *                must be one of the following constants in
04174:             *                <code>java.sql.Types</code>: <code>DATE</code>,
04175:             *         <code>TIME</code>, <code>TIMESTAMP</code>, <code>CHAR</code>,
04176:             *         <code>VARCHAR</code>, or <code>LONGVARCHAR</code>
04177:             * @return an <code>Object</code> value.that is
04178:             *         the standard object mapping for the target SQL type
04179:             * @throws SQLException if the given target type is not one of the string or
04180:             *         temporal types in <code>java.sql.Types</code>
04181:             */
04182:            private Object convertTemporal(Object srcObj, int srcType,
04183:                    int trgType) throws SQLException {
04184:
04185:                if (srcType == trgType) {
04186:                    return srcObj;
04187:                }
04188:
04189:                if (isNumeric(trgType) == true
04190:                        || (isString(trgType) == false && isTemporal(trgType) == false)) {
04191:                    throw new SQLException(resBundle.handleGetObject(
04192:                            "cachedrowsetimpl.dtypemismt").toString());
04193:                }
04194:
04195:                try {
04196:                    switch (trgType) {
04197:                    case java.sql.Types.DATE:
04198:                        if (srcType == java.sql.Types.TIMESTAMP) {
04199:                            return new java.sql.Date(
04200:                                    ((java.sql.Timestamp) srcObj).getTime());
04201:                        } else {
04202:                            throw new SQLException(resBundle.handleGetObject(
04203:                                    "cachedrowsetimpl.dtypemismt").toString());
04204:                        }
04205:                    case java.sql.Types.TIMESTAMP:
04206:                        if (srcType == java.sql.Types.TIME) {
04207:                            return new Timestamp(((java.sql.Time) srcObj)
04208:                                    .getTime());
04209:                        } else {
04210:                            return new Timestamp(((java.sql.Date) srcObj)
04211:                                    .getTime());
04212:                        }
04213:                    case java.sql.Types.TIME:
04214:                        if (srcType == java.sql.Types.TIMESTAMP) {
04215:                            return new Time(((java.sql.Timestamp) srcObj)
04216:                                    .getTime());
04217:                        } else {
04218:                            throw new SQLException(resBundle.handleGetObject(
04219:                                    "cachedrowsetimpl.dtypemismt").toString());
04220:                        }
04221:                    case java.sql.Types.CHAR:
04222:                    case java.sql.Types.VARCHAR:
04223:                    case java.sql.Types.LONGVARCHAR:
04224:                        return new String(srcObj.toString());
04225:                    default:
04226:                        throw new SQLException(resBundle.handleGetObject(
04227:                                "cachedrowsetimpl.dtypemismt").toString());
04228:                    }
04229:                } catch (NumberFormatException ex) {
04230:                    throw new SQLException(resBundle.handleGetObject(
04231:                            "cachedrowsetimpl.dtypemismt").toString());
04232:                }
04233:
04234:            }
04235:
04236:            /**
04237:             * Converts the given <code>Object</code> in the Java programming language
04238:             * to the standard mapping for the specified SQL target data type.
04239:             * The conversion must be to a string or numeric type, but there are no
04240:             * restrictions on the type to be converted.  If the source type and target
04241:             * type are the same, the given object is simply returned.
04242:             *
04243:             * @param srcObj the <code>Object</code> in the Java programming language
04244:             *               that is to be converted to the target type
04245:             * @param srcType the data type that is the standard mapping in SQL of the
04246:             *                object to be converted; must be one of the constants in
04247:             *                <code>java.sql.Types</code>
04248:             * @param trgType the SQL data type to which to convert the given object;
04249:             *                must be one of the following constants in
04250:             *                <code>java.sql.Types</code>: <code>BIT</code>,
04251:             *         or <code>BOOLEAN</code>
04252:             * @return an <code>Object</code> value.that is
04253:             *         the standard object mapping for the target SQL type
04254:             * @throws SQLException if the given target type is not one of the Boolean
04255:             *         types in <code>java.sql.Types</code>
04256:             */
04257:            private Object convertBoolean(Object srcObj, int srcType,
04258:                    int trgType) throws SQLException {
04259:
04260:                if (srcType == trgType) {
04261:                    return srcObj;
04262:                }
04263:
04264:                if (isNumeric(trgType) == true
04265:                        || (isString(trgType) == false && isBoolean(trgType) == false)) {
04266:                    throw new SQLException(resBundle.handleGetObject(
04267:                            "cachedrowsetimpl.dtypemismt").toString());
04268:                }
04269:
04270:                try {
04271:                    switch (trgType) {
04272:                    case java.sql.Types.BIT:
04273:                        Integer i = new Integer(srcObj.toString().trim());
04274:                        return i.equals(new Integer((int) 0)) ? new Boolean(
04275:                                false) : new Boolean(true);
04276:                    case java.sql.Types.BOOLEAN:
04277:                        return new Boolean(srcObj.toString().trim());
04278:                    default:
04279:                        throw new SQLException(resBundle.handleGetObject(
04280:                                "cachedrowsetimpl.dtypemismt").toString()
04281:                                + trgType);
04282:                    }
04283:                } catch (NumberFormatException ex) {
04284:                    throw new SQLException(resBundle.handleGetObject(
04285:                            "cachedrowsetimpl.dtypemismt").toString()
04286:                            + trgType);
04287:                }
04288:            }
04289:
04290:            /**
04291:             * Sets the designated nullable column in the current row or the
04292:             * insert row of this <code>CachedRowSetImpl</code> object with
04293:             * <code>null</code> value.
04294:             * <P>
04295:             * This method updates a column value in the current row or the insert
04296:             * row of this rowset; however, another method must be called to complete
04297:             * the update process. If the cursor is on a row in the rowset, the
04298:             * method {@link #updateRow} must be called to mark the row as updated
04299:             * and to notify listeners that the row has changed.
04300:             * If the cursor is on the insert row, the method {@link #insertRow}
04301:             * must be called to insert the new row into this rowset and to notify
04302:             * listeners that a row has changed.
04303:             * <P>
04304:             * In order to propagate updates in this rowset to the underlying
04305:             * data source, an application must call the method {@link #acceptChanges}
04306:             * after it calls either <code>updateRow</code> or <code>insertRow</code>.
04307:             *
04308:             * @param columnIndex the first column is <code>1</code>, the second
04309:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
04310:             *        and equal to or less than the number of columns in this rowset
04311:             * @throws SQLException if (1) the given column index is out of bounds,
04312:             *            (2) the cursor is not on one of this rowset's rows or its
04313:             *            insert row, or (3) this rowset is
04314:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
04315:             */
04316:            public void updateNull(int columnIndex) throws SQLException {
04317:                // sanity check.
04318:                checkIndex(columnIndex);
04319:                // make sure the cursor is on a valid row
04320:                checkCursor();
04321:
04322:                BaseRow row = getCurrentRow();
04323:                row.setColumnObject(columnIndex, null);
04324:
04325:            }
04326:
04327:            /**
04328:             * Sets the designated column in either the current row or the insert
04329:             * row of this <code>CachedRowSetImpl</code> object with the given
04330:             * <code>boolean</code> value.
04331:             * <P>
04332:             * This method updates a column value in the current row or the insert
04333:             * row of this rowset, but it does not update the database.
04334:             * If the cursor is on a row in the rowset, the
04335:             * method {@link #updateRow} must be called to update the database.
04336:             * If the cursor is on the insert row, the method {@link #insertRow}
04337:             * must be called, which will insert the new row into both this rowset
04338:             * and the database. Both of these methods must be called before the
04339:             * cursor moves to another row.
04340:             *
04341:             * @param columnIndex the first column is <code>1</code>, the second
04342:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
04343:             *        and equal to or less than the number of columns in this rowset
04344:             * @param x the new column value
04345:             * @throws SQLException if (1) the given column index is out of bounds,
04346:             *            (2) the cursor is not on one of this rowset's rows or its
04347:             *            insert row, or (3) this rowset is
04348:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
04349:             */
04350:            public void updateBoolean(int columnIndex, boolean x)
04351:                    throws SQLException {
04352:                // sanity check.
04353:                checkIndex(columnIndex);
04354:                // make sure the cursor is on a valid row
04355:                checkCursor();
04356:                Object obj = convertBoolean(new Boolean(x), java.sql.Types.BIT,
04357:                        RowSetMD.getColumnType(columnIndex));
04358:
04359:                getCurrentRow().setColumnObject(columnIndex, obj);
04360:            }
04361:
04362:            /**
04363:             * Sets the designated column in either the current row or the insert
04364:             * row of this <code>CachedRowSetImpl</code> object with the given
04365:             * <code>byte</code> value.
04366:             * <P>
04367:             * This method updates a column value in the current row or the insert
04368:             * row of this rowset, but it does not update the database.
04369:             * If the cursor is on a row in the rowset, the
04370:             * method {@link #updateRow} must be called to update the database.
04371:             * If the cursor is on the insert row, the method {@link #insertRow}
04372:             * must be called, which will insert the new row into both this rowset
04373:             * and the database. Both of these methods must be called before the
04374:             * cursor moves to another row.
04375:             *
04376:             * @param columnIndex the first column is <code>1</code>, the second
04377:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
04378:             *        and equal to or less than the number of columns in this rowset
04379:             * @param x the new column value
04380:             * @throws SQLException if (1) the given column index is out of bounds,
04381:             *            (2) the cursor is not on one of this rowset's rows or its
04382:             *            insert row, or (3) this rowset is
04383:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
04384:             */
04385:            public void updateByte(int columnIndex, byte x) throws SQLException {
04386:                // sanity check.
04387:                checkIndex(columnIndex);
04388:                // make sure the cursor is on a valid row
04389:                checkCursor();
04390:
04391:                Object obj = convertNumeric(new Byte(x),
04392:                        java.sql.Types.TINYINT, RowSetMD
04393:                                .getColumnType(columnIndex));
04394:
04395:                getCurrentRow().setColumnObject(columnIndex, obj);
04396:            }
04397:
04398:            /**
04399:             * Sets the designated column in either the current row or the insert
04400:             * row of this <code>CachedRowSetImpl</code> object with the given
04401:             * <code>short</code> value.
04402:             * <P>
04403:             * This method updates a column value in the current row or the insert
04404:             * row of this rowset, but it does not update the database.
04405:             * If the cursor is on a row in the rowset, the
04406:             * method {@link #updateRow} must be called to update the database.
04407:             * If the cursor is on the insert row, the method {@link #insertRow}
04408:             * must be called, which will insert the new row into both this rowset
04409:             * and the database. Both of these methods must be called before the
04410:             * cursor moves to another row.
04411:             *
04412:             * @param columnIndex the first column is <code>1</code>, the second
04413:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
04414:             *        and equal to or less than the number of columns in this rowset
04415:             * @param x the new column value
04416:             * @throws SQLException if (1) the given column index is out of bounds,
04417:             *            (2) the cursor is not on one of this rowset's rows or its
04418:             *            insert row, or (3) this rowset is
04419:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
04420:             */
04421:            public void updateShort(int columnIndex, short x)
04422:                    throws SQLException {
04423:                // sanity check.
04424:                checkIndex(columnIndex);
04425:                // make sure the cursor is on a valid row
04426:                checkCursor();
04427:
04428:                Object obj = convertNumeric(new Short(x),
04429:                        java.sql.Types.SMALLINT, RowSetMD
04430:                                .getColumnType(columnIndex));
04431:
04432:                getCurrentRow().setColumnObject(columnIndex, obj);
04433:            }
04434:
04435:            /**
04436:             * Sets the designated column in either the current row or the insert
04437:             * row of this <code>CachedRowSetImpl</code> object with the given
04438:             * <code>int</code> value.
04439:             * <P>
04440:             * This method updates a column value in the current row or the insert
04441:             * row of this rowset, but it does not update the database.
04442:             * If the cursor is on a row in the rowset, the
04443:             * method {@link #updateRow} must be called to update the database.
04444:             * If the cursor is on the insert row, the method {@link #insertRow}
04445:             * must be called, which will insert the new row into both this rowset
04446:             * and the database. Both of these methods must be called before the
04447:             * cursor moves to another row.
04448:             *
04449:             * @param columnIndex the first column is <code>1</code>, the second
04450:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
04451:             *        and equal to or less than the number of columns in this rowset
04452:             * @param x the new column value
04453:             * @throws SQLException if (1) the given column index is out of bounds,
04454:             *            (2) the cursor is not on one of this rowset's rows or its
04455:             *            insert row, or (3) this rowset is
04456:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
04457:             */
04458:            public void updateInt(int columnIndex, int x) throws SQLException {
04459:                // sanity check.
04460:                checkIndex(columnIndex);
04461:                // make sure the cursor is on a valid row
04462:                checkCursor();
04463:                Object obj = convertNumeric(new Integer(x),
04464:                        java.sql.Types.INTEGER, RowSetMD
04465:                                .getColumnType(columnIndex));
04466:
04467:                getCurrentRow().setColumnObject(columnIndex, obj);
04468:            }
04469:
04470:            /**
04471:             * Sets the designated column in either the current row or the insert
04472:             * row of this <code>CachedRowSetImpl</code> object with the given
04473:             * <code>long</code> value.
04474:             * <P>
04475:             * This method updates a column value in the current row or the insert
04476:             * row of this rowset, but it does not update the database.
04477:             * If the cursor is on a row in the rowset, the
04478:             * method {@link #updateRow} must be called to update the database.
04479:             * If the cursor is on the insert row, the method {@link #insertRow}
04480:             * must be called, which will insert the new row into both this rowset
04481:             * and the database. Both of these methods must be called before the
04482:             * cursor moves to another row.
04483:             *
04484:             * @param columnIndex the first column is <code>1</code>, the second
04485:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
04486:             *        and equal to or less than the number of columns in this rowset
04487:             * @param x the new column value
04488:             * @throws SQLException if (1) the given column index is out of bounds,
04489:             *            (2) the cursor is not on one of this rowset's rows or its
04490:             *            insert row, or (3) this rowset is
04491:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
04492:             */
04493:            public void updateLong(int columnIndex, long x) throws SQLException {
04494:                // sanity check.
04495:                checkIndex(columnIndex);
04496:                // make sure the cursor is on a valid row
04497:                checkCursor();
04498:
04499:                Object obj = convertNumeric(new Long(x), java.sql.Types.BIGINT,
04500:                        RowSetMD.getColumnType(columnIndex));
04501:
04502:                getCurrentRow().setColumnObject(columnIndex, obj);
04503:
04504:            }
04505:
04506:            /**
04507:             * Sets the designated column in either the current row or the insert
04508:             * row of this <code>CachedRowSetImpl</code> object with the given
04509:             * <code>float</code> value.
04510:             * <P>
04511:             * This method updates a column value in the current row or the insert
04512:             * row of this rowset, but it does not update the database.
04513:             * If the cursor is on a row in the rowset, the
04514:             * method {@link #updateRow} must be called to update the database.
04515:             * If the cursor is on the insert row, the method {@link #insertRow}
04516:             * must be called, which will insert the new row into both this rowset
04517:             * and the database. Both of these methods must be called before the
04518:             * cursor moves to another row.
04519:             *
04520:             * @param columnIndex the first column is <code>1</code>, the second
04521:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
04522:             *        and equal to or less than the number of columns in this rowset
04523:             * @param x the new column value
04524:             * @throws SQLException if (1) the given column index is out of bounds,
04525:             *            (2) the cursor is not on one of this rowset's rows or its
04526:             *            insert row, or (3) this rowset is
04527:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
04528:             */
04529:            public void updateFloat(int columnIndex, float x)
04530:                    throws SQLException {
04531:                // sanity check.
04532:                checkIndex(columnIndex);
04533:                // make sure the cursor is on a valid row
04534:                checkCursor();
04535:
04536:                Object obj = convertNumeric(new Float(x), java.sql.Types.REAL,
04537:                        RowSetMD.getColumnType(columnIndex));
04538:
04539:                getCurrentRow().setColumnObject(columnIndex, obj);
04540:            }
04541:
04542:            /**
04543:             * Sets the designated column in either the current row or the insert
04544:             * row of this <code>CachedRowSetImpl</code> object with the given
04545:             * <code>double</code> value.
04546:             *
04547:             * This method updates a column value in either the current row or
04548:             * the insert row of this rowset, but it does not update the
04549:             * database.  If the cursor is on a row in the rowset, the
04550:             * method {@link #updateRow} must be called to update the database.
04551:             * If the cursor is on the insert row, the method {@link #insertRow}
04552:             * must be called, which will insert the new row into both this rowset
04553:             * and the database. Both of these methods must be called before the
04554:             * cursor moves to another row.
04555:             *
04556:             * @param columnIndex the first column is <code>1</code>, the second
04557:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
04558:             *        and equal to or less than the number of columns in this rowset
04559:             * @param x the new column value
04560:             * @throws SQLException if (1) the given column index is out of bounds,
04561:             *            (2) the cursor is not on one of this rowset's rows or its
04562:             *            insert row, or (3) this rowset is
04563:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
04564:             */
04565:            public void updateDouble(int columnIndex, double x)
04566:                    throws SQLException {
04567:                // sanity check.
04568:                checkIndex(columnIndex);
04569:                // make sure the cursor is on a valid row
04570:                checkCursor();
04571:                Object obj = convertNumeric(new Double(x),
04572:                        java.sql.Types.DOUBLE, RowSetMD
04573:                                .getColumnType(columnIndex));
04574:
04575:                getCurrentRow().setColumnObject(columnIndex, obj);
04576:            }
04577:
04578:            /**
04579:             * Sets the designated column in either the current row or the insert
04580:             * row of this <code>CachedRowSetImpl</code> object with the given
04581:             * <code>java.math.BigDecimal</code> object.
04582:             * <P>
04583:             * This method updates a column value in the current row or the insert
04584:             * row of this rowset, but it does not update the database.
04585:             * If the cursor is on a row in the rowset, the
04586:             * method {@link #updateRow} must be called to update the database.
04587:             * If the cursor is on the insert row, the method {@link #insertRow}
04588:             * must be called, which will insert the new row into both this rowset
04589:             * and the database. Both of these methods must be called before the
04590:             * cursor moves to another row.
04591:             *
04592:             * @param columnIndex the first column is <code>1</code>, the second
04593:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
04594:             *        and equal to or less than the number of columns in this rowset
04595:             * @param x the new column value
04596:             * @throws SQLException if (1) the given column index is out of bounds,
04597:             *            (2) the cursor is not on one of this rowset's rows or its
04598:             *            insert row, or (3) this rowset is
04599:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
04600:             */
04601:            public void updateBigDecimal(int columnIndex, BigDecimal x)
04602:                    throws SQLException {
04603:                // sanity check.
04604:                checkIndex(columnIndex);
04605:                // make sure the cursor is on a valid row
04606:                checkCursor();
04607:
04608:                Object obj = convertNumeric(x, java.sql.Types.NUMERIC, RowSetMD
04609:                        .getColumnType(columnIndex));
04610:
04611:                getCurrentRow().setColumnObject(columnIndex, obj);
04612:            }
04613:
04614:            /**
04615:             * Sets the designated column in either the current row or the insert
04616:             * row of this <code>CachedRowSetImpl</code> object with the given
04617:             * <code>String</code> object.
04618:             * <P>
04619:             * This method updates a column value in either the current row or
04620:             * the insert row of this rowset, but it does not update the
04621:             * database.  If the cursor is on a row in the rowset, the
04622:             * method {@link #updateRow} must be called to mark the row as updated.
04623:             * If the cursor is on the insert row, the method {@link #insertRow}
04624:             * must be called to insert the new row into this rowset and mark it
04625:             * as inserted. Both of these methods must be called before the
04626:             * cursor moves to another row.
04627:             * <P>
04628:             * The method <code>acceptChanges</code> must be called if the
04629:             * updated values are to be written back to the underlying database.
04630:             *
04631:             * @param columnIndex the first column is <code>1</code>, the second
04632:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
04633:             *        and equal to or less than the number of columns in this rowset
04634:             * @param x the new column value
04635:             * @throws SQLException if (1) the given column index is out of bounds,
04636:             *            (2) the cursor is not on one of this rowset's rows or its
04637:             *            insert row, or (3) this rowset is
04638:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
04639:             */
04640:            public void updateString(int columnIndex, String x)
04641:                    throws SQLException {
04642:                // sanity check.
04643:                checkIndex(columnIndex);
04644:                // make sure the cursor is on a valid row
04645:                checkCursor();
04646:
04647:                getCurrentRow().setColumnObject(columnIndex, x);
04648:            }
04649:
04650:            /**
04651:             * Sets the designated column in either the current row or the insert
04652:             * row of this <code>CachedRowSetImpl</code> object with the given
04653:             * <code>byte</code> array.
04654:             *
04655:             * This method updates a column value in either the current row or
04656:             * the insert row of this rowset, but it does not update the
04657:             * database.  If the cursor is on a row in the rowset, the
04658:             * method {@link #updateRow} must be called to update the database.
04659:             * If the cursor is on the insert row, the method {@link #insertRow}
04660:             * must be called, which will insert the new row into both this rowset
04661:             * and the database. Both of these methods must be called before the
04662:             * cursor moves to another row.
04663:             *
04664:             * @param columnIndex the first column is <code>1</code>, the second
04665:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
04666:             *        and equal to or less than the number of columns in this rowset
04667:             * @param x the new column value
04668:             * @throws SQLException if (1) the given column index is out of bounds,
04669:             *            (2) the cursor is not on one of this rowset's rows or its
04670:             *            insert row, or (3) this rowset is
04671:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
04672:             */
04673:            public void updateBytes(int columnIndex, byte x[])
04674:                    throws SQLException {
04675:                // sanity check.
04676:                checkIndex(columnIndex);
04677:                // make sure the cursor is on a valid row
04678:                checkCursor();
04679:
04680:                if (isBinary(RowSetMD.getColumnType(columnIndex)) == false) {
04681:                    throw new SQLException(resBundle.handleGetObject(
04682:                            "cachedrowsetimpl.dtypemismt").toString());
04683:                }
04684:
04685:                getCurrentRow().setColumnObject(columnIndex, x);
04686:            }
04687:
04688:            /**
04689:             * Sets the designated column in either the current row or the insert
04690:             * row of this <code>CachedRowSetImpl</code> object with the given
04691:             * <code>Date</code> object.
04692:             *
04693:             * This method updates a column value in either the current row or
04694:             * the insert row of this rowset, but it does not update the
04695:             * database.  If the cursor is on a row in the rowset, the
04696:             * method {@link #updateRow} must be called to update the database.
04697:             * If the cursor is on the insert row, the method {@link #insertRow}
04698:             * must be called, which will insert the new row into both this rowset
04699:             * and the database. Both of these methods must be called before the
04700:             * cursor moves to another row.
04701:             *
04702:             * @param columnIndex the first column is <code>1</code>, the second
04703:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
04704:             *        and equal to or less than the number of columns in this rowset
04705:             * @param x the new column value
04706:             * @throws SQLException if (1) the given column index is out of bounds,
04707:             *            (2) the cursor is not on one of this rowset's rows or its
04708:             *            insert row, (3) the type of the designated column is not
04709:             *            an SQL <code>DATE</code> or <code>TIMESTAMP</code>, or
04710:             *            (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
04711:             */
04712:            public void updateDate(int columnIndex, java.sql.Date x)
04713:                    throws SQLException {
04714:                // sanity check.
04715:                checkIndex(columnIndex);
04716:                // make sure the cursor is on a valid row
04717:                checkCursor();
04718:
04719:                Object obj = convertTemporal(x, java.sql.Types.DATE, RowSetMD
04720:                        .getColumnType(columnIndex));
04721:
04722:                getCurrentRow().setColumnObject(columnIndex, obj);
04723:            }
04724:
04725:            /**
04726:             * Sets the designated column in either the current row or the insert
04727:             * row of this <code>CachedRowSetImpl</code> object with the given
04728:             * <code>Time</code> object.
04729:             *
04730:             * This method updates a column value in either the current row or
04731:             * the insert row of this rowset, but it does not update the
04732:             * database.  If the cursor is on a row in the rowset, the
04733:             * method {@link #updateRow} must be called to update the database.
04734:             * If the cursor is on the insert row, the method {@link #insertRow}
04735:             * must be called, which will insert the new row into both this rowset
04736:             * and the database. Both of these methods must be called before the
04737:             * cursor moves to another row.
04738:             *
04739:             * @param columnIndex the first column is <code>1</code>, the second
04740:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
04741:             *        and equal to or less than the number of columns in this rowset
04742:             * @param x the new column value
04743:             * @throws SQLException if (1) the given column index is out of bounds,
04744:             *            (2) the cursor is not on one of this rowset's rows or its
04745:             *            insert row, (3) the type of the designated column is not
04746:             *            an SQL <code>TIME</code> or <code>TIMESTAMP</code>, or
04747:             *            (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
04748:             */
04749:            public void updateTime(int columnIndex, java.sql.Time x)
04750:                    throws SQLException {
04751:                // sanity check.
04752:                checkIndex(columnIndex);
04753:                // make sure the cursor is on a valid row
04754:                checkCursor();
04755:
04756:                Object obj = convertTemporal(x, java.sql.Types.TIME, RowSetMD
04757:                        .getColumnType(columnIndex));
04758:
04759:                getCurrentRow().setColumnObject(columnIndex, obj);
04760:            }
04761:
04762:            /**
04763:             * Sets the designated column in either the current row or the insert
04764:             * row of this <code>CachedRowSetImpl</code> object with the given
04765:             * <code>Timestamp</code> object.
04766:             *
04767:             * This method updates a column value in either the current row or
04768:             * the insert row of this rowset, but it does not update the
04769:             * database.  If the cursor is on a row in the rowset, the
04770:             * method {@link #updateRow} must be called to update the database.
04771:             * If the cursor is on the insert row, the method {@link #insertRow}
04772:             * must be called, which will insert the new row into both this rowset
04773:             * and the database. Both of these methods must be called before the
04774:             * cursor moves to another row.
04775:             *
04776:             * @param columnIndex the first column is <code>1</code>, the second
04777:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
04778:             *        and equal to or less than the number of columns in this rowset
04779:             * @param x the new column value
04780:             * @throws SQLException if (1) the given column index is out of bounds,
04781:             *            (2) the cursor is not on one of this rowset's rows or its
04782:             *            insert row, (3) the type of the designated column is not
04783:             *            an SQL <code>DATE</code>, <code>TIME</code>, or
04784:             *            <code>TIMESTAMP</code>, or (4) this rowset is
04785:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
04786:             */
04787:            public void updateTimestamp(int columnIndex, java.sql.Timestamp x)
04788:                    throws SQLException {
04789:                // sanity check.
04790:                checkIndex(columnIndex);
04791:                // make sure the cursor is on a valid row
04792:                checkCursor();
04793:
04794:                Object obj = convertTemporal(x, java.sql.Types.TIMESTAMP,
04795:                        RowSetMD.getColumnType(columnIndex));
04796:
04797:                getCurrentRow().setColumnObject(columnIndex, obj);
04798:            }
04799:
04800:            /**
04801:             * Sets the designated column in either the current row or the insert
04802:             * row of this <code>CachedRowSetImpl</code> object with the given
04803:             * ASCII stream value.
04804:             * <P>
04805:             * This method updates a column value in either the current row or
04806:             * the insert row of this rowset, but it does not update the
04807:             * database.  If the cursor is on a row in the rowset, the
04808:             * method {@link #updateRow} must be called to update the database.
04809:             * If the cursor is on the insert row, the method {@link #insertRow}
04810:             * must be called, which will insert the new row into both this rowset
04811:             * and the database. Both of these methods must be called before the
04812:             * cursor moves to another row.
04813:             *
04814:             * @param columnIndex the first column is <code>1</code>, the second
04815:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
04816:             *        and equal to or less than the number of columns in this rowset
04817:             * @param x the new column value
04818:             * @param length the number of one-byte ASCII characters in the stream
04819:             * @throws SQLException if this method is invoked
04820:             */
04821:            public void updateAsciiStream(int columnIndex,
04822:                    java.io.InputStream x, int length) throws SQLException {
04823:                // sanity Check
04824:                checkIndex(columnIndex);
04825:                // make sure the cursor is on a valid row
04826:                checkCursor();
04827:
04828:                if (isString(RowSetMD.getColumnType(columnIndex)) == false
04829:                        && isBinary(RowSetMD.getColumnType(columnIndex)) == false) {
04830:                    throw new SQLException(resBundle.handleGetObject(
04831:                            "cachedrowsetimpl.dtypemismt").toString());
04832:                }
04833:
04834:                byte buf[] = new byte[length];
04835:                try {
04836:                    int charsRead = 0;
04837:                    do {
04838:                        charsRead += x.read(buf, charsRead, length - charsRead);
04839:                    } while (charsRead != length);
04840:                    //Changed the condition check to check for length instead of -1
04841:                } catch (java.io.IOException ex) {
04842:                    throw new SQLException(resBundle.handleGetObject(
04843:                            "cachedrowsetimpl.asciistream").toString());
04844:                }
04845:                String str = new String(buf);
04846:
04847:                getCurrentRow().setColumnObject(columnIndex, str);
04848:
04849:            }
04850:
04851:            /**
04852:             * Sets the designated column in either the current row or the insert
04853:             * row of this <code>CachedRowSetImpl</code> object with the given
04854:             * <code>java.io.InputStream</code> object.
04855:             * <P>
04856:             * This method updates a column value in either the current row or
04857:             * the insert row of this rowset, but it does not update the
04858:             * database.  If the cursor is on a row in the rowset, the
04859:             * method {@link #updateRow} must be called to update the database.
04860:             * If the cursor is on the insert row, the method {@link #insertRow}
04861:             * must be called, which will insert the new row into both this rowset
04862:             * and the database. Both of these methods must be called before the
04863:             * cursor moves to another row.
04864:             *
04865:             * @param columnIndex the first column is <code>1</code>, the second
04866:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
04867:             *        and equal to or less than the number of columns in this rowset
04868:             * @param x the new column value; must be a <code>java.io.InputStream</code>
04869:             *          containing <code>BINARY</code>, <code>VARBINARY</code>, or
04870:             *          <code>LONGVARBINARY</code> data
04871:             * @param length the length of the stream in bytes
04872:             * @throws SQLException if (1) the given column index is out of bounds,
04873:             *            (2) the cursor is not on one of this rowset's rows or its
04874:             *            insert row, (3) the data in the stream is not binary, or
04875:             *            (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
04876:             */
04877:            public void updateBinaryStream(int columnIndex,
04878:                    java.io.InputStream x, int length) throws SQLException {
04879:                // sanity Check
04880:                checkIndex(columnIndex);
04881:                // make sure the cursor is on a valid row
04882:                checkCursor();
04883:
04884:                if (isBinary(RowSetMD.getColumnType(columnIndex)) == false) {
04885:                    throw new SQLException(resBundle.handleGetObject(
04886:                            "cachedrowsetimpl.dtypemismt").toString());
04887:                }
04888:
04889:                byte buf[] = new byte[length];
04890:                try {
04891:                    int bytesRead = 0;
04892:                    do {
04893:                        bytesRead += x.read(buf, bytesRead, length - bytesRead);
04894:                    } while (bytesRead != -1);
04895:                } catch (java.io.IOException ex) {
04896:                    throw new SQLException(resBundle.handleGetObject(
04897:                            "cachedrowsetimpl.binstream").toString());
04898:                }
04899:
04900:                getCurrentRow().setColumnObject(columnIndex, buf);
04901:            }
04902:
04903:            /**
04904:             * Sets the designated column in either the current row or the insert
04905:             * row of this <code>CachedRowSetImpl</code> object with the given
04906:             * <code>java.io.Reader</code> object.
04907:             * <P>
04908:             * This method updates a column value in either the current row or
04909:             * the insert row of this rowset, but it does not update the
04910:             * database.  If the cursor is on a row in the rowset, the
04911:             * method {@link #updateRow} must be called to update the database.
04912:             * If the cursor is on the insert row, the method {@link #insertRow}
04913:             * must be called, which will insert the new row into both this rowset
04914:             * and the database. Both of these methods must be called before the
04915:             * cursor moves to another row.
04916:             *
04917:             * @param columnIndex the first column is <code>1</code>, the second
04918:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
04919:             *        and equal to or less than the number of columns in this rowset
04920:             * @param x the new column value; must be a <code>java.io.Reader</code>
04921:             *          containing <code>BINARY</code>, <code>VARBINARY</code>,
04922:             *          <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>,
04923:             *          or <code>LONGVARCHAR</code> data
04924:             * @param length the length of the stream in characters
04925:             * @throws SQLException if (1) the given column index is out of bounds,
04926:             *            (2) the cursor is not on one of this rowset's rows or its
04927:             *            insert row, (3) the data in the stream is not a binary or
04928:             *            character type, or (4) this rowset is
04929:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
04930:             */
04931:            public void updateCharacterStream(int columnIndex,
04932:                    java.io.Reader x, int length) throws SQLException {
04933:                // sanity Check
04934:                checkIndex(columnIndex);
04935:                // make sure the cursor is on a valid row
04936:                checkCursor();
04937:
04938:                if (isString(RowSetMD.getColumnType(columnIndex)) == false
04939:                        && isBinary(RowSetMD.getColumnType(columnIndex)) == false) {
04940:                    throw new SQLException(resBundle.handleGetObject(
04941:                            "cachedrowsetimpl.dtypemismt").toString());
04942:                }
04943:
04944:                char buf[] = new char[length];
04945:                try {
04946:                    int charsRead = 0;
04947:                    do {
04948:                        charsRead += x.read(buf, charsRead, length - charsRead);
04949:                    } while (charsRead != length);
04950:                    //Changed the condition checking to check for length instead of -1
04951:                } catch (java.io.IOException ex) {
04952:                    throw new SQLException(resBundle.handleGetObject(
04953:                            "cachedrowsetimpl.binstream").toString());
04954:                }
04955:                String str = new String(buf);
04956:
04957:                getCurrentRow().setColumnObject(columnIndex, str);
04958:            }
04959:
04960:            /**
04961:             * Sets the designated column in either the current row or the insert
04962:             * row of this <code>CachedRowSetImpl</code> object with the given
04963:             * <code>Object</code> value.  The <code>scale</code> parameter indicates
04964:             * the number of digits to the right of the decimal point and is ignored
04965:             * if the new column value is not a type that will be mapped to an SQL
04966:             * <code>DECIMAL</code> or <code>NUMERIC</code> value.
04967:             * <P>
04968:             * This method updates a column value in either the current row or
04969:             * the insert row of this rowset, but it does not update the
04970:             * database.  If the cursor is on a row in the rowset, the
04971:             * method {@link #updateRow} must be called to update the database.
04972:             * If the cursor is on the insert row, the method {@link #insertRow}
04973:             * must be called, which will insert the new row into both this rowset
04974:             * and the database. Both of these methods must be called before the
04975:             * cursor moves to another row.
04976:             *
04977:             * @param columnIndex the first column is <code>1</code>, the second
04978:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
04979:             *        and equal to or less than the number of columns in this rowset
04980:             * @param x the new column value
04981:             * @param scale the number of digits to the right of the decimal point (for
04982:             *              <code>DECIMAL</code> and <code>NUMERIC</code> types only)
04983:             * @throws SQLException if (1) the given column index is out of bounds,
04984:             *            (2) the cursor is not on one of this rowset's rows or its
04985:             *            insert row, or (3) this rowset is
04986:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
04987:             */
04988:            public void updateObject(int columnIndex, Object x, int scale)
04989:                    throws SQLException {
04990:                // sanity check.
04991:                checkIndex(columnIndex);
04992:                // make sure the cursor is on a valid row
04993:                checkCursor();
04994:
04995:                int type = RowSetMD.getColumnType(columnIndex);
04996:                if (type == Types.DECIMAL || type == Types.NUMERIC) {
04997:                    ((java.math.BigDecimal) x).setScale(scale);
04998:                }
04999:                getCurrentRow().setColumnObject(columnIndex, x);
05000:            }
05001:
05002:            /**
05003:             * Sets the designated column in either the current row or the insert
05004:             * row of this <code>CachedRowSetImpl</code> object with the given
05005:             * <code>Object</code> value.
05006:             * <P>
05007:             * This method updates a column value in either the current row or
05008:             * the insert row of this rowset, but it does not update the
05009:             * database.  If the cursor is on a row in the rowset, the
05010:             * method {@link #updateRow} must be called to update the database.
05011:             * If the cursor is on the insert row, the method {@link #insertRow}
05012:             * must be called, which will insert the new row into both this rowset
05013:             * and the database. Both of these methods must be called before the
05014:             * cursor moves to another row.
05015:             *
05016:             * @param columnIndex the first column is <code>1</code>, the second
05017:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
05018:             *        and equal to or less than the number of columns in this rowset
05019:             * @param x the new column value
05020:             * @throws SQLException if (1) the given column index is out of bounds,
05021:             *            (2) the cursor is not on one of this rowset's rows or its
05022:             *            insert row, or (3) this rowset is
05023:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
05024:             */
05025:            public void updateObject(int columnIndex, Object x)
05026:                    throws SQLException {
05027:                // sanity check.
05028:                checkIndex(columnIndex);
05029:                // make sure the cursor is on a valid row
05030:                checkCursor();
05031:
05032:                getCurrentRow().setColumnObject(columnIndex, x);
05033:            }
05034:
05035:            /**
05036:             * Sets the designated nullable column in the current row or the
05037:             * insert row of this <code>CachedRowSetImpl</code> object with
05038:             * <code>null</code> value.
05039:             * <P>
05040:             * This method updates a column value in the current row or the insert
05041:             * row of this rowset, but it does not update the database.
05042:             * If the cursor is on a row in the rowset, the
05043:             * method {@link #updateRow} must be called to update the database.
05044:             * If the cursor is on the insert row, the method {@link #insertRow}
05045:             * must be called, which will insert the new row into both this rowset
05046:             * and the database.
05047:             *
05048:             * @param columnName a <code>String</code> object that must match the
05049:             *        SQL name of a column in this rowset, ignoring case
05050:             * @throws SQLException if (1) the given column name does not match the
05051:             *            name of a column in this rowset, (2) the cursor is not on
05052:             *            one of this rowset's rows or its insert row, or (3) this
05053:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
05054:             */
05055:            public void updateNull(String columnName) throws SQLException {
05056:                updateNull(getColIdxByName(columnName));
05057:            }
05058:
05059:            /**
05060:             * Sets the designated column in either the current row or the insert
05061:             * row of this <code>CachedRowSetImpl</code> object with the given
05062:             * <code>boolean</code> value.
05063:             * <P>
05064:             * This method updates a column value in the current row or the insert
05065:             * row of this rowset, but it does not update the database.
05066:             * If the cursor is on a row in the rowset, the
05067:             * method {@link #updateRow} must be called to update the database.
05068:             * If the cursor is on the insert row, the method {@link #insertRow}
05069:             * must be called, which will insert the new row into both this rowset
05070:             * and the database. Both of these methods must be called before the
05071:             * cursor moves to another row.
05072:             *
05073:             * @param columnName a <code>String</code> object that must match the
05074:             *        SQL name of a column in this rowset, ignoring case
05075:             * @param x the new column value
05076:             * @throws SQLException if (1) the given column name does not match the
05077:             *            name of a column in this rowset, (2) the cursor is not on
05078:             *            one of this rowset's rows or its insert row, or (3) this
05079:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
05080:             */
05081:            public void updateBoolean(String columnName, boolean x)
05082:                    throws SQLException {
05083:                updateBoolean(getColIdxByName(columnName), x);
05084:            }
05085:
05086:            /**
05087:             * Sets the designated column in either the current row or the insert
05088:             * row of this <code>CachedRowSetImpl</code> object with the given
05089:             * <code>byte</code> value.
05090:             * <P>
05091:             * This method updates a column value in the current row or the insert
05092:             * row of this rowset, but it does not update the database.
05093:             * If the cursor is on a row in the rowset, the
05094:             * method {@link #updateRow} must be called to update the database.
05095:             * If the cursor is on the insert row, the method {@link #insertRow}
05096:             * must be called, which will insert the new row into both this rowset
05097:             * and the database. Both of these methods must be called before the
05098:             * cursor moves to another row.
05099:             *
05100:             * @param columnName a <code>String</code> object that must match the
05101:             *        SQL name of a column in this rowset, ignoring case
05102:             * @param x the new column value
05103:             * @throws SQLException if (1) the given column name does not match the
05104:             *            name of a column in this rowset, (2) the cursor is not on
05105:             *            one of this rowset's rows or its insert row, or (3) this
05106:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
05107:             */
05108:            public void updateByte(String columnName, byte x)
05109:                    throws SQLException {
05110:                updateByte(getColIdxByName(columnName), x);
05111:            }
05112:
05113:            /**
05114:             * Sets the designated column in either the current row or the insert
05115:             * row of this <code>CachedRowSetImpl</code> object with the given
05116:             * <code>short</code> value.
05117:             * <P>
05118:             * This method updates a column value in the current row or the insert
05119:             * row of this rowset, but it does not update the database.
05120:             * If the cursor is on a row in the rowset, the
05121:             * method {@link #updateRow} must be called to update the database.
05122:             * If the cursor is on the insert row, the method {@link #insertRow}
05123:             * must be called, which will insert the new row into both this rowset
05124:             * and the database. Both of these methods must be called before the
05125:             * cursor moves to another row.
05126:             *
05127:             * @param columnName a <code>String</code> object that must match the
05128:             *        SQL name of a column in this rowset, ignoring case
05129:             * @param x the new column value
05130:             * @throws SQLException if (1) the given column name does not match the
05131:             *            name of a column in this rowset, (2) the cursor is not on
05132:             *            one of this rowset's rows or its insert row, or (3) this
05133:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
05134:             */
05135:            public void updateShort(String columnName, short x)
05136:                    throws SQLException {
05137:                updateShort(getColIdxByName(columnName), x);
05138:            }
05139:
05140:            /**
05141:             * Sets the designated column in either the current row or the insert
05142:             * row of this <code>CachedRowSetImpl</code> object with the given
05143:             * <code>int</code> value.
05144:             * <P>
05145:             * This method updates a column value in the current row or the insert
05146:             * row of this rowset, but it does not update the database.
05147:             * If the cursor is on a row in the rowset, the
05148:             * method {@link #updateRow} must be called to update the database.
05149:             * If the cursor is on the insert row, the method {@link #insertRow}
05150:             * must be called, which will insert the new row into both this rowset
05151:             * and the database. Both of these methods must be called before the
05152:             * cursor moves to another row.
05153:             *
05154:             * @param columnName a <code>String</code> object that must match the
05155:             *        SQL name of a column in this rowset, ignoring case
05156:             * @param x the new column value
05157:             * @throws SQLException if (1) the given column name does not match the
05158:             *            name of a column in this rowset, (2) the cursor is not on
05159:             *            one of this rowset's rows or its insert row, or (3) this
05160:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
05161:             */
05162:            public void updateInt(String columnName, int x) throws SQLException {
05163:                updateInt(getColIdxByName(columnName), x);
05164:            }
05165:
05166:            /**
05167:             * Sets the designated column in either the current row or the insert
05168:             * row of this <code>CachedRowSetImpl</code> object with the given
05169:             * <code>long</code> value.
05170:             * <P>
05171:             * This method updates a column value in the current row or the insert
05172:             * row of this rowset, but it does not update the database.
05173:             * If the cursor is on a row in the rowset, the
05174:             * method {@link #updateRow} must be called to update the database.
05175:             * If the cursor is on the insert row, the method {@link #insertRow}
05176:             * must be called, which will insert the new row into both this rowset
05177:             * and the database. Both of these methods must be called before the
05178:             * cursor moves to another row.
05179:             *
05180:             * @param columnName a <code>String</code> object that must match the
05181:             *        SQL name of a column in this rowset, ignoring case
05182:             * @param x the new column value
05183:             * @throws SQLException if (1) the given column name does not match the
05184:             *            name of a column in this rowset, (2) the cursor is not on
05185:             *            one of this rowset's rows or its insert row, or (3) this
05186:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
05187:             */
05188:            public void updateLong(String columnName, long x)
05189:                    throws SQLException {
05190:                updateLong(getColIdxByName(columnName), x);
05191:            }
05192:
05193:            /**
05194:             * Sets the designated column in either the current row or the insert
05195:             * row of this <code>CachedRowSetImpl</code> object with the given
05196:             * <code>float</code> value.
05197:             * <P>
05198:             * This method updates a column value in the current row or the insert
05199:             * row of this rowset, but it does not update the database.
05200:             * If the cursor is on a row in the rowset, the
05201:             * method {@link #updateRow} must be called to update the database.
05202:             * If the cursor is on the insert row, the method {@link #insertRow}
05203:             * must be called, which will insert the new row into both this rowset
05204:             * and the database. Both of these methods must be called before the
05205:             * cursor moves to another row.
05206:             *
05207:             * @param columnName a <code>String</code> object that must match the
05208:             *        SQL name of a column in this rowset, ignoring case
05209:             * @param x the new column value
05210:             * @throws SQLException if (1) the given column name does not match the
05211:             *            name of a column in this rowset, (2) the cursor is not on
05212:             *            one of this rowset's rows or its insert row, or (3) this
05213:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
05214:             */
05215:            public void updateFloat(String columnName, float x)
05216:                    throws SQLException {
05217:                updateFloat(getColIdxByName(columnName), x);
05218:            }
05219:
05220:            /**
05221:             * Sets the designated column in either the current row or the insert
05222:             * row of this <code>CachedRowSetImpl</code> object with the given
05223:             * <code>double</code> value.
05224:             *
05225:             * This method updates a column value in either the current row or
05226:             * the insert row of this rowset, but it does not update the
05227:             * database.  If the cursor is on a row in the rowset, the
05228:             * method {@link #updateRow} must be called to update the database.
05229:             * If the cursor is on the insert row, the method {@link #insertRow}
05230:             * must be called, which will insert the new row into both this rowset
05231:             * and the database. Both of these methods must be called before the
05232:             * cursor moves to another row.
05233:             *
05234:             * @param columnName a <code>String</code> object that must match the
05235:             *        SQL name of a column in this rowset, ignoring case
05236:             * @param x the new column value
05237:             * @throws SQLException if (1) the given column name does not match the
05238:             *            name of a column in this rowset, (2) the cursor is not on
05239:             *            one of this rowset's rows or its insert row, or (3) this
05240:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
05241:             */
05242:            public void updateDouble(String columnName, double x)
05243:                    throws SQLException {
05244:                updateDouble(getColIdxByName(columnName), x);
05245:            }
05246:
05247:            /**
05248:             * Sets the designated column in either the current row or the insert
05249:             * row of this <code>CachedRowSetImpl</code> object with the given
05250:             * <code>java.math.BigDecimal</code> object.
05251:             * <P>
05252:             * This method updates a column value in the current row or the insert
05253:             * row of this rowset, but it does not update the database.
05254:             * If the cursor is on a row in the rowset, the
05255:             * method {@link #updateRow} must be called to update the database.
05256:             * If the cursor is on the insert row, the method {@link #insertRow}
05257:             * must be called, which will insert the new row into both this rowset
05258:             * and the database. Both of these methods must be called before the
05259:             * cursor moves to another row.
05260:             *
05261:             * @param columnName a <code>String</code> object that must match the
05262:             *        SQL name of a column in this rowset, ignoring case
05263:             * @param x the new column value
05264:             * @throws SQLException if (1) the given column name does not match the
05265:             *            name of a column in this rowset, (2) the cursor is not on
05266:             *            one of this rowset's rows or its insert row, or (3) this
05267:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
05268:             */
05269:            public void updateBigDecimal(String columnName, BigDecimal x)
05270:                    throws SQLException {
05271:                updateBigDecimal(getColIdxByName(columnName), x);
05272:            }
05273:
05274:            /**
05275:             * Sets the designated column in either the current row or the insert
05276:             * row of this <code>CachedRowSetImpl</code> object with the given
05277:             * <code>String</code> object.
05278:             *
05279:             * This method updates a column value in either the current row or
05280:             * the insert row of this rowset, but it does not update the
05281:             * database.  If the cursor is on a row in the rowset, the
05282:             * method {@link #updateRow} must be called to update the database.
05283:             * If the cursor is on the insert row, the method {@link #insertRow}
05284:             * must be called, which will insert the new row into both this rowset
05285:             * and the database. Both of these methods must be called before the
05286:             * cursor moves to another row.
05287:             *
05288:             * @param columnName a <code>String</code> object that must match the
05289:             *        SQL name of a column in this rowset, ignoring case
05290:             * @param x the new column value
05291:             * @throws SQLException if (1) the given column name does not match the
05292:             *            name of a column in this rowset, (2) the cursor is not on
05293:             *            one of this rowset's rows or its insert row, or (3) this
05294:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
05295:             */
05296:            public void updateString(String columnName, String x)
05297:                    throws SQLException {
05298:                updateString(getColIdxByName(columnName), x);
05299:            }
05300:
05301:            /**
05302:             * Sets the designated column in either the current row or the insert
05303:             * row of this <code>CachedRowSetImpl</code> object with the given
05304:             * <code>byte</code> array.
05305:             *
05306:             * This method updates a column value in either the current row or
05307:             * the insert row of this rowset, but it does not update the
05308:             * database.  If the cursor is on a row in the rowset, the
05309:             * method {@link #updateRow} must be called to update the database.
05310:             * If the cursor is on the insert row, the method {@link #insertRow}
05311:             * must be called, which will insert the new row into both this rowset
05312:             * and the database. Both of these methods must be called before the
05313:             * cursor moves to another row.
05314:             *
05315:             * @param columnName a <code>String</code> object that must match the
05316:             *        SQL name of a column in this rowset, ignoring case
05317:             * @param x the new column value
05318:             * @throws SQLException if (1) the given column name does not match the
05319:             *            name of a column in this rowset, (2) the cursor is not on
05320:             *            one of this rowset's rows or its insert row, or (3) this
05321:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
05322:             */
05323:            public void updateBytes(String columnName, byte x[])
05324:                    throws SQLException {
05325:                updateBytes(getColIdxByName(columnName), x);
05326:            }
05327:
05328:            /**
05329:             * Sets the designated column in either the current row or the insert
05330:             * row of this <code>CachedRowSetImpl</code> object with the given
05331:             * <code>Date</code> object.
05332:             *
05333:             * This method updates a column value in either the current row or
05334:             * the insert row of this rowset, but it does not update the
05335:             * database.  If the cursor is on a row in the rowset, the
05336:             * method {@link #updateRow} must be called to update the database.
05337:             * If the cursor is on the insert row, the method {@link #insertRow}
05338:             * must be called, which will insert the new row into both this rowset
05339:             * and the database. Both of these methods must be called before the
05340:             * cursor moves to another row.
05341:             *
05342:             * @param columnName a <code>String</code> object that must match the
05343:             *        SQL name of a column in this rowset, ignoring case
05344:             * @param x the new column value
05345:             * @throws SQLException if (1) the given column name does not match the
05346:             *            name of a column in this rowset, (2) the cursor is not on
05347:             *            one of this rowset's rows or its insert row, (3) the type
05348:             *            of the designated column is not an SQL <code>DATE</code> or
05349:             *            <code>TIMESTAMP</code>, or (4) this rowset is
05350:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
05351:             */
05352:            public void updateDate(String columnName, java.sql.Date x)
05353:                    throws SQLException {
05354:                updateDate(getColIdxByName(columnName), x);
05355:            }
05356:
05357:            /**
05358:             * Sets the designated column in either the current row or the insert
05359:             * row of this <code>CachedRowSetImpl</code> object with the given
05360:             * <code>Time</code> object.
05361:             *
05362:             * This method updates a column value in either the current row or
05363:             * the insert row of this rowset, but it does not update the
05364:             * database.  If the cursor is on a row in the rowset, the
05365:             * method {@link #updateRow} must be called to update the database.
05366:             * If the cursor is on the insert row, the method {@link #insertRow}
05367:             * must be called, which will insert the new row into both this rowset
05368:             * and the database. Both of these methods must be called before the
05369:             * cursor moves to another row.
05370:             *
05371:             * @param columnName a <code>String</code> object that must match the
05372:             *        SQL name of a column in this rowset, ignoring case
05373:             * @param x the new column value
05374:             * @throws SQLException if (1) the given column name does not match the
05375:             *            name of a column in this rowset, (2) the cursor is not on
05376:             *            one of this rowset's rows or its insert row, (3) the type
05377:             *            of the designated column is not an SQL <code>TIME</code> or
05378:             *            <code>TIMESTAMP</code>, or (4) this rowset is
05379:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
05380:             */
05381:            public void updateTime(String columnName, java.sql.Time x)
05382:                    throws SQLException {
05383:                updateTime(getColIdxByName(columnName), x);
05384:            }
05385:
05386:            /**
05387:             * Sets the designated column in either the current row or the insert
05388:             * row of this <code>CachedRowSetImpl</code> object with the given
05389:             * <code>Timestamp</code> object.
05390:             *
05391:             * This method updates a column value in either the current row or
05392:             * the insert row of this rowset, but it does not update the
05393:             * database.  If the cursor is on a row in the rowset, the
05394:             * method {@link #updateRow} must be called to update the database.
05395:             * If the cursor is on the insert row, the method {@link #insertRow}
05396:             * must be called, which will insert the new row into both this rowset
05397:             * and the database. Both of these methods must be called before the
05398:             * cursor moves to another row.
05399:             *
05400:             * @param columnName a <code>String</code> object that must match the
05401:             *        SQL name of a column in this rowset, ignoring case
05402:             * @param x the new column value
05403:             * @throws SQLException if the given column index is out of bounds or
05404:             *            the cursor is not on one of this rowset's rows or its
05405:             *            insert row
05406:             * @throws SQLException if (1) the given column name does not match the
05407:             *            name of a column in this rowset, (2) the cursor is not on
05408:             *            one of this rowset's rows or its insert row, (3) the type
05409:             *            of the designated column is not an SQL <code>DATE</code>,
05410:             *            <code>TIME</code>, or <code>TIMESTAMP</code>, or (4) this
05411:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
05412:             */
05413:            public void updateTimestamp(String columnName, java.sql.Timestamp x)
05414:                    throws SQLException {
05415:                updateTimestamp(getColIdxByName(columnName), x);
05416:            }
05417:
05418:            /**
05419:             * Sets the designated column in either the current row or the insert
05420:             * row of this <code>CachedRowSetImpl</code> object with the given
05421:             * ASCII stream value.
05422:             * <P>
05423:             * This method updates a column value in either the current row or
05424:             * the insert row of this rowset, but it does not update the
05425:             * database.  If the cursor is on a row in the rowset, the
05426:             * method {@link #updateRow} must be called to update the database.
05427:             * If the cursor is on the insert row, the method {@link #insertRow}
05428:             * must be called, which will insert the new row into both this rowset
05429:             * and the database. Both of these methods must be called before the
05430:             * cursor moves to another row.
05431:             *
05432:             * @param columnName a <code>String</code> object that must match the
05433:             *        SQL name of a column in this rowset, ignoring case
05434:             * @param x the new column value
05435:             * @param length the number of one-byte ASCII characters in the stream
05436:             */
05437:            public void updateAsciiStream(String columnName,
05438:                    java.io.InputStream x, int length) throws SQLException {
05439:                updateAsciiStream(getColIdxByName(columnName), x, length);
05440:            }
05441:
05442:            /**
05443:             * Sets the designated column in either the current row or the insert
05444:             * row of this <code>CachedRowSetImpl</code> object with the given
05445:             * <code>java.io.InputStream</code> object.
05446:             * <P>
05447:             * This method updates a column value in either the current row or
05448:             * the insert row of this rowset, but it does not update the
05449:             * database.  If the cursor is on a row in the rowset, the
05450:             * method {@link #updateRow} must be called to update the database.
05451:             * If the cursor is on the insert row, the method {@link #insertRow}
05452:             * must be called, which will insert the new row into both this rowset
05453:             * and the database. Both of these methods must be called before the
05454:             * cursor moves to another row.
05455:             *
05456:             * @param columnName a <code>String</code> object that must match the
05457:             *        SQL name of a column in this rowset, ignoring case
05458:             * @param x the new column value; must be a <code>java.io.InputStream</code>
05459:             *          containing <code>BINARY</code>, <code>VARBINARY</code>, or
05460:             *          <code>LONGVARBINARY</code> data
05461:             * @param length the length of the stream in bytes
05462:             * @throws SQLException if (1) the given column name does not match the
05463:             *            name of a column in this rowset, (2) the cursor is not on
05464:             *            one of this rowset's rows or its insert row, (3) the data
05465:             *            in the stream is not binary, or (4) this rowset is
05466:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
05467:             */
05468:            public void updateBinaryStream(String columnName,
05469:                    java.io.InputStream x, int length) throws SQLException {
05470:                updateBinaryStream(getColIdxByName(columnName), x, length);
05471:            }
05472:
05473:            /**
05474:             * Sets the designated column in either the current row or the insert
05475:             * row of this <code>CachedRowSetImpl</code> object with the given
05476:             * <code>java.io.Reader</code> object.
05477:             * <P>
05478:             * This method updates a column value in either the current row or
05479:             * the insert row of this rowset, but it does not update the
05480:             * database.  If the cursor is on a row in the rowset, the
05481:             * method {@link #updateRow} must be called to update the database.
05482:             * If the cursor is on the insert row, the method {@link #insertRow}
05483:             * must be called, which will insert the new row into both this rowset
05484:             * and the database. Both of these methods must be called before the
05485:             * cursor moves to another row.
05486:             *
05487:             * @param columnName a <code>String</code> object that must match the
05488:             *        SQL name of a column in this rowset, ignoring case
05489:             * @param reader the new column value; must be a
05490:             * <code>java.io.Reader</code> containing <code>BINARY</code>,
05491:             * <code>VARBINARY</code>, <code>LONGVARBINARY</code>, <code>CHAR</code>,
05492:             * <code>VARCHAR</code>, or <code>LONGVARCHAR</code> data
05493:             * @param length the length of the stream in characters
05494:             * @throws SQLException if (1) the given column name does not match the
05495:             *            name of a column in this rowset, (2) the cursor is not on
05496:             *            one of this rowset's rows or its insert row, (3) the data
05497:             *            in the stream is not a binary or character type, or (4) this
05498:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
05499:             */
05500:            public void updateCharacterStream(String columnName,
05501:                    java.io.Reader reader, int length) throws SQLException {
05502:                updateCharacterStream(getColIdxByName(columnName), reader,
05503:                        length);
05504:            }
05505:
05506:            /**
05507:             * Sets the designated column in either the current row or the insert
05508:             * row of this <code>CachedRowSetImpl</code> object with the given
05509:             * <code>Object</code> value.  The <code>scale</code> parameter
05510:             * indicates the number of digits to the right of the decimal point
05511:             * and is ignored if the new column value is not a type that will be
05512:             *  mapped to an SQL <code>DECIMAL</code> or <code>NUMERIC</code> value.
05513:             * <P>
05514:             * This method updates a column value in either the current row or
05515:             * the insert row of this rowset, but it does not update the
05516:             * database.  If the cursor is on a row in the rowset, the
05517:             * method {@link #updateRow} must be called to update the database.
05518:             * If the cursor is on the insert row, the method {@link #insertRow}
05519:             * must be called, which will insert the new row into both this rowset
05520:             * and the database. Both of these methods must be called before the
05521:             * cursor moves to another row.
05522:             *
05523:             * @param columnName a <code>String</code> object that must match the
05524:             *        SQL name of a column in this rowset, ignoring case
05525:             * @param x the new column value
05526:             * @param scale the number of digits to the right of the decimal point (for
05527:             *              <code>DECIMAL</code> and <code>NUMERIC</code> types only)
05528:             * @throws SQLException if (1) the given column name does not match the
05529:             *            name of a column in this rowset, (2) the cursor is not on
05530:             *            one of this rowset's rows or its insert row, or (3) this
05531:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
05532:             */
05533:            public void updateObject(String columnName, Object x, int scale)
05534:                    throws SQLException {
05535:                updateObject(getColIdxByName(columnName), x, scale);
05536:            }
05537:
05538:            /**
05539:             * Sets the designated column in either the current row or the insert
05540:             * row of this <code>CachedRowSetImpl</code> object with the given
05541:             * <code>Object</code> value.
05542:             * <P>
05543:             * This method updates a column value in either the current row or
05544:             * the insert row of this rowset, but it does not update the
05545:             * database.  If the cursor is on a row in the rowset, the
05546:             * method {@link #updateRow} must be called to update the database.
05547:             * If the cursor is on the insert row, the method {@link #insertRow}
05548:             * must be called, which will insert the new row into both this rowset
05549:             * and the database. Both of these methods must be called before the
05550:             * cursor moves to another row.
05551:             *
05552:             * @param columnName a <code>String</code> object that must match the
05553:             *        SQL name of a column in this rowset, ignoring case
05554:             * @param x the new column value
05555:             * @throws SQLException if (1) the given column name does not match the
05556:             *            name of a column in this rowset, (2) the cursor is not on
05557:             *            one of this rowset's rows or its insert row, or (3) this
05558:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
05559:             */
05560:            public void updateObject(String columnName, Object x)
05561:                    throws SQLException {
05562:                updateObject(getColIdxByName(columnName), x);
05563:            }
05564:
05565:            /**
05566:             * Inserts the contents of this <code>CachedRowSetImpl</code> object's insert
05567:             * row into this rowset immediately following the current row.
05568:             * If the current row is the
05569:             * position after the last row or before the first row, the new row will
05570:             * be inserted at the end of the rowset.  This method also notifies
05571:             * listeners registered with this rowset that the row has changed.
05572:             * <P>
05573:             * The cursor must be on the insert row when this method is called.
05574:             *
05575:             * @throws SQLException if (1) the cursor is not on the insert row,
05576:             *            (2) one or more of the non-nullable columns in the insert
05577:             *            row has not been given a value, or (3) this rowset is
05578:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
05579:             */
05580:            public void insertRow() throws SQLException {
05581:                int pos;
05582:
05583:                if (onInsertRow == false
05584:                        || insertRow.isCompleteRow(RowSetMD) == false) {
05585:                    throw new SQLException(resBundle.handleGetObject(
05586:                            "cachedrowsetimpl.failedins").toString());
05587:                }
05588:                // Added the setting of parameters that are passed
05589:                // to setXXX methods after an empty CRS Object is
05590:                // created through RowSetMetaData object
05591:                Object[] toInsert = getParams();
05592:
05593:                for (int i = 0; i < toInsert.length; i++) {
05594:                    insertRow.setColumnObject(i + 1, toInsert[i]);
05595:                }
05596:
05597:                Row insRow = new Row(RowSetMD.getColumnCount(), insertRow
05598:                        .getOrigRow());
05599:                insRow.setInserted();
05600:                /*
05601:                 * The new row is inserted into the RowSet
05602:                 * immediately following the current row.
05603:                 *
05604:                 * If we are afterlast then the rows are
05605:                 * inserted at the end.
05606:                 */
05607:                if (currentRow >= numRows || currentRow < 0) {
05608:                    pos = numRows;
05609:                } else {
05610:                    pos = currentRow;
05611:                }
05612:
05613:                rvh.add(pos, insRow);
05614:                ++numRows;
05615:                // notify the listeners that the row changed.
05616:                notifyRowChanged();
05617:            }
05618:
05619:            /**
05620:             * Marks the current row of this <code>CachedRowSetImpl</code> object as
05621:             * updated and notifies listeners registered with this rowset that the
05622:             * row has changed.
05623:             * <P>
05624:             * This method  cannot be called when the cursor is on the insert row, and
05625:             * it should be called before the cursor moves to another row.  If it is
05626:             * called after the cursor moves to another row, this method has no effect,
05627:             * and the updates made before the cursor moved will be lost.
05628:             *
05629:             * @throws SQLException if the cursor is on the insert row or this
05630:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
05631:             */
05632:            public void updateRow() throws SQLException {
05633:                // make sure we aren't on the insert row
05634:                if (onInsertRow == true) {
05635:                    throw new SQLException(resBundle.handleGetObject(
05636:                            "cachedrowsetimpl.updateins").toString());
05637:                }
05638:
05639:                ((Row) getCurrentRow()).setUpdated();
05640:
05641:                // notify the listeners that the row changed.
05642:                notifyRowChanged();
05643:            }
05644:
05645:            /**
05646:             * Deletes the current row from this <code>CachedRowSetImpl</code> object and
05647:             * notifies listeners registered with this rowset that a row has changed.
05648:             * This method cannot be called when the cursor is on the insert row.
05649:             * <P>
05650:             * This method marks the current row as deleted, but it does not delete
05651:             * the row from the underlying data source.  The method
05652:             * <code>acceptChanges</code> must be called to delete the row in
05653:             * the data source.
05654:             *
05655:             * @throws SQLException if (1) this method is called when the cursor
05656:             *            is on the insert row, before the first row, or after the
05657:             *            last row or (2) this rowset is
05658:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
05659:             */
05660:            public void deleteRow() throws SQLException {
05661:                // make sure the cursor is on a valid row
05662:                checkCursor();
05663:
05664:                ((Row) getCurrentRow()).setDeleted();
05665:                ++numDeleted;
05666:
05667:                // notify the listeners that the row changed.
05668:                notifyRowChanged();
05669:            }
05670:
05671:            /**
05672:             * Sets the current row with its original value and marks the row as
05673:             * not updated, thus undoing any changes made to the row since the
05674:             * last call to the methods <code>updateRow</code> or <code>deleteRow</code>.
05675:             * This method should be called only when the cursor is on a row in
05676:             * this rowset.
05677:             *
05678:             * @throws SQLException if the cursor is on the insert row, before the
05679:             *            first row, or after the last row
05680:             */
05681:            public void refreshRow() throws SQLException {
05682:                // make sure we are on a row
05683:                checkCursor();
05684:
05685:                // don't want this to happen...
05686:                if (onInsertRow == true) {
05687:                    throw new SQLException(resBundle.handleGetObject(
05688:                            "cachedrowsetimpl.invalidcp").toString());
05689:                }
05690:
05691:                Row currentRow = (Row) getCurrentRow();
05692:                // just undo any changes made to this row.
05693:                currentRow.clearUpdated();
05694:
05695:            }
05696:
05697:            /**
05698:             * Rolls back any updates made to the current row of this
05699:             * <code>CachedRowSetImpl</code> object and notifies listeners that
05700:             * a row has changed.  To have an effect, this method
05701:             * must be called after an <code>updateXXX</code> method has been
05702:             * called and before the method <code>updateRow</code> has been called.
05703:             * If no updates have been made or the method <code>updateRow</code>
05704:             * has already been called, this method has no effect.
05705:             *
05706:             * @throws SQLException if the cursor is on the insert row, before the
05707:             *            first row, or after the last row
05708:             */
05709:            public void cancelRowUpdates() throws SQLException {
05710:                // make sure we are on a row
05711:                checkCursor();
05712:
05713:                // don't want this to happen...
05714:                if (onInsertRow == true) {
05715:                    throw new SQLException(resBundle.handleGetObject(
05716:                            "cachedrowsetimpl.invalidcp").toString());
05717:                }
05718:
05719:                Row currentRow = (Row) getCurrentRow();
05720:                if (currentRow.getUpdated() == true) {
05721:                    currentRow.clearUpdated();
05722:                    notifyRowChanged();
05723:                }
05724:            }
05725:
05726:            /**
05727:             * Moves the cursor for this <code>CachedRowSetImpl</code> object
05728:             * to the insert row.  The current row in the rowset is remembered
05729:             * while the cursor is on the insert row.
05730:             * <P>
05731:             * The insert row is a special row associated with an updatable
05732:             * rowset.  It is essentially a buffer where a new row may
05733:             * be constructed by calling the appropriate <code>updateXXX</code>
05734:             * methods to assign a value to each column in the row.  A complete
05735:             * row must be constructed; that is, every column that is not nullable
05736:             * must be assigned a value.  In order for the new row to become part
05737:             * of this rowset, the method <code>insertRow</code> must be called
05738:             * before the cursor is moved back to the rowset.
05739:             * <P>
05740:             * Only certain methods may be invoked while the cursor is on the insert
05741:             * row; many methods throw an exception if they are called while the
05742:             * cursor is there.  In addition to the <code>updateXXX</code>
05743:             * and <code>insertRow</code> methods, only the <code>getXXX</code> methods
05744:             * may be called when the cursor is on the insert row.  A <code>getXXX</code>
05745:             * method should be called on a column only after an <code>updateXXX</code>
05746:             * method has been called on that column; otherwise, the value returned is
05747:             * undetermined.
05748:             *
05749:             * @throws SQLException if this <code>CachedRowSetImpl</code> object is
05750:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
05751:             */
05752:            public void moveToInsertRow() throws SQLException {
05753:                if (getConcurrency() == ResultSet.CONCUR_READ_ONLY) {
05754:                    throw new SQLException(resBundle.handleGetObject(
05755:                            "cachedrowsetimpl.movetoins").toString());
05756:                }
05757:                if (insertRow == null) {
05758:                    if (RowSetMD == null)
05759:                        throw new SQLException(resBundle.handleGetObject(
05760:                                "cachedrowsetimpl.movetoins1").toString());
05761:                    int numCols = RowSetMD.getColumnCount();
05762:                    if (numCols > 0) {
05763:                        insertRow = new InsertRow(numCols);
05764:                    } else {
05765:                        throw new SQLException(resBundle.handleGetObject(
05766:                                "cachedrowsetimpl.movetoins2").toString());
05767:                    }
05768:                }
05769:                onInsertRow = true;
05770:                // %%% setCurrentRow called in BaseRow
05771:
05772:                currentRow = cursorPos;
05773:                cursorPos = -1;
05774:
05775:                insertRow.initInsertRow();
05776:            }
05777:
05778:            /**
05779:             * Moves the cursor for this <code>CachedRowSetImpl</code> object to
05780:             * the current row.  The current row is the row the cursor was on
05781:             * when the method <code>moveToInsertRow</code> was called.
05782:             * <P>
05783:             * Calling this method has no effect unless it is called while the
05784:             * cursor is on the insert row.
05785:             *
05786:             * @throws SQLException if an error occurs
05787:             */
05788:            public void moveToCurrentRow() throws SQLException {
05789:                if (onInsertRow == false) {
05790:                    return;
05791:                } else {
05792:                    cursorPos = currentRow;
05793:                    onInsertRow = false;
05794:                }
05795:            }
05796:
05797:            /**
05798:             * Returns <code>null</code>.
05799:             *
05800:             * @return <code>null</code>
05801:             * @throws SQLException if an error occurs
05802:             */
05803:            public Statement getStatement() throws SQLException {
05804:                return null;
05805:            }
05806:
05807:            /**
05808:             * Retrieves the value of the designated column in this
05809:             * <code>CachedRowSetImpl</code> object as an <code>Object</code> in
05810:             * the Java programming language, using the given
05811:             * <code>java.util.Map</code> object to custom map the value if
05812:             * appropriate.
05813:             *
05814:             * @param columnIndex the first column is <code>1</code>, the second
05815:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
05816:             *        and equal to or less than the number of columns in this rowset
05817:             * @param map a <code>java.util.Map</code> object showing the mapping
05818:             *            from SQL type names to classes in the Java programming
05819:             *            language
05820:             * @return an <code>Object</code> representing the SQL value
05821:             * @throws SQLException if the given column index is out of bounds or
05822:             *            the cursor is not on one of this rowset's rows or its
05823:             *            insert row
05824:             */
05825:            public Object getObject(int columnIndex,
05826:                    java.util.Map<String, Class<?>> map) throws SQLException {
05827:                Object value;
05828:
05829:                // sanity check.
05830:                checkIndex(columnIndex);
05831:                // make sure the cursor is on a valid row
05832:                checkCursor();
05833:
05834:                setLastValueNull(false);
05835:                value = getCurrentRow().getColumnObject(columnIndex);
05836:
05837:                // check for SQL NULL
05838:                if (value == null) {
05839:                    setLastValueNull(true);
05840:                    return null;
05841:                }
05842:                if (value instanceof  Struct) {
05843:                    Struct s = (Struct) value;
05844:
05845:                    // look up the class in the map
05846:                    Class c = (Class) map.get(s.getSQLTypeName());
05847:                    if (c != null) {
05848:                        // create new instance of the class
05849:                        SQLData obj = null;
05850:                        try {
05851:                            obj = (SQLData) c.newInstance();
05852:                        } catch (java.lang.InstantiationException ex) {
05853:                            throw new SQLException(MessageFormat.format(
05854:                                    resBundle.handleGetObject(
05855:                                            "cachedrowsetimpl.unableins")
05856:                                            .toString(), ex.getMessage()));
05857:                        } catch (java.lang.IllegalAccessException ex) {
05858:                            throw new SQLException(MessageFormat.format(
05859:                                    resBundle.handleGetObject(
05860:                                            "cachedrowsetimpl.unableins")
05861:                                            .toString(), ex.getMessage()));
05862:                        }
05863:                        // get the attributes from the struct
05864:                        Object attribs[] = s.getAttributes(map);
05865:                        // create the SQLInput "stream"
05866:                        SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
05867:                        // read the values...
05868:                        obj.readSQL(sqlInput, s.getSQLTypeName());
05869:                        return (Object) obj;
05870:                    }
05871:                }
05872:                return value;
05873:            }
05874:
05875:            /**
05876:             * Retrieves the value of the designated column in this
05877:             * <code>CachedRowSetImpl</code> object as a <code>Ref</code> object
05878:             * in the Java programming language.
05879:             *
05880:             * @param columnIndex the first column is <code>1</code>, the second
05881:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
05882:             *        and equal to or less than the number of columns in this rowset
05883:             * @return a <code>Ref</code> object representing an SQL<code> REF</code> value
05884:             * @throws SQLException if (1) the given column index is out of bounds,
05885:             *            (2) the cursor is not on one of this rowset's rows or its
05886:             *            insert row, or (3) the designated column does not store an
05887:             *            SQL <code>REF</code> value
05888:             * @see #getRef(String)
05889:             */
05890:            public Ref getRef(int columnIndex) throws SQLException {
05891:                Ref value;
05892:
05893:                // sanity check.
05894:                checkIndex(columnIndex);
05895:                // make sure the cursor is on a valid row
05896:                checkCursor();
05897:
05898:                if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.REF) {
05899:                    throw new SQLException(resBundle.handleGetObject(
05900:                            "cachedrowsetimpl.dtypemismt").toString());
05901:                }
05902:
05903:                setLastValueNull(false);
05904:                value = (Ref) (getCurrentRow().getColumnObject(columnIndex));
05905:
05906:                // check for SQL NULL
05907:                if (value == null) {
05908:                    setLastValueNull(true);
05909:                    return null;
05910:                }
05911:
05912:                return value;
05913:            }
05914:
05915:            /**
05916:             * Retrieves the value of the designated column in this
05917:             * <code>CachedRowSetImpl</code> object as a <code>Blob</code> object
05918:             * in the Java programming language.
05919:             *
05920:             * @param columnIndex the first column is <code>1</code>, the second
05921:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
05922:             *        and equal to or less than the number of columns in this rowset
05923:             * @return a <code>Blob</code> object representing an SQL <code>BLOB</code> value
05924:             * @throws SQLException if (1) the given column index is out of bounds,
05925:             *            (2) the cursor is not on one of this rowset's rows or its
05926:             *            insert row, or (3) the designated column does not store an
05927:             *            SQL <code>BLOB</code> value
05928:             * @see #getBlob(String)
05929:             */
05930:            public Blob getBlob(int columnIndex) throws SQLException {
05931:                Blob value;
05932:
05933:                // sanity check.
05934:                checkIndex(columnIndex);
05935:                // make sure the cursor is on a valid row
05936:                checkCursor();
05937:
05938:                if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.BLOB) {
05939:                    System.out.println(MessageFormat.format(resBundle
05940:                            .handleGetObject("cachedrowsetimpl.type")
05941:                            .toString(), RowSetMD.getColumnType(columnIndex)));
05942:                    throw new SQLException(resBundle.handleGetObject(
05943:                            "cachedrowsetimpl.dtypemismt").toString());
05944:                }
05945:
05946:                setLastValueNull(false);
05947:                value = (Blob) (getCurrentRow().getColumnObject(columnIndex));
05948:
05949:                // check for SQL NULL
05950:                if (value == null) {
05951:                    setLastValueNull(true);
05952:                    return null;
05953:                }
05954:
05955:                return value;
05956:            }
05957:
05958:            /**
05959:             * Retrieves the value of the designated column in this
05960:             * <code>CachedRowSetImpl</code> object as a <code>Clob</code> object
05961:             * in the Java programming language.
05962:             *
05963:             * @param columnIndex the first column is <code>1</code>, the second
05964:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
05965:             *        and equal to or less than the number of columns in this rowset
05966:             * @return a <code>Clob</code> object representing an SQL <code>CLOB</code> value
05967:             * @throws SQLException if (1) the given column index is out of bounds,
05968:             *            (2) the cursor is not on one of this rowset's rows or its
05969:             *            insert row, or (3) the designated column does not store an
05970:             *            SQL <code>CLOB</code> value
05971:             * @see #getClob(String)
05972:             */
05973:            public Clob getClob(int columnIndex) throws SQLException {
05974:                Clob value;
05975:
05976:                // sanity check.
05977:                checkIndex(columnIndex);
05978:                // make sure the cursor is on a valid row
05979:                checkCursor();
05980:
05981:                if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.CLOB) {
05982:                    System.out.println(MessageFormat.format(resBundle
05983:                            .handleGetObject("cachedrowsetimpl.type")
05984:                            .toString(), RowSetMD.getColumnType(columnIndex)));
05985:                    throw new SQLException(resBundle.handleGetObject(
05986:                            "cachedrowsetimpl.dtypemismt").toString());
05987:                }
05988:
05989:                setLastValueNull(false);
05990:                value = (Clob) (getCurrentRow().getColumnObject(columnIndex));
05991:
05992:                // check for SQL NULL
05993:                if (value == null) {
05994:                    setLastValueNull(true);
05995:                    return null;
05996:                }
05997:
05998:                return value;
05999:            }
06000:
06001:            /**
06002:             * Retrieves the value of the designated column in this
06003:             * <code>CachedRowSetImpl</code> object as an <code>Array</code> object
06004:             * in the Java programming language.
06005:             *
06006:             * @param columnIndex the first column is <code>1</code>, the second
06007:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
06008:             *        and equal to or less than the number of columns in this rowset
06009:             * @return an <code>Array</code> object representing an SQL
06010:             *         <code>ARRAY</code> value
06011:             * @throws SQLException if (1) the given column index is out of bounds,
06012:             *            (2) the cursor is not on one of this rowset's rows or its
06013:             *            insert row, or (3) the designated column does not store an
06014:             *            SQL <code>ARRAY</code> value
06015:             * @see #getArray(String)
06016:             */
06017:            public Array getArray(int columnIndex) throws SQLException {
06018:                java.sql.Array value;
06019:
06020:                // sanity check.
06021:                checkIndex(columnIndex);
06022:                // make sure the cursor is on a valid row
06023:                checkCursor();
06024:
06025:                if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.ARRAY) {
06026:                    throw new SQLException(resBundle.handleGetObject(
06027:                            "cachedrowsetimpl.dtypemismt").toString());
06028:                }
06029:
06030:                setLastValueNull(false);
06031:                value = (java.sql.Array) (getCurrentRow()
06032:                        .getColumnObject(columnIndex));
06033:
06034:                // check for SQL NULL
06035:                if (value == null) {
06036:                    setLastValueNull(true);
06037:                    return null;
06038:                }
06039:
06040:                return value;
06041:            }
06042:
06043:            /**
06044:             * Retrieves the value of the designated column in this
06045:             * <code>CachedRowSetImpl</code> object as an <code>Object</code> in
06046:             * the Java programming language, using the given
06047:             * <code>java.util.Map</code> object to custom map the value if
06048:             * appropriate.
06049:             *
06050:             * @param columnName a <code>String</code> object that must match the
06051:             *        SQL name of a column in this rowset, ignoring case
06052:             * @param map a <code>java.util.Map</code> object showing the mapping
06053:             *        from SQL type names to classes in the Java programming
06054:             *        language
06055:             * @return an <code>Object</code> representing the SQL value
06056:             * @throws SQLException if the given column name is not the name of
06057:             *         a column in this rowset or the cursor is not on one of
06058:             *         this rowset's rows or its insert row
06059:             */
06060:            public Object getObject(String columnName,
06061:                    java.util.Map<String, Class<?>> map) throws SQLException {
06062:                return getObject(getColIdxByName(columnName), map);
06063:            }
06064:
06065:            /**
06066:             * Retrieves the value of the designated column in this
06067:             * <code>CachedRowSetImpl</code> object as a <code>Ref</code> object
06068:             * in the Java programming language.
06069:             *
06070:             * @param colName a <code>String</code> object that must match the
06071:             *        SQL name of a column in this rowset, ignoring case
06072:             * @return a <code>Ref</code> object representing an SQL<code> REF</code> value
06073:             * @throws SQLException  if (1) the given column name is not the name of
06074:             *            a column in this rowset, (2) the cursor is not on one of
06075:             *            this rowset's rows or its insert row, or (3) the column value
06076:             *            is not an SQL <code>REF</code> value
06077:             * @see #getRef(int)
06078:             */
06079:            public Ref getRef(String colName) throws SQLException {
06080:                return getRef(getColIdxByName(colName));
06081:            }
06082:
06083:            /**
06084:             * Retrieves the value of the designated column in this
06085:             * <code>CachedRowSetImpl</code> object as a <code>Blob</code> object
06086:             * in the Java programming language.
06087:             *
06088:             * @param colName a <code>String</code> object that must match the
06089:             *        SQL name of a column in this rowset, ignoring case
06090:             * @return a <code>Blob</code> object representing an SQL <code>BLOB</code> value
06091:             * @throws SQLException if (1) the given column name is not the name of
06092:             *            a column in this rowset, (2) the cursor is not on one of
06093:             *            this rowset's rows or its insert row, or (3) the designated
06094:             *            column does not store an SQL <code>BLOB</code> value
06095:             * @see #getBlob(int)
06096:             */
06097:            public Blob getBlob(String colName) throws SQLException {
06098:                return getBlob(getColIdxByName(colName));
06099:            }
06100:
06101:            /**
06102:             * Retrieves the value of the designated column in this
06103:             * <code>CachedRowSetImpl</code> object as a <code>Clob</code> object
06104:             * in the Java programming language.
06105:             *
06106:             * @param colName a <code>String</code> object that must match the
06107:             *        SQL name of a column in this rowset, ignoring case
06108:             * @return a <code>Clob</code> object representing an SQL
06109:             *         <code>CLOB</code> value
06110:             * @throws SQLException if (1) the given column name is not the name of
06111:             *            a column in this rowset, (2) the cursor is not on one of
06112:             *            this rowset's rows or its insert row, or (3) the designated
06113:             *            column does not store an SQL <code>CLOB</code> value
06114:             * @see #getClob(int)
06115:             */
06116:            public Clob getClob(String colName) throws SQLException {
06117:                return getClob(getColIdxByName(colName));
06118:            }
06119:
06120:            /**
06121:             * Retrieves the value of the designated column in this
06122:             * <code>CachedRowSetImpl</code> object as an <code>Array</code> object
06123:             * in the Java programming langugage.
06124:             *
06125:             * @param colName a <code>String</code> object that must match the
06126:             *        SQL name of a column in this rowset, ignoring case
06127:             * @return an <code>Array</code> object representing an SQL
06128:             *         <code>ARRAY</code> value
06129:             * @throws SQLException if (1) the given column name is not the name of
06130:             *            a column in this rowset, (2) the cursor is not on one of
06131:             *            this rowset's rows or its insert row, or (3) the designated
06132:             *            column does not store an SQL <code>ARRAY</code> value
06133:             * @see #getArray(int)
06134:             */
06135:            public Array getArray(String colName) throws SQLException {
06136:                return getArray(getColIdxByName(colName));
06137:            }
06138:
06139:            /**
06140:             * Retrieves the value of the designated column in the current row
06141:             * of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Date</code>
06142:             * object, using the given <code>Calendar</code> object to construct an
06143:             * appropriate millisecond value for the date.
06144:             *
06145:             * @param columnIndex the first column is <code>1</code>, the second
06146:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
06147:             *        and equal to or less than the number of columns in the rowset
06148:             * @param cal the <code>java.util.Calendar</code> object to use in
06149:             *            constructing the date
06150:             * @return the column value; if the value is SQL <code>NULL</code>,
06151:             *         the result is <code>null</code>
06152:             * @throws SQLException if (1) the given column name is not the name of
06153:             *            a column in this rowset, (2) the cursor is not on one of
06154:             *            this rowset's rows or its insert row, or (3) the designated
06155:             *            column does not store an SQL <code>DATE</code> or
06156:             *            <code>TIMESTAMP</code> value
06157:             */
06158:            public java.sql.Date getDate(int columnIndex, Calendar cal)
06159:                    throws SQLException {
06160:                Object value;
06161:
06162:                // sanity check.
06163:                checkIndex(columnIndex);
06164:                // make sure the cursor is on a valid row
06165:                checkCursor();
06166:
06167:                setLastValueNull(false);
06168:                value = getCurrentRow().getColumnObject(columnIndex);
06169:
06170:                // check for SQL NULL
06171:                if (value == null) {
06172:                    setLastValueNull(true);
06173:                    return null;
06174:                }
06175:
06176:                value = convertTemporal(value, RowSetMD
06177:                        .getColumnType(columnIndex), java.sql.Types.DATE);
06178:
06179:                // create a default calendar
06180:                Calendar defaultCal = Calendar.getInstance();
06181:                // set this Calendar to the time we have
06182:                defaultCal.setTime((java.util.Date) value);
06183:
06184:                /*
06185:                 * Now we can pull the pieces of the date out
06186:                 * of the default calendar and put them into
06187:                 * the user provided calendar
06188:                 */
06189:                cal.set(Calendar.YEAR, defaultCal.get(Calendar.YEAR));
06190:                cal.set(Calendar.MONTH, defaultCal.get(Calendar.MONTH));
06191:                cal.set(Calendar.DAY_OF_MONTH, defaultCal
06192:                        .get(Calendar.DAY_OF_MONTH));
06193:
06194:                /*
06195:                 * This looks a little odd but it is correct -
06196:                 * Calendar.getTime() returns a Date...
06197:                 */
06198:                return new java.sql.Date(cal.getTime().getTime());
06199:            }
06200:
06201:            /**
06202:             * Retrieves the value of the designated column in the current row
06203:             * of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Date</code>
06204:             * object, using the given <code>Calendar</code> object to construct an
06205:             * appropriate millisecond value for the date.
06206:             *
06207:             * @param columnName a <code>String</code> object that must match the
06208:             *        SQL name of a column in this rowset, ignoring case
06209:             * @param cal the <code>java.util.Calendar</code> object to use in
06210:             *            constructing the date
06211:             * @return the column value; if the value is SQL <code>NULL</code>,
06212:             *         the result is <code>null</code>
06213:             * @throws SQLException if (1) the given column name is not the name of
06214:             *            a column in this rowset, (2) the cursor is not on one of
06215:             *            this rowset's rows or its insert row, or (3) the designated
06216:             *            column does not store an SQL <code>DATE</code> or
06217:             *            <code>TIMESTAMP</code> value
06218:             */
06219:            public java.sql.Date getDate(String columnName, Calendar cal)
06220:                    throws SQLException {
06221:                return getDate(getColIdxByName(columnName), cal);
06222:            }
06223:
06224:            /**
06225:             * Retrieves the value of the designated column in the current row
06226:             * of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Time</code>
06227:             * object, using the given <code>Calendar</code> object to construct an
06228:             * appropriate millisecond value for the date.
06229:             *
06230:             * @param columnIndex the first column is <code>1</code>, the second
06231:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
06232:             *        and equal to or less than the number of columns in the rowset
06233:             * @param cal the <code>java.util.Calendar</code> object to use in
06234:             *            constructing the date
06235:             * @return the column value; if the value is SQL <code>NULL</code>,
06236:             *         the result is <code>null</code>
06237:             * @throws SQLException if (1) the given column name is not the name of
06238:             *            a column in this rowset, (2) the cursor is not on one of
06239:             *            this rowset's rows or its insert row, or (3) the designated
06240:             *            column does not store an SQL <code>TIME</code> or
06241:             *            <code>TIMESTAMP</code> value
06242:             */
06243:            public java.sql.Time getTime(int columnIndex, Calendar cal)
06244:                    throws SQLException {
06245:                Object value;
06246:
06247:                // sanity check.
06248:                checkIndex(columnIndex);
06249:                // make sure the cursor is on a valid row
06250:                checkCursor();
06251:
06252:                setLastValueNull(false);
06253:                value = getCurrentRow().getColumnObject(columnIndex);
06254:
06255:                // check for SQL NULL
06256:                if (value == null) {
06257:                    setLastValueNull(true);
06258:                    return null;
06259:                }
06260:
06261:                value = convertTemporal(value, RowSetMD
06262:                        .getColumnType(columnIndex), java.sql.Types.TIME);
06263:
06264:                // create a default calendar
06265:                Calendar defaultCal = Calendar.getInstance();
06266:                // set the time in the default calendar
06267:                defaultCal.setTime((java.util.Date) value);
06268:
06269:                /*
06270:                 * Now we can pull the pieces of the date out
06271:                 * of the default calendar and put them into
06272:                 * the user provided calendar
06273:                 */
06274:                cal.set(Calendar.HOUR_OF_DAY, defaultCal
06275:                        .get(Calendar.HOUR_OF_DAY));
06276:                cal.set(Calendar.MINUTE, defaultCal.get(Calendar.MINUTE));
06277:                cal.set(Calendar.SECOND, defaultCal.get(Calendar.SECOND));
06278:
06279:                return new java.sql.Time(cal.getTime().getTime());
06280:            }
06281:
06282:            /**
06283:             * Retrieves the value of the designated column in the current row
06284:             * of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Time</code>
06285:             * object, using the given <code>Calendar</code> object to construct an
06286:             * appropriate millisecond value for the date.
06287:             *
06288:             * @param columnName a <code>String</code> object that must match the
06289:             *        SQL name of a column in this rowset, ignoring case
06290:             * @param cal the <code>java.util.Calendar</code> object to use in
06291:             *            constructing the date
06292:             * @return the column value; if the value is SQL <code>NULL</code>,
06293:             *         the result is <code>null</code>
06294:             * @throws SQLException if (1) the given column name is not the name of
06295:             *            a column in this rowset, (2) the cursor is not on one of
06296:             *            this rowset's rows or its insert row, or (3) the designated
06297:             *            column does not store an SQL <code>TIME</code> or
06298:             *            <code>TIMESTAMP</code> value
06299:             */
06300:            public java.sql.Time getTime(String columnName, Calendar cal)
06301:                    throws SQLException {
06302:                return getTime(getColIdxByName(columnName), cal);
06303:            }
06304:
06305:            /**
06306:             * Retrieves the value of the designated column in the current row
06307:             * of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Timestamp</code>
06308:             * object, using the given <code>Calendar</code> object to construct an
06309:             * appropriate millisecond value for the date.
06310:             *
06311:             * @param columnIndex the first column is <code>1</code>, the second
06312:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
06313:             *        and equal to or less than the number of columns in the rowset
06314:             * @param cal the <code>java.util.Calendar</code> object to use in
06315:             *            constructing the date
06316:             * @return the column value; if the value is SQL <code>NULL</code>,
06317:             *         the result is <code>null</code>
06318:             * @throws SQLException if (1) the given column name is not the name of
06319:             *            a column in this rowset, (2) the cursor is not on one of
06320:             *            this rowset's rows or its insert row, or (3) the designated
06321:             *            column does not store an SQL <code>TIME</code> or
06322:             *            <code>TIMESTAMP</code> value
06323:             */
06324:            public java.sql.Timestamp getTimestamp(int columnIndex, Calendar cal)
06325:                    throws SQLException {
06326:                Object value;
06327:
06328:                // sanity check.
06329:                checkIndex(columnIndex);
06330:                // make sure the cursor is on a valid row
06331:                checkCursor();
06332:
06333:                setLastValueNull(false);
06334:                value = getCurrentRow().getColumnObject(columnIndex);
06335:
06336:                // check for SQL NULL
06337:                if (value == null) {
06338:                    setLastValueNull(true);
06339:                    return null;
06340:                }
06341:
06342:                value = convertTemporal(value, RowSetMD
06343:                        .getColumnType(columnIndex), java.sql.Types.TIMESTAMP);
06344:
06345:                // create a default calendar
06346:                Calendar defaultCal = Calendar.getInstance();
06347:                // set the time in the default calendar
06348:                defaultCal.setTime((java.util.Date) value);
06349:
06350:                /*
06351:                 * Now we can pull the pieces of the date out
06352:                 * of the default calendar and put them into
06353:                 * the user provided calendar
06354:                 */
06355:                cal.set(Calendar.YEAR, defaultCal.get(Calendar.YEAR));
06356:                cal.set(Calendar.MONTH, defaultCal.get(Calendar.MONTH));
06357:                cal.set(Calendar.DAY_OF_MONTH, defaultCal
06358:                        .get(Calendar.DAY_OF_MONTH));
06359:                cal.set(Calendar.HOUR_OF_DAY, defaultCal
06360:                        .get(Calendar.HOUR_OF_DAY));
06361:                cal.set(Calendar.MINUTE, defaultCal.get(Calendar.MINUTE));
06362:                cal.set(Calendar.SECOND, defaultCal.get(Calendar.SECOND));
06363:
06364:                return new java.sql.Timestamp(cal.getTime().getTime());
06365:            }
06366:
06367:            /**
06368:             * Retrieves the value of the designated column in the current row
06369:             * of this <code>CachedRowSetImpl</code> object as a
06370:             * <code>java.sql.Timestamp</code> object, using the given
06371:             * <code>Calendar</code> object to construct an appropriate
06372:             * millisecond value for the date.
06373:             *
06374:             * @param columnName a <code>String</code> object that must match the
06375:             *        SQL name of a column in this rowset, ignoring case
06376:             * @param cal the <code>java.util.Calendar</code> object to use in
06377:             *            constructing the date
06378:             * @return the column value; if the value is SQL <code>NULL</code>,
06379:             *         the result is <code>null</code>
06380:             * @throws SQLException if (1) the given column name is not the name of
06381:             *            a column in this rowset, (2) the cursor is not on one of
06382:             *            this rowset's rows or its insert row, or (3) the designated
06383:             *            column does not store an SQL <code>DATE</code>,
06384:             *            <code>TIME</code>, or <code>TIMESTAMP</code> value
06385:             */
06386:            public java.sql.Timestamp getTimestamp(String columnName,
06387:                    Calendar cal) throws SQLException {
06388:                return getTimestamp(getColIdxByName(columnName), cal);
06389:            }
06390:
06391:            /*
06392:             * RowSetInternal Interface
06393:             */
06394:
06395:            /**
06396:             * Retrieves the <code>Connection</code> object passed to this
06397:             * <code>CachedRowSetImpl</code> object.  This connection may be
06398:             * used to populate this rowset with data or to write data back
06399:             * to its underlying data source.
06400:             *
06401:             * @return the <code>Connection</code> object passed to this rowset;
06402:             *         may be <code>null</code> if there is no connection
06403:             * @throws SQLException if an error occurs
06404:             */
06405:            public Connection getConnection() throws SQLException {
06406:                return conn;
06407:            }
06408:
06409:            /**
06410:             * Sets the metadata for this <code>CachedRowSetImpl</code> object
06411:             * with the given <code>RowSetMetaData</code> object.
06412:             *
06413:             * @param md a <code>RowSetMetaData</code> object instance containing
06414:             *            metadata about the columsn in the rowset
06415:             * @throws SQLException if invalid meta data is supplied to the
06416:             *            rowset
06417:             */
06418:            public void setMetaData(RowSetMetaData md) throws SQLException {
06419:                RowSetMD = (RowSetMetaDataImpl) md;
06420:            }
06421:
06422:            /**
06423:             * Returns a result set containing the original value of the rowset. The
06424:             * original value is the state of the <code>CachedRowSetImpl</code> after the
06425:             * last population or synchronization (whichever occured most recently) with
06426:             * the data source.
06427:             * <p>
06428:             * The cursor is positioned before the first row in the result set.
06429:             * Only rows contained in the result set returned by <code>getOriginal()</code>
06430:             * are said to have an original value.
06431:             *
06432:             * @return the original result set of the rowset
06433:             * @throws SQLException if an error occurs produce the
06434:             *           <code>ResultSet</code> object
06435:             */
06436:            public ResultSet getOriginal() throws SQLException {
06437:                CachedRowSetImpl crs = new CachedRowSetImpl();
06438:                crs.RowSetMD = RowSetMD;
06439:                crs.numRows = numRows;
06440:                crs.cursorPos = 0;
06441:
06442:                // make sure we don't get someone playing with these
06443:                // %%% is this now necessary ???
06444:                //crs.setReader(null);
06445:                //crs.setWriter(null);
06446:                int colCount = RowSetMD.getColumnCount();
06447:                Row orig;
06448:
06449:                for (Iterator i = rvh.iterator(); i.hasNext();) {
06450:                    orig = new Row(colCount, ((Row) i.next()).getOrigRow());
06451:                    crs.rvh.add(orig);
06452:                }
06453:                return (ResultSet) crs;
06454:            }
06455:
06456:            /**
06457:             * Returns a result set containing the original value of the current
06458:             * row only.
06459:             * The original value is the state of the <code>CachedRowSetImpl</code> after
06460:             * the last population or synchronization (whichever occured most recently)
06461:             * with the data source.
06462:             *
06463:             * @return the original result set of the row
06464:             * @throws SQLException if there is no current row
06465:             * @see #setOriginalRow
06466:             */
06467:            public ResultSet getOriginalRow() throws SQLException {
06468:                CachedRowSetImpl crs = new CachedRowSetImpl();
06469:                crs.RowSetMD = RowSetMD;
06470:                crs.numRows = 1;
06471:                crs.cursorPos = 0;
06472:
06473:                // make sure we don't get someone playing with these
06474:                // %%% is this now necessary ???
06475:                //crs.setReader(null);
06476:                //crs.setWriter(null);
06477:
06478:                Row orig = new Row(RowSetMD.getColumnCount(), getCurrentRow()
06479:                        .getOrigRow());
06480:
06481:                crs.rvh.add(orig);
06482:
06483:                return (ResultSet) crs;
06484:
06485:            }
06486:
06487:            /**
06488:             * Marks the current row in this rowset as being an original row.
06489:             *
06490:             * @throws SQLException if there is no current row
06491:             * @see #getOriginalRow
06492:             */
06493:            public void setOriginalRow() throws SQLException {
06494:                if (onInsertRow == true) {
06495:                    throw new SQLException(resBundle.handleGetObject(
06496:                            "cachedrowsetimpl.invalidop").toString());
06497:                }
06498:
06499:                Row row = (Row) getCurrentRow();
06500:                makeRowOriginal(row);
06501:
06502:                // this can happen if deleted rows are being shown
06503:                if (row.getDeleted() == true) {
06504:                    removeCurrentRow();
06505:                    --numRows;
06506:                }
06507:            }
06508:
06509:            /**
06510:             * Makes the given row of this rowset the original row by clearing any
06511:             * settings that mark the row as having been inserted, deleted, or updated.
06512:             * This method is called internally by the methods
06513:             * <code>setOriginalRow</code>
06514:             * and <code>setOriginal</code>.
06515:             *
06516:             * @param row the row to be made the original row
06517:             */
06518:            private void makeRowOriginal(Row row) {
06519:                if (row.getInserted() == true) {
06520:                    row.clearInserted();
06521:                }
06522:
06523:                if (row.getUpdated() == true) {
06524:                    row.moveCurrentToOrig();
06525:                }
06526:            }
06527:
06528:            /**
06529:             * Marks all rows in this rowset as being original rows. Any updates
06530:             * made to the rows become the original values for the rowset.
06531:             * Calls to the method <code>setOriginal</code> connot be reversed.
06532:             *
06533:             * @throws SQLException if an error occurs
06534:             */
06535:            public void setOriginal() throws SQLException {
06536:                for (Iterator i = rvh.iterator(); i.hasNext();) {
06537:                    Row row = (Row) i.next();
06538:                    makeRowOriginal(row);
06539:                    // remove deleted rows from the collection.
06540:                    if (row.getDeleted() == true) {
06541:                        i.remove();
06542:                        --numRows;
06543:                    }
06544:                }
06545:                numDeleted = 0;
06546:
06547:                // notify any listeners that the rowset has changed
06548:                notifyRowSetChanged();
06549:            }
06550:
06551:            /**
06552:             * Returns an identifier for the object (table) that was used to create this
06553:             * rowset.
06554:             *
06555:             * @return a <code>String</code> object that identifies the table from
06556:             *         which this <code>CachedRowSetImpl</code> object was derived
06557:             * @throws SQLException if an error occurs
06558:             */
06559:            public String getTableName() throws SQLException {
06560:                return tableName;
06561:            }
06562:
06563:            /**
06564:             * Sets the identifier for the table from which this rowset was derived
06565:             * to the given table name.
06566:             *
06567:             * @param tabName a <code>String</code> object that identifies the
06568:             * 		table from which this <code>CachedRowSetImpl</code> object
06569:             * 		was derived
06570:             * @throws SQLException if an error occurs
06571:             */
06572:            public void setTableName(String tabName) throws SQLException {
06573:                if (tabName == null)
06574:                    throw new SQLException(resBundle.handleGetObject(
06575:                            "cachedrowsetimpl.tablename").toString());
06576:                else
06577:                    tableName = new String(tabName);
06578:            }
06579:
06580:            /**
06581:             * Returns the columns that make a key to uniquely identify a
06582:             * row in this <code>CachedRowSetImpl</code> object.
06583:             *
06584:             * @return an array of column numbers that constitutes a primary
06585:             *           key for this rowset. This array should be empty
06586:             *           if no column is representitive of a primary key
06587:             * @throws SQLException if the rowset is empty or no columns
06588:             *           are designated as primary keys
06589:             * @see #setKeyColumns
06590:             */
06591:            public int[] getKeyColumns() throws SQLException {
06592:                return keyCols;
06593:            }
06594:
06595:            /**
06596:             * Sets this <code>CachedRowSetImpl</code> object's
06597:             * <code>keyCols</code> field with the given array of column
06598:             * numbers, which forms a key for uniquely identifying a row
06599:             * in this rowset.
06600:             *
06601:             * @param keys an array of <code>int</code> indicating the
06602:             *        columns that form a primary key for this
06603:             *        <code>CachedRowSetImpl</code> object; every
06604:             *        element in the array must be greater than
06605:             *        <code>0</code> and less than or equal to the number
06606:             *        of columns in this rowset
06607:             * @throws SQLException if any of the numbers in the
06608:             *            given array is not valid for this rowset
06609:             * @see #getKeyColumns
06610:             */
06611:            public void setKeyColumns(int[] keys) throws SQLException {
06612:                int numCols = 0;
06613:                if (RowSetMD != null) {
06614:                    numCols = RowSetMD.getColumnCount();
06615:                    if (keys.length > numCols)
06616:                        throw new SQLException(resBundle.handleGetObject(
06617:                                "cachedrowsetimpl.keycols").toString());
06618:                }
06619:                keyCols = new int[keys.length];
06620:                for (int i = 0; i < keys.length; i++) {
06621:                    if (RowSetMD != null && (keys[i] <= 0 || keys[i] > numCols)) {
06622:                        throw new SQLException(resBundle.handleGetObject(
06623:                                "cachedrowsetimpl.invalidcol").toString()
06624:                                + keys[i]);
06625:                    }
06626:                    keyCols[i] = keys[i];
06627:                }
06628:            }
06629:
06630:            /**
06631:             * Sets the designated column in either the current row or the insert
06632:             * row of this <code>CachedRowSetImpl</code> object with the given
06633:             * <code>Ref</code> value.
06634:             *
06635:             * This method updates a column value in either the current row or
06636:             * the insert row of this rowset, but it does not update the
06637:             * database.  If the cursor is on a row in the rowset, the
06638:             * method {@link #updateRow} must be called to update the database.
06639:             * If the cursor is on the insert row, the method {@link #insertRow}
06640:             * must be called, which will insert the new row into both this rowset
06641:             * and the database. Both of these methods must be called before the
06642:             * cursor moves to another row.
06643:             *
06644:             * @param columnIndex the first column is <code>1</code>, the second
06645:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
06646:             *        and equal to or less than the number of columns in this rowset
06647:             * @param ref the new column <code>java.sql.Ref</code> value
06648:             * @throws SQLException if (1) the given column index is out of bounds,
06649:             *        (2) the cursor is not on one of this rowset's rows or its
06650:             *        insert row, or (3) this rowset is
06651:             *        <code>ResultSet.CONCUR_READ_ONLY</code>
06652:             */
06653:            public void updateRef(int columnIndex, java.sql.Ref ref)
06654:                    throws SQLException {
06655:                // sanity check.
06656:                checkIndex(columnIndex);
06657:                // make sure the cursor is on a valid row
06658:                checkCursor();
06659:
06660:                // SerialClob will help in getting the byte array and storing it.
06661:                // We need to be checking DatabaseMetaData.locatorsUpdatorCopy()
06662:                // or through RowSetMetaData.locatorsUpdatorCopy()
06663:                getCurrentRow()
06664:                        .setColumnObject(columnIndex, new SerialRef(ref));
06665:            }
06666:
06667:            /**
06668:             * Sets the designated column in either the current row or the insert
06669:             * row of this <code>CachedRowSetImpl</code> object with the given
06670:             * <code>double</code> value.
06671:             *
06672:             * This method updates a column value in either the current row or
06673:             * the insert row of this rowset, but it does not update the
06674:             * database.  If the cursor is on a row in the rowset, the
06675:             * method {@link #updateRow} must be called to update the database.
06676:             * If the cursor is on the insert row, the method {@link #insertRow}
06677:             * must be called, which will insert the new row into both this rowset
06678:             * and the database. Both of these methods must be called before the
06679:             * cursor moves to another row.
06680:             *
06681:             * @param columnName a <code>String</code> object that must match the
06682:             *        SQL name of a column in this rowset, ignoring case
06683:             * @param ref the new column <code>java.sql.Ref</code> value
06684:             * @throws SQLException if (1) the given column name does not match the
06685:             *        name of a column in this rowset, (2) the cursor is not on
06686:             *        one of this rowset's rows or its insert row, or (3) this
06687:             *        rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
06688:             */
06689:            public void updateRef(String columnName, java.sql.Ref ref)
06690:                    throws SQLException {
06691:                updateRef(getColIdxByName(columnName), ref);
06692:            }
06693:
06694:            /**
06695:             * Sets the designated column in either the current row or the insert
06696:             * row of this <code>CachedRowSetImpl</code> object with the given
06697:             * <code>double</code> value.
06698:             *
06699:             * This method updates a column value in either the current row or
06700:             * the insert row of this rowset, but it does not update the
06701:             * database.  If the cursor is on a row in the rowset, the
06702:             * method {@link #updateRow} must be called to update the database.
06703:             * If the cursor is on the insert row, the method {@link #insertRow}
06704:             * must be called, which will insert the new row into both this rowset
06705:             * and the database. Both of these methods must be called before the
06706:             * cursor moves to another row.
06707:             *
06708:             * @param columnIndex the first column is <code>1</code>, the second
06709:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
06710:             *        and equal to or less than the number of columns in this rowset
06711:             * @param c the new column <code>Clob</code> value
06712:             * @throws SQLException if (1) the given column index is out of bounds,
06713:             *        (2) the cursor is not on one of this rowset's rows or its
06714:             *        insert row, or (3) this rowset is
06715:             *        <code>ResultSet.CONCUR_READ_ONLY</code>
06716:             */
06717:            public void updateClob(int columnIndex, Clob c) throws SQLException {
06718:                // sanity check.
06719:                checkIndex(columnIndex);
06720:                // make sure the cursor is on a valid row
06721:                checkCursor();
06722:
06723:                // SerialClob will help in getting the byte array and storing it.
06724:                // We need to be checking DatabaseMetaData.locatorsUpdatorCopy()
06725:                // or through RowSetMetaData.locatorsUpdatorCopy()
06726:
06727:                if (dbmslocatorsUpdateCopy) {
06728:                    getCurrentRow().setColumnObject(columnIndex,
06729:                            new SerialClob(c));
06730:                } else {
06731:                    throw new SQLException(resBundle.handleGetObject(
06732:                            "cachedrowsetimpl.opnotsupp").toString());
06733:                }
06734:            }
06735:
06736:            /**
06737:             * Sets the designated column in either the current row or the insert
06738:             * row of this <code>CachedRowSetImpl</code> object with the given
06739:             * <code>double</code> value.
06740:             *
06741:             * This method updates a column value in either the current row or
06742:             * the insert row of this rowset, but it does not update the
06743:             * database.  If the cursor is on a row in the rowset, the
06744:             * method {@link #updateRow} must be called to update the database.
06745:             * If the cursor is on the insert row, the method {@link #insertRow}
06746:             * must be called, which will insert the new row into both this rowset
06747:             * and the database. Both of these methods must be called before the
06748:             * cursor moves to another row.
06749:             *
06750:             * @param columnName a <code>String</code> object that must match the
06751:             *        SQL name of a column in this rowset, ignoring case
06752:             * @param c the new column <code>Clob</code> value
06753:             * @throws SQLException if (1) the given column name does not match the
06754:             *            name of a column in this rowset, (2) the cursor is not on
06755:             *            one of this rowset's rows or its insert row, or (3) this
06756:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
06757:             */
06758:            public void updateClob(String columnName, Clob c)
06759:                    throws SQLException {
06760:                updateClob(getColIdxByName(columnName), c);
06761:            }
06762:
06763:            /**
06764:             * Sets the designated column in either the current row or the insert
06765:             * row of this <code>CachedRowSetImpl</code> object with the given
06766:             * <code>java.sql.Blob</code> value.
06767:             *
06768:             * This method updates a column value in either the current row or
06769:             * the insert row of this rowset, but it does not update the
06770:             * database.  If the cursor is on a row in the rowset, the
06771:             * method {@link #updateRow} must be called to update the database.
06772:             * If the cursor is on the insert row, the method {@link #insertRow}
06773:             * must be called, which will insert the new row into both this rowset
06774:             * and the database. Both of these methods must be called before the
06775:             * cursor moves to another row.
06776:             *
06777:             * @param columnIndex the first column is <code>1</code>, the second
06778:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
06779:             *        and equal to or less than the number of columns in this rowset
06780:             * @param b the new column <code>Blob</code> value
06781:             * @throws SQLException if (1) the given column index is out of bounds,
06782:             *            (2) the cursor is not on one of this rowset's rows or its
06783:             *            insert row, or (3) this rowset is
06784:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
06785:             */
06786:            public void updateBlob(int columnIndex, Blob b) throws SQLException {
06787:                // sanity check.
06788:                checkIndex(columnIndex);
06789:                // make sure the cursor is on a valid row
06790:                checkCursor();
06791:
06792:                // SerialBlob will help in getting the byte array and storing it.
06793:                // We need to be checking DatabaseMetaData.locatorsUpdatorCopy()
06794:                // or through RowSetMetaData.locatorsUpdatorCopy()    
06795:
06796:                if (dbmslocatorsUpdateCopy) {
06797:                    getCurrentRow().setColumnObject(columnIndex,
06798:                            new SerialBlob(b));
06799:                } else {
06800:                    throw new SQLException(resBundle.handleGetObject(
06801:                            "cachedrowsetimpl.opnotsupp").toString());
06802:                }
06803:            }
06804:
06805:            /**
06806:             * Sets the designated column in either the current row or the insert
06807:             * row of this <code>CachedRowSetImpl</code> object with the given
06808:             * <code>java.sql.Blob </code> value.
06809:             *
06810:             * This method updates a column value in either the current row or
06811:             * the insert row of this rowset, but it does not update the
06812:             * database.  If the cursor is on a row in the rowset, the
06813:             * method {@link #updateRow} must be called to update the database.
06814:             * If the cursor is on the insert row, the method {@link #insertRow}
06815:             * must be called, which will insert the new row into both this rowset
06816:             * and the database. Both of these methods must be called before the
06817:             * cursor moves to another row.
06818:             *
06819:             * @param columnName a <code>String</code> object that must match the
06820:             *        SQL name of a column in this rowset, ignoring case
06821:             * @param b the new column <code>Blob</code> value
06822:             * @throws SQLException if (1) the given column name does not match the
06823:             *            name of a column in this rowset, (2) the cursor is not on
06824:             *            one of this rowset's rows or its insert row, or (3) this
06825:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
06826:             */
06827:            public void updateBlob(String columnName, Blob b)
06828:                    throws SQLException {
06829:                updateBlob(getColIdxByName(columnName), b);
06830:            }
06831:
06832:            /**
06833:             * Sets the designated column in either the current row or the insert
06834:             * row of this <code>CachedRowSetImpl</code> object with the given
06835:             * <code>java.sql.Array</code> values.
06836:             *
06837:             * This method updates a column value in either the current row or
06838:             * the insert row of this rowset, but it does not update the
06839:             * database.  If the cursor is on a row in the rowset, the
06840:             * method {@link #updateRow} must be called to update the database.
06841:             * If the cursor is on the insert row, the method {@link #insertRow}
06842:             * must be called, which will insert the new row into both this rowset
06843:             * and the database. Both of these methods must be called before the
06844:             * cursor moves to another row.
06845:             *
06846:             * @param columnIndex the first column is <code>1</code>, the second
06847:             *        is <code>2</code>, and so on; must be <code>1</code> or larger
06848:             *        and equal to or less than the number of columns in this rowset
06849:             * @param a the new column <code>Array</code> value
06850:             * @throws SQLException if (1) the given column index is out of bounds,
06851:             *            (2) the cursor is not on one of this rowset's rows or its
06852:             *            insert row, or (3) this rowset is
06853:             *            <code>ResultSet.CONCUR_READ_ONLY</code>
06854:             */
06855:            public void updateArray(int columnIndex, Array a)
06856:                    throws SQLException {
06857:                // sanity check.
06858:                checkIndex(columnIndex);
06859:                // make sure the cursor is on a valid row
06860:                checkCursor();
06861:
06862:                // SerialArray will help in getting the byte array and storing it.
06863:                // We need to be checking DatabaseMetaData.locatorsUpdatorCopy()
06864:                // or through RowSetMetaData.locatorsUpdatorCopy()
06865:                getCurrentRow()
06866:                        .setColumnObject(columnIndex, new SerialArray(a));
06867:            }
06868:
06869:            /**
06870:             * Sets the designated column in either the current row or the insert
06871:             * row of this <code>CachedRowSetImpl</code> object with the given
06872:             * <code>java.sql.Array</code> value.
06873:             *
06874:             * This method updates a column value in either the current row or
06875:             * the insert row of this rowset, but it does not update the
06876:             * database.  If the cursor is on a row in the rowset, the
06877:             * method {@link #updateRow} must be called to update the database.
06878:             * If the cursor is on the insert row, the method {@link #insertRow}
06879:             * must be called, which will insert the new row into both this rowset
06880:             * and the database. Both of these methods must be called before the
06881:             * cursor moves to another row.
06882:             *
06883:             * @param columnName a <code>String</code> object that must match the
06884:             *        SQL name of a column in this rowset, ignoring case
06885:             * @param a the new column <code>Array</code> value
06886:             * @throws SQLException if (1) the given column name does not match the
06887:             *            name of a column in this rowset, (2) the cursor is not on
06888:             *            one of this rowset's rows or its insert row, or (3) this
06889:             *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
06890:             */
06891:            public void updateArray(String columnName, Array a)
06892:                    throws SQLException {
06893:                updateArray(getColIdxByName(columnName), a);
06894:            }
06895:
06896:            /**
06897:             * Retrieves the value of the designated column in this
06898:             * <code>CachedRowSetImpl</code> object as a <code>java.net.URL</code> object
06899:             * in the Java programming language.
06900:             *
06901:             * @return a java.net.URL object containing the resource reference described by
06902:             * the URL
06903:             * @throws SQLException if (1) the given column index is out of bounds,
06904:             * (2) the cursor is not on one of this rowset's rows or its
06905:             * insert row, or (3) the designated column does not store an
06906:             * SQL <code>DATALINK</code> value.
06907:             * @see #getURL(String)
06908:             */
06909:            public java.net.URL getURL(int columnIndex) throws SQLException {
06910:                //throw new SQLException("Operation not supported");
06911:
06912:                java.net.URL value;
06913:
06914:                // sanity check.
06915:                checkIndex(columnIndex);
06916:                // make sure the cursor is on a valid row
06917:                checkCursor();
06918:
06919:                if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.DATALINK) {
06920:                    throw new SQLException(resBundle.handleGetObject(
06921:                            "cachedrowsetimpl.dtypemismt").toString());
06922:                }
06923:
06924:                setLastValueNull(false);
06925:                value = (java.net.URL) (getCurrentRow()
06926:                        .getColumnObject(columnIndex));
06927:
06928:                // check for SQL NULL
06929:                if (value == null) {
06930:                    setLastValueNull(true);
06931:                    return null;
06932:                }
06933:
06934:                return value;
06935:            }
06936:
06937:            /**
06938:             * Retrieves the value of the designated column in this
06939:             * <code>CachedRowSetImpl</code> object as a <code>java.net.URL</code> object
06940:             * in the Java programming language.
06941:             *
06942:             * @return a java.net.URL object containing the resource reference described by
06943:             * the URL
06944:             * @throws SQLException if (1) the given column name not the name of a column
06945:             * in this rowset, or
06946:             * (2) the cursor is not on one of this rowset's rows or its
06947:             * insert row, or (3) the designated column does not store an
06948:             * SQL <code>DATALINK</code> value.
06949:             * @see #getURL(int)
06950:             */
06951:            public java.net.URL getURL(String columnName) throws SQLException {
06952:                return getURL(getColIdxByName(columnName));
06953:
06954:            }
06955:
06956:            /**
06957:             * The first warning reported by calls on this <code>CachedRowSetImpl</code>
06958:             * object is returned. Subsequent <code>CachedRowSetImpl</code> warnings will
06959:             * be chained to this <code>SQLWarning</code>. All <code>RowSetWarnings</code>
06960:             * warnings are generated in the disconnected environment and remain a
06961:             * seperate warning chain to that provided by the <code>getWarnings</code>
06962:             * method.
06963:             *
06964:             * <P>The warning chain is automatically cleared each time a new
06965:             * row is read.
06966:             *
06967:             * <P><B>Note:</B> This warning chain only covers warnings caused
06968:             * by <code>CachedRowSet</code> (and their child interface)
06969:             * methods. All <code>SQLWarnings</code> can be obtained using the
06970:             * <code>getWarnings</code> method which tracks warnings generated
06971:             * by the underlying JDBC driver.
06972:             * @return the first SQLWarning or null
06973:             *
06974:             */
06975:            public RowSetWarning getRowSetWarnings() {
06976:                try {
06977:                    notifyCursorMoved();
06978:                } catch (SQLException e) {
06979:                } // mask exception
06980:                return rowsetWarning;
06981:            }
06982:
06983:            /**
06984:             * The function tries to isolate the tablename when only setCommand
06985:             * is set and not setTablename is called provided there is only one table
06986:             * name in the query else just leaves the setting of table name as such.
06987:             * If setTablename is set later it will over ride this table name
06988:             * value so retrieved.
06989:             *
06990:             * @return the tablename if only one table in query else return ""
06991:             */
06992:            private String buildTableName(String command) throws SQLException {
06993:
06994:                // If we have a query from one table,
06995:                // we set the table name implicitly
06996:                // else user has to explicitly set the table name.
06997:
06998:                int indexFrom, indexComma;
06999:                String strTablename = "";
07000:                command = command.trim();
07001:
07002:                // Query can be a select, insert or  update
07003:
07004:                if (command.toLowerCase().startsWith("select")) {
07005:                    // look for "from" keyword, after that look for a
07006:                    // comma after from. If comma is there don't set
07007:                    // table name else isolate table name.
07008:
07009:                    indexFrom = command.toLowerCase().indexOf("from");
07010:                    indexComma = command.indexOf(",", indexFrom);
07011:
07012:                    if (indexComma == -1) {
07013:                        // implies only one table
07014:                        strTablename = (command.substring(indexFrom
07015:                                + "from".length(), command.length())).trim();
07016:
07017:                        String tabName = strTablename;
07018:
07019:                        int idxWhere = tabName.toLowerCase().indexOf("where");
07020:
07021:                        /**
07022:                         * Adding the addtional check for conditions following the table name.
07023:                         * If a condition is found truncate it.
07024:                         **/
07025:
07026:                        if (idxWhere != -1) {
07027:                            tabName = tabName.substring(0, idxWhere).trim();
07028:                        }
07029:
07030:                        strTablename = tabName;
07031:
07032:                    } else {
07033:                        //strTablename="";
07034:                    }
07035:
07036:                } else if (command.toLowerCase().startsWith("insert")) {
07037:                    //strTablename="";
07038:                } else if (command.toLowerCase().startsWith("update")) {
07039:                    //strTablename="";
07040:                }
07041:                return strTablename;
07042:            }
07043:
07044:            /**
07045:             * Commits all changes performed by the <code>acceptChanges()</code>
07046:             * methods
07047:             *
07048:             * @see java.sql.Connection#commit
07049:             */
07050:            public void commit() throws SQLException {
07051:                conn.commit();
07052:            }
07053:
07054:            /**
07055:             * Rolls back all changes performed by the <code>acceptChanges()</code>
07056:             * methods
07057:             *
07058:             * @see java.sql.Connection#rollback
07059:             */
07060:            public void rollback() throws SQLException {
07061:                conn.rollback();
07062:            }
07063:
07064:            /**
07065:             * Rolls back all changes performed by the <code>acceptChanges()</code>
07066:             * to the last <code>Savepoint</code> transaction marker.
07067:             *
07068:             * @see java.sql.Connection#rollback(Savepoint)
07069:             */
07070:            public void rollback(Savepoint s) throws SQLException {
07071:                conn.rollback(s);
07072:            }
07073:
07074:            /**
07075:             * Unsets the designated parameter to the given int array.
07076:             * This was set using <code>setMatchColumn</code>
07077:             * as the column which will form the basis of the join.
07078:             * <P>
07079:             * The parameter value unset by this method should be same
07080:             * as was set.
07081:             *
07082:             * @param columnIdxes the index into this rowset
07083:             *        object's internal representation of parameter values
07084:             * @throws SQLException if an error occurs or the
07085:             *  parameter index is out of bounds or if the columnIdx is
07086:             *  not the same as set using <code>setMatchColumn(int [])</code>
07087:             */
07088:            public void unsetMatchColumn(int[] columnIdxes) throws SQLException {
07089:
07090:                int i_val;
07091:                for (int j = 0; j < columnIdxes.length; j++) {
07092:                    i_val = (Integer.parseInt(iMatchColumns.get(j).toString()));
07093:                    if (columnIdxes[j] != i_val) {
07094:                        throw new SQLException(resBundle.handleGetObject(
07095:                                "cachedrowsetimpl.matchcols").toString());
07096:                    }
07097:                }
07098:
07099:                for (int i = 0; i < columnIdxes.length; i++) {
07100:                    iMatchColumns.set(i, new Integer(-1));
07101:                }
07102:            }
07103:
07104:            /**
07105:             * Unsets the designated parameter to the given String array.
07106:             * This was set using <code>setMatchColumn</code>
07107:             * as the column which will form the basis of the join.
07108:             * <P>
07109:             * The parameter value unset by this method should be same
07110:             * as was set.
07111:             *
07112:             * @param columnIdxes the index into this rowset
07113:             *        object's internal representation of parameter values
07114:             * @throws SQLException if an error occurs or the
07115:             *  parameter index is out of bounds or if the columnName is
07116:             *  not the same as set using <code>setMatchColumn(String [])</code>
07117:             */
07118:            public void unsetMatchColumn(String[] columnIdxes)
07119:                    throws SQLException {
07120:
07121:                for (int j = 0; j < columnIdxes.length; j++) {
07122:                    if (!columnIdxes[j].equals(strMatchColumns.get(j))) {
07123:                        throw new SQLException(resBundle.handleGetObject(
07124:                                "cachedrowsetimpl.matchcols").toString());
07125:                    }
07126:                }
07127:
07128:                for (int i = 0; i < columnIdxes.length; i++) {
07129:                    strMatchColumns.set(i, null);
07130:                }
07131:            }
07132:
07133:            /**
07134:             * Retrieves the column name as <code>String</code> array 
07135:             * that was set using <code>setMatchColumn(String [])</code>
07136:             * for this rowset.
07137:             *
07138:             * @return a <code>String</code> array object that contains the column names
07139:             *         for the rowset which has this the match columns
07140:             *
07141:             * @throws SQLException if an error occurs or column name is not set
07142:             */
07143:            public String[] getMatchColumnNames() throws SQLException {
07144:
07145:                String[] str_temp = new String[strMatchColumns.size()];
07146:
07147:                if (strMatchColumns.get(0) == null) {
07148:                    throw new SQLException(resBundle.handleGetObject(
07149:                            "cachedrowsetimpl.setmatchcols").toString());
07150:                }
07151:
07152:                strMatchColumns.copyInto(str_temp);
07153:                return str_temp;
07154:            }
07155:
07156:            /**
07157:             * Retrieves the column id as <code>int</code> array that was set using
07158:             * <code>setMatchColumn(int [])</code> for this rowset.
07159:             *
07160:             * @return a <code>int</code> array object that contains the column ids
07161:             *         for the rowset which has this as the match columns.
07162:             *
07163:             * @throws SQLException if an error occurs or column index is not set
07164:             */
07165:            public int[] getMatchColumnIndexes() throws SQLException {
07166:
07167:                Integer[] int_temp = new Integer[iMatchColumns.size()];
07168:                int[] i_temp = new int[iMatchColumns.size()];
07169:                int i_val;
07170:
07171:                i_val = ((Integer) iMatchColumns.get(0)).intValue();
07172:
07173:                if (i_val == -1) {
07174:                    throw new SQLException(resBundle.handleGetObject(
07175:                            "cachedrowsetimpl.setmatchcols").toString());
07176:                }
07177:
07178:                iMatchColumns.copyInto(int_temp);
07179:
07180:                for (int i = 0; i < int_temp.length; i++) {
07181:                    i_temp[i] = (int_temp[i]).intValue();
07182:                }
07183:
07184:                return i_temp;
07185:            }
07186:
07187:            /**
07188:             * Sets the designated parameter to the given int array.
07189:             * This forms the basis of the join for the
07190:             * <code>JoinRowSet</code> as the column which will form the basis of the
07191:             * join.
07192:             * <P>
07193:             * The parameter value set by this method is stored internally and
07194:             * will be supplied as the appropriate parameter in this rowset's
07195:             * command when the method <code>getMatchColumnIndexes</code> is called.
07196:             *
07197:             * @param columnIdxes the indexes into this rowset
07198:             *        object's internal representation of parameter values; the
07199:             *        first parameter is 0, the second is 1, and so on; must be
07200:             *        <code>0</code> or greater
07201:             * @throws SQLException if an error occurs or the
07202:             *                         parameter index is out of bounds
07203:             */
07204:            public void setMatchColumn(int[] columnIdxes) throws SQLException {
07205:
07206:                for (int j = 0; j < columnIdxes.length; j++) {
07207:                    if (columnIdxes[j] < 0) {
07208:                        throw new SQLException(resBundle.handleGetObject(
07209:                                "cachedrowsetimpl.matchcols1").toString());
07210:                    }
07211:                }
07212:                for (int i = 0; i < columnIdxes.length; i++) {
07213:                    iMatchColumns.add(i, new Integer(columnIdxes[i]));
07214:                }
07215:            }
07216:
07217:            /**
07218:             * Sets the designated parameter to the given String array.
07219:             *  This forms the basis of the join for the
07220:             * <code>JoinRowSet</code> as the column which will form the basis of the
07221:             * join.
07222:             * <P>
07223:             * The parameter value set by this method is stored internally and
07224:             * will be supplied as the appropriate parameter in this rowset's
07225:             * command when the method <code>getMatchColumn</code> is called.
07226:             *
07227:             * @param columnNames the name of the column into this rowset
07228:             *        object's internal representation of parameter values
07229:             * @throws SQLException if an error occurs or the
07230:             *  parameter index is out of bounds
07231:             */
07232:            public void setMatchColumn(String[] columnNames)
07233:                    throws SQLException {
07234:
07235:                for (int j = 0; j < columnNames.length; j++) {
07236:                    if (columnNames[j] == null || columnNames[j].equals("")) {
07237:                        throw new SQLException(resBundle.handleGetObject(
07238:                                "cachedrowsetimpl.matchcols2").toString());
07239:                    }
07240:                }
07241:                for (int i = 0; i < columnNames.length; i++) {
07242:                    strMatchColumns.add(i, columnNames[i]);
07243:                }
07244:            }
07245:
07246:            /**
07247:             * Sets the designated parameter to the given <code>int</code>
07248:             * object.  This forms the basis of the join for the
07249:             * <code>JoinRowSet</code> as the column which will form the basis of the
07250:             * join.
07251:             * <P>
07252:             * The parameter value set by this method is stored internally and
07253:             * will be supplied as the appropriate parameter in this rowset's
07254:             * command when the method <code>getMatchColumn</code> is called.
07255:             *
07256:             * @param columnIdx the index into this rowset
07257:             *        object's internal representation of parameter values; the
07258:             *        first parameter is 0, the second is 1, and so on; must be
07259:             *        <code>0</code> or greater
07260:             * @throws SQLException if an error occurs or the
07261:             *                         parameter index is out of bounds
07262:             */
07263:            public void setMatchColumn(int columnIdx) throws SQLException {
07264:                // validate, if col is ok to be set
07265:                if (columnIdx < 0) {
07266:                    throw new SQLException(resBundle.handleGetObject(
07267:                            "cachedrowsetimpl.matchcols1").toString());
07268:                } else {
07269:                    // set iMatchColumn
07270:                    iMatchColumns.set(0, new Integer(columnIdx));
07271:                    //strMatchColumn = null;
07272:                }
07273:            }
07274:
07275:            /**
07276:             * Sets the designated parameter to the given <code>String</code>
07277:             * object.  This forms the basis of the join for the
07278:             * <code>JoinRowSet</code> as the column which will form the basis of the
07279:             * join.
07280:             * <P>
07281:             * The parameter value set by this method is stored internally and
07282:             * will be supplied as the appropriate parameter in this rowset's
07283:             * command when the method <code>getMatchColumn</code> is called.
07284:             *
07285:             * @param columnName the name of the column into this rowset
07286:             *        object's internal representation of parameter values
07287:             * @throws SQLException if an error occurs or the
07288:             *  parameter index is out of bounds
07289:             */
07290:            public void setMatchColumn(String columnName) throws SQLException {
07291:                // validate, if col is ok to be set
07292:                if (columnName.equals(null)
07293:                        || ((columnName = columnName.trim()) == "")) {
07294:                    throw new SQLException(resBundle.handleGetObject(
07295:                            "cachedrowsetimpl.matchcols2").toString());
07296:                } else {
07297:                    // set strMatchColumn
07298:                    strMatchColumns.set(0, columnName);
07299:                    //iMatchColumn = -1;
07300:                }
07301:            }
07302:
07303:            /**
07304:             * Unsets the designated parameter to the given <code>int</code>
07305:             * object.  This was set using <code>setMatchColumn</code>
07306:             * as the column which will form the basis of the join.
07307:             * <P>
07308:             * The parameter value unset by this method should be same
07309:             * as was set.
07310:             *
07311:             * @param columnIdx the index into this rowset
07312:             *        object's internal representation of parameter values
07313:             * @throws SQLException if an error occurs or the
07314:             *  parameter index is out of bounds or if the columnIdx is
07315:             *  not the same as set using <code>setMatchColumn(int)</code>
07316:             */
07317:            public void unsetMatchColumn(int columnIdx) throws SQLException {
07318:                // check if we are unsetting the SAME column
07319:                if (!iMatchColumns.get(0).equals(new Integer(columnIdx))) {
07320:                    throw new SQLException(resBundle.handleGetObject(
07321:                            "cachedrowsetimpl.unsetmatch").toString());
07322:                } else if (strMatchColumns.get(0) != null) {
07323:                    throw new SQLException(resBundle.handleGetObject(
07324:                            "cachedrowsetimpl.unsetmatch1").toString());
07325:                } else {
07326:                    // that is, we are unsetting it.
07327:                    iMatchColumns.set(0, new Integer(-1));
07328:                }
07329:            }
07330:
07331:            /**
07332:             * Unsets the designated parameter to the given <code>String</code>
07333:             * object.  This was set using <code>setMatchColumn</code>
07334:             * as the column which will form the basis of the join.
07335:             * <P>
07336:             * The parameter value unset by this method should be same
07337:             * as was set.
07338:             *
07339:             * @param columnName the index into this rowset
07340:             *        object's internal representation of parameter values
07341:             * @throws SQLException if an error occurs or the
07342:             *  parameter index is out of bounds or if the columnName is
07343:             *  not the same as set using <code>setMatchColumn(String)</code>
07344:             */
07345:            public void unsetMatchColumn(String columnName) throws SQLException {
07346:                // check if we are unsetting the same column
07347:                columnName = columnName.trim();
07348:
07349:                if (!((strMatchColumns.get(0)).equals(columnName))) {
07350:                    throw new SQLException(resBundle.handleGetObject(
07351:                            "cachedrowsetimpl.unsetmatch").toString());
07352:                } else if (((Integer) (iMatchColumns.get(0))).intValue() > 0) {
07353:                    throw new SQLException(resBundle.handleGetObject(
07354:                            "cachedrowsetimpl.unsetmatch2").toString());
07355:                } else {
07356:                    strMatchColumns.set(0, null); // that is, we are unsetting it.
07357:                }
07358:            }
07359:
07360:            /**
07361:             * Notifies registered listeners that a RowSet object in the given RowSetEvent
07362:             * object has populated a number of additional rows. The <code>numRows</code> parameter
07363:             * ensures that this event will only be fired every <code>numRow</code>.
07364:             * <p>
07365:             * The source of the event can be retrieved with the method event.getSource.      
07366:             *
07367:             * @param event a <code>RowSetEvent</code> object that contains the 
07368:             *     <code>RowSet</code> object that is the source of the events
07369:             * @param numRows when populating, the number of rows interval on which the
07370:             *     <code>CachedRowSet</code> populated should fire; the default value
07371:             *     is zero; cannot be less than <code>fetchSize</code> or zero     
07372:             */
07373:            public void rowSetPopulated(RowSetEvent event, int numRows)
07374:                    throws SQLException {
07375:
07376:                if (numRows < 0 || numRows < getFetchSize()) {
07377:                    throw new SQLException(resBundle.handleGetObject(
07378:                            "cachedrowsetimpl.numrows").toString());
07379:                }
07380:
07381:                if (size() % numRows == 0) {
07382:                    RowSetEvent event_temp = new RowSetEvent(this );
07383:                    event = event_temp;
07384:                    notifyRowSetChanged();
07385:                }
07386:            }
07387:
07388:            /**
07389:             * Populates this <code>CachedRowSet</code> object with data from
07390:             * the given <code>ResultSet</code> object. While related to the <code>populate(ResultSet)</code>
07391:             * method, an additional parameter is provided to allow starting position within
07392:             * the <code>ResultSet</code> from where to populate the CachedRowSet
07393:             * instance.     
07394:             * 
07395:             * This method is an alternative to the method <code>execute</code>
07396:             * for filling the rowset with data.  The method <code>populate</code>
07397:             * does not require that the properties needed by the method
07398:             * <code>execute</code>, such as the <code>command</code> property,
07399:             * be set. This is true because the method <code>populate</code>
07400:             * is given the <code>ResultSet</code> object from
07401:             * which to get data and thus does not need to use the properties
07402:             * required for setting up a connection and executing this
07403:             * <code>CachedRowSetImpl</code> object's command.
07404:             * <P>
07405:             * After populating this rowset with data, the method
07406:             * <code>populate</code> sets the rowset's metadata and
07407:             * then sends a <code>RowSetChangedEvent</code> object
07408:             * to all registered listeners prior to returning.
07409:             *
07410:             * @param data the <code>ResultSet</code> object containing the data
07411:             *             to be read into this <code>CachedRowSetImpl</code> object
07412:             * @param start the integer specifing the position in the
07413:             *        <code>ResultSet</code> object to popultate the
07414:             *        <code>CachedRowSetImpl</code> object.
07415:             * @throws SQLException if an error occurs; or the max row setting is
07416:             *          violated while populating the RowSet.Also id the start position
07417:             *          is negative.
07418:             * @see #execute
07419:             */
07420:            public void populate(ResultSet data, int start) throws SQLException {
07421:
07422:                int rowsFetched;
07423:                Row currentRow;
07424:                int numCols;
07425:                int i;
07426:                Map map = getTypeMap();
07427:                Object obj;
07428:                int mRows;
07429:
07430:                cursorPos = 0;
07431:                if (populatecallcount == 0) {
07432:                    if (start < 0) {
07433:                        throw new SQLException(resBundle.handleGetObject(
07434:                                "cachedrowsetimpl.startpos").toString());
07435:                    }
07436:                    if (getMaxRows() == 0) {
07437:                        data.absolute(start);
07438:                        while (data.next()) {
07439:                            totalRows++;
07440:                        }
07441:                        totalRows++;
07442:                    }
07443:                    startPos = start;
07444:                }
07445:                populatecallcount = populatecallcount + 1;
07446:                resultSet = data;
07447:                if ((endPos - startPos) >= getMaxRows() && (getMaxRows() > 0)) {
07448:                    endPos = prevEndPos;
07449:                    pagenotend = false;
07450:                    return;
07451:                }
07452:
07453:                if ((maxRowsreached != getMaxRows() || maxRowsreached != totalRows)
07454:                        && pagenotend) {
07455:                    startPrev = start - getPageSize();
07456:                }
07457:
07458:                if (pageSize == 0) {
07459:                    prevEndPos = endPos;
07460:                    endPos = start + getMaxRows();
07461:                } else {
07462:                    prevEndPos = endPos;
07463:                    endPos = start + getPageSize();
07464:                }
07465:
07466:                if (start == 1) {
07467:                    resultSet.beforeFirst();
07468:                } else {
07469:                    resultSet.absolute(start - 1);
07470:                }
07471:                if (pageSize == 0) {
07472:                    rvh = new Vector(getMaxRows());
07473:
07474:                } else {
07475:                    rvh = new Vector(getPageSize());
07476:                }
07477:
07478:                if (data == null) {
07479:                    throw new SQLException(resBundle.handleGetObject(
07480:                            "cachedrowsetimpl.populate").toString());
07481:                }
07482:
07483:                // get the meta data for this ResultSet
07484:                RSMD = data.getMetaData();
07485:
07486:                // set up the metadata
07487:                RowSetMD = new RowSetMetaDataImpl();
07488:                initMetaData(RowSetMD, RSMD);
07489:
07490:                // release the meta-data so that aren't tempted to use it.
07491:                RSMD = null;
07492:                numCols = RowSetMD.getColumnCount();
07493:                mRows = this .getMaxRows();
07494:                rowsFetched = 0;
07495:                currentRow = null;
07496:
07497:                if (!data.next() && mRows == 0) {
07498:                    endPos = prevEndPos;
07499:                    pagenotend = false;
07500:                    return;
07501:                }
07502:
07503:                data.previous();
07504:
07505:                while (data.next()) {
07506:
07507:                    currentRow = new Row(numCols);
07508:                    if (pageSize == 0) {
07509:                        if (rowsFetched >= mRows && mRows > 0) {
07510:                            rowsetWarning
07511:                                    .setNextException(new SQLException(
07512:                                            "Populating rows "
07513:                                                    + "setting has exceeded max row setting"));
07514:                            break;
07515:                        }
07516:                    } else {
07517:                        if ((rowsFetched >= pageSize)
07518:                                || (maxRowsreached >= mRows && mRows > 0)) {
07519:                            rowsetWarning
07520:                                    .setNextException(new SQLException(
07521:                                            "Populating rows "
07522:                                                    + "setting has exceeded max row setting"));
07523:                            break;
07524:                        }
07525:                    }
07526:
07527:                    for (i = 1; i <= numCols; i++) {
07528:                        /*
07529:                         * check if the user has set a map. If no map
07530:                         * is set then use plain getObject. This lets
07531:                         * us work with drivers that do not support
07532:                         * getObject with a map in fairly sensible way
07533:                         */
07534:                        if (map == null) {
07535:                            obj = data.getObject(i);
07536:                        } else {
07537:                            obj = data.getObject(i, map);
07538:                        }
07539:                        /*
07540:                         * the following block checks for the various
07541:                         * types that we have to serialize in order to
07542:                         * store - right now only structs have been tested
07543:                         */
07544:                        if (obj instanceof  Struct) {
07545:                            obj = new SerialStruct((Struct) obj, map);
07546:                        } else if (obj instanceof  SQLData) {
07547:                            obj = new SerialStruct((SQLData) obj, map);
07548:                        } else if (obj instanceof  Blob) {
07549:                            obj = new SerialBlob((Blob) obj);
07550:                        } else if (obj instanceof  Clob) {
07551:                            obj = new SerialClob((Clob) obj);
07552:                        } else if (obj instanceof  java.sql.Array) {
07553:                            obj = new SerialArray((java.sql.Array) obj, map);
07554:                        }
07555:
07556:                        ((Row) currentRow).initColumnObject(i, obj);
07557:                    }
07558:                    rowsFetched++;
07559:                    maxRowsreached++;
07560:                    rvh.add(currentRow);
07561:                }
07562:                numRows = rowsFetched;
07563:                // Also rowsFetched should be equal to rvh.size()
07564:                // notify any listeners that the rowset has changed
07565:                notifyRowSetChanged();
07566:
07567:            }
07568:
07569:            /**
07570:             * The nextPage gets the next page, that is a <code>CachedRowSetImpl</code> object
07571:             * containing the number of rows specified by page size.
07572:             * @return boolean value true indicating whether there are more pages to come and
07573:             *         false indicating that this is the last page.
07574:             * @throws SQLException if an error occurs or this called before calling populate.
07575:             */
07576:            public boolean nextPage() throws SQLException {
07577:
07578:                if (populatecallcount == 0) {
07579:                    throw new SQLException(resBundle.handleGetObject(
07580:                            "cachedrowsetimpl.nextpage").toString());
07581:                }
07582:                // Fix for 6554186
07583:                onFirstPage = false;
07584:                if (callWithCon) {
07585:                    crsReader.setStartPosition(endPos);
07586:                    crsReader.readData((RowSetInternal) this );
07587:                    resultSet = null;
07588:                } else {
07589:                    populate(resultSet, endPos);
07590:                }
07591:                return pagenotend;
07592:            }
07593:
07594:            /**
07595:             * This is the setter function for setting the size of the page, which specifies
07596:             * how many rows have to be retrived at a time.
07597:             *
07598:             * @param size which is the page size
07599:             * @throws SQLException if size is less than zero or greater than max rows.
07600:             */
07601:            public void setPageSize(int size) throws SQLException {
07602:                if (size < 0) {
07603:                    throw new SQLException(resBundle.handleGetObject(
07604:                            "cachedrowsetimpl.pagesize").toString());
07605:                }
07606:                if (size > getMaxRows() && getMaxRows() != 0) {
07607:                    throw new SQLException(resBundle.handleGetObject(
07608:                            "cachedrowsetimpl.pagesize1").toString());
07609:                }
07610:                pageSize = size;
07611:            }
07612:
07613:            /**
07614:             * This is the getter function for the size of the page.
07615:             *
07616:             * @return an integer that is the page size.
07617:             */
07618:            public int getPageSize() {
07619:                return pageSize;
07620:            }
07621:
07622:            /**
07623:             * Retrieves the data present in the page prior to the page from where it is
07624:             * called.
07625:             * @return boolean value true if it retrieves the previous page, flase if it
07626:             *         is on the first page.
07627:             * @throws SQLException if it is called before populate is called or ResultSet
07628:             *         is of type <code>ResultSet.TYPE_FORWARD_ONLY</code> or if an error
07629:             *         occurs.
07630:             */
07631:            public boolean previousPage() throws SQLException {
07632:                int pS;
07633:                int mR;
07634:                int rem;
07635:
07636:                pS = getPageSize();
07637:                mR = maxRowsreached;
07638:
07639:                if (populatecallcount == 0) {
07640:                    throw new SQLException(resBundle.handleGetObject(
07641:                            "cachedrowsetimpl.nextpage").toString());
07642:                }
07643:
07644:                if (!callWithCon) {
07645:                    if (resultSet.getType() == ResultSet.TYPE_FORWARD_ONLY) {
07646:                        throw new SQLException(resBundle.handleGetObject(
07647:                                "cachedrowsetimpl.fwdonly").toString());
07648:                    }
07649:                }
07650:
07651:                pagenotend = true;
07652:
07653:                if (startPrev < startPos) {
07654:                    onFirstPage = true;
07655:                    return false;
07656:                }
07657:
07658:                if (onFirstPage) {
07659:                    return false;
07660:                }
07661:
07662:                rem = mR % pS;
07663:
07664:                if (rem == 0) {
07665:                    maxRowsreached -= (2 * pS);
07666:                    if (callWithCon) {
07667:                        crsReader.setStartPosition(startPrev);
07668:                        crsReader.readData((RowSetInternal) this );
07669:                        resultSet = null;
07670:                    } else {
07671:                        populate(resultSet, startPrev);
07672:                    }
07673:                    return true;
07674:                } else {
07675:                    maxRowsreached -= (pS + rem);
07676:                    if (callWithCon) {
07677:                        crsReader.setStartPosition(startPrev);
07678:                        crsReader.readData((RowSetInternal) this );
07679:                        resultSet = null;
07680:                    } else {
07681:                        populate(resultSet, startPrev);
07682:                    }
07683:                    return true;
07684:                }
07685:            }
07686:
07687:            /**
07688:             * Goes to the page number passed as the parameter
07689:             * @param page , the page loaded on a call to this function
07690:             * @return true if the page exists false otherwise
07691:             * @throws SQLException if an error occurs
07692:             */
07693:            /*
07694:            public boolean absolutePage(int page) throws SQLException{
07695:
07696:                boolean isAbs = true, retVal = true;
07697:                int counter;
07698:
07699:                if( page <= 0 ){
07700:                    throw new SQLException("Absolute positoin is invalid");
07701:                }
07702:                counter = 0;
07703:
07704:                firstPage();
07705:                counter++;
07706:                while((counter < page) && isAbs) {
07707:                    isAbs = nextPage();
07708:                    counter ++;
07709:                }
07710:
07711:                if( !isAbs && counter < page){
07712:                    retVal = false;
07713:                }
07714:                else if(counter == page){
07715:                    retVal = true;
07716:                }
07717:
07718:               return retVal;
07719:            }
07720:             */
07721:
07722:            /**
07723:             * Goes to the page number passed as the parameter  from the current page.
07724:             * The parameter can take postive or negative value accordingly.
07725:             * @param page , the page loaded on a call to this function
07726:             * @return true if the page exists false otherwise
07727:             * @throws SQLException if an error occurs
07728:             */
07729:            /*
07730:            public boolean relativePage(int page) throws SQLException {
07731:
07732:                boolean isRel = true,retVal = true;
07733:                int counter;
07734:
07735:                if(page > 0){
07736:                   counter  = 0;
07737:                   while((counter < page) && isRel){
07738:                      isRel = nextPage();
07739:                      counter++;
07740:                   }
07741:
07742:                   if(!isRel && counter < page){
07743:                       retVal = false;
07744:                   }
07745:                   else if( counter == page){
07746:                       retVal = true;
07747:                   }
07748:                   return retVal;
07749:                }
07750:                else {
07751:                    counter = page;
07752:                    isRel = true;
07753:                    while((counter < 0) && isRel){
07754:                        isRel = previousPage();
07755:                        counter++;
07756:                    }
07757:
07758:                    if( !isRel && counter < 0){
07759:                        retVal = false;
07760:                    }
07761:                    else if(counter == 0){
07762:                        retVal = true;
07763:                    }
07764:                    return retVal;
07765:                }
07766:            }
07767:             */
07768:
07769:            /**
07770:             * Retrieves the first page of data as specified by the page size.
07771:             * @return boolean value true if present on first page, false otherwise
07772:             * @throws SQLException if it called before populate or ResultSet is of
07773:             *         type <code>ResultSet.TYPE_FORWARD_ONLY</code> or an error occurs
07774:             */
07775:            /*
07776:            public boolean firstPage() throws SQLException {
07777:                   if (populatecallcount == 0){
07778:                     throw new SQLException("Populate the data before calling ");
07779:                   }
07780:                   if( !callWithCon){
07781:                      if(resultSet.getType() == ResultSet.TYPE_FORWARD_ONLY) {
07782:                          throw new SQLException("Result of type forward only");
07783:                      }
07784:                   }
07785:                   endPos = 0;
07786:                   maxRowsreached = 0;
07787:                   pagenotend = true;
07788:                   if(callWithCon){
07789:                       crsReader.setStartPosition(startPos);
07790:                       crsReader.readData((RowSetInternal)this);
07791:                       resultSet = null;
07792:                   }
07793:                   else {
07794:                      populate(resultSet,startPos);
07795:                   }
07796:                   onFirstPage = true;
07797:                   return onFirstPage;
07798:            }
07799:             */
07800:
07801:            /**
07802:             * Retrives the last page of data as specified by the page size.
07803:             * @return boolean value tur if present on the last page, false otherwise
07804:             * @throws SQLException if called before populate or if an error occurs.
07805:             */
07806:            /*
07807:            public boolean lastPage() throws SQLException{
07808:                 int pS;
07809:                 int mR;
07810:                 int quo;
07811:                 int rem;
07812:
07813:                 pS = getPageSize();
07814:                 mR = getMaxRows();
07815:
07816:                 if(pS == 0){
07817:                     onLastPage = true;
07818:                     return onLastPage;
07819:                 }
07820:
07821:                 if(getMaxRows() == 0){
07822:                     mR = totalRows;
07823:                 }
07824:
07825:                 if (populatecallcount == 0){
07826:                    throw new SQLException("Populate the data before calling ");
07827:                }
07828:
07829:                onFirstPage = false;
07830:
07831:                if((mR % pS) == 0){
07832:                    quo = mR / pS;
07833:                    int start = startPos + (pS * (quo - 1));
07834:                    maxRowsreached = mR - pS;
07835:                    if(callWithCon){
07836:                        crsReader.setStartPosition(start);
07837:                        crsReader.readData((RowSetInternal)this);
07838:                        resultSet = null;
07839:                    }
07840:                    else {
07841:                       populate(resultSet,start);
07842:                    }
07843:                    onLastPage = true;
07844:                    return onLastPage;
07845:                }
07846:               else {
07847:                     quo = mR /pS;
07848:                     rem = mR % pS;
07849:                     int start = startPos + (pS * quo);
07850:                    maxRowsreached = mR - (rem);
07851:                    if(callWithCon){
07852:                        crsReader.setStartPosition(start);
07853:                        crsReader.readData((RowSetInternal)this);
07854:                        resultSet = null;
07855:                    }
07856:                    else {
07857:                       populate(resultSet,start);
07858:                    }
07859:                    onLastPage = true;
07860:                    return onLastPage;
07861:                }
07862:            }
07863:             */
07864:
07865:            /**
07866:             * Sets the status for the row on which the cursor is positioned. The insertFlag is used
07867:             * to mention the toggle status for this row
07868:             * @param insertFlag if it is true  - marks this row as inserted
07869:             *                   if it is false - marks it as not a newly inserted row
07870:             * @throws SQLException if an error occurs while doing this operation
07871:             */
07872:            public void setRowInserted(boolean insertFlag) throws SQLException {
07873:
07874:                checkCursor();
07875:
07876:                if (onInsertRow == true)
07877:                    throw new SQLException(resBundle.handleGetObject(
07878:                            "cachedrowsetimpl.invalidop").toString());
07879:
07880:                if (insertFlag) {
07881:                    ((Row) getCurrentRow()).setInserted();
07882:                } else {
07883:                    ((Row) getCurrentRow()).clearInserted();
07884:                }
07885:            }
07886:
07887:            /**
07888:             * Retrieves the value of the designated <code>SQL XML</code> parameter as a
07889:             * <code>SQLXML</code> object in the Java programming language.
07890:             * @param columnIndex the first column is 1, the second is 2, ...
07891:             * @return a SQLXML object that maps an SQL XML value
07892:             * @throws SQLException if a database access error occurs
07893:             * @since 6.0
07894:             */
07895:            public SQLXML getSQLXML(int columnIndex) throws SQLException {
07896:                throw new SQLFeatureNotSupportedException(resBundle
07897:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
07898:                        .toString());
07899:            }
07900:
07901:            /**
07902:             * Retrieves the value of the designated <code>SQL XML</code> parameter as a
07903:             * <code>SQLXML</code> object in the Java programming language.
07904:             * @param colName the name of the column from which to retrieve the value
07905:             * @return a SQLXML object that maps an SQL XML value
07906:             * @throws SQLException if a database access error occurs
07907:             */
07908:            public SQLXML getSQLXML(String colName) throws SQLException {
07909:                throw new SQLFeatureNotSupportedException(resBundle
07910:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
07911:                        .toString());
07912:            }
07913:
07914:            /**
07915:             * Retrieves the value of the designated column in the current row of this 
07916:             * <code>ResultSet</code> object as a java.sql.RowId object in the Java
07917:             * programming language.
07918:             *
07919:             * @param columnIndex the first column is 1, the second 2, ...
07920:             * @return the column value if the value is a SQL <code>NULL</code> the
07921:             *     value returned is <code>null</code>
07922:             * @throws SQLException if a database access error occurs
07923:             * @since 6.0
07924:             */
07925:            public RowId getRowId(int columnIndex) throws SQLException {
07926:                throw new SQLFeatureNotSupportedException(resBundle
07927:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
07928:                        .toString());
07929:            }
07930:
07931:            /**
07932:             * Retrieves the value of the designated column in the current row of this 
07933:             * <code>ResultSet</code> object as a java.sql.RowId object in the Java
07934:             * programming language.
07935:             *
07936:             * @param columnName the name of the column
07937:             * @return the column value if the value is a SQL <code>NULL</code> the
07938:             *     value returned is <code>null</code>
07939:             * @throws SQLException if a database access error occurs
07940:             * @since 6.0
07941:             */
07942:            public RowId getRowId(String columnName) throws SQLException {
07943:                throw new SQLFeatureNotSupportedException(resBundle
07944:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
07945:                        .toString());
07946:            }
07947:
07948:            /**
07949:             * Updates the designated column with a <code>RowId</code> value. The updater
07950:             * methods are used to update column values in the current row or the insert
07951:             * row. The updater methods do not update the underlying database; instead 
07952:             * the <code>updateRow<code> or <code>insertRow</code> methods are called 
07953:             * to update the database.
07954:             * 
07955:             * @param columnIndex the first column is 1, the second 2, ...
07956:             * @param x the column value
07957:             * @throws SQLException if a database access occurs 
07958:             * @since 6.0
07959:             */
07960:            public void updateRowId(int columnIndex, RowId x)
07961:                    throws SQLException {
07962:                throw new SQLFeatureNotSupportedException(resBundle
07963:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
07964:                        .toString());
07965:            }
07966:
07967:            /**
07968:             * Updates the designated column with a <code>RowId</code> value. The updater
07969:             * methods are used to update column values in the current row or the insert
07970:             * row. The updater methods do not update the underlying database; instead 
07971:             * the <code>updateRow<code> or <code>insertRow</code> methods are called 
07972:             * to update the database.
07973:             * 
07974:             * @param columnName the name of the column
07975:             * @param x the column value
07976:             * @throws SQLException if a database access occurs 
07977:             * @since 6.0
07978:             */
07979:            public void updateRowId(String columnName, RowId x)
07980:                    throws SQLException {
07981:                throw new SQLFeatureNotSupportedException(resBundle
07982:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
07983:                        .toString());
07984:            }
07985:
07986:            /**
07987:             * Retrieves the holdability of this ResultSet object
07988:             * @return  either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
07989:             * @throws SQLException if a database error occurs
07990:             * @since 6.0
07991:             */
07992:            public int getHoldability() throws SQLException {
07993:                throw new SQLFeatureNotSupportedException(resBundle
07994:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
07995:                        .toString());
07996:            }
07997:
07998:            /**
07999:             * Retrieves whether this ResultSet object has been closed. A ResultSet is closed if the
08000:             * method close has been called on it, or if it is automatically closed.
08001:             * @return true if this ResultSet object is closed; false if it is still open
08002:             * @throws SQLException if a database access error occurs
08003:             * @since 6.0
08004:             */
08005:            public boolean isClosed() throws SQLException {
08006:                throw new SQLFeatureNotSupportedException(resBundle
08007:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08008:                        .toString());
08009:            }
08010:
08011:            /**
08012:             * This method is used for updating columns that support National Character sets.
08013:             * It can be used for updating NCHAR,NVARCHAR and LONGNVARCHAR columns.
08014:             * @param columnIndex the first column is 1, the second 2, ...
08015:             * @param nString the value for the column to be updated
08016:             * @throws SQLException if a database access error occurs
08017:             * @since 6.0
08018:             */
08019:            public void updateNString(int columnIndex, String nString)
08020:                    throws SQLException {
08021:                throw new SQLFeatureNotSupportedException(resBundle
08022:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08023:                        .toString());
08024:            }
08025:
08026:            /**
08027:             * This method is used for updating columns that support National Character sets.
08028:             * It can be used for updating NCHAR,NVARCHAR and LONGNVARCHAR columns.
08029:             * @param columnName name of the Column
08030:             * @param nString the value for the column to be updated
08031:             * @throws SQLException if a database access error occurs
08032:             * @since 6.0
08033:             */
08034:            public void updateNString(String columnName, String nString)
08035:                    throws SQLException {
08036:                throw new SQLFeatureNotSupportedException(resBundle
08037:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08038:                        .toString());
08039:            }
08040:
08041:            /*o
08042:             * This method is used for updating SQL <code>NCLOB</code>  type that maps
08043:             * to <code>java.sql.Types.NCLOB</code>
08044:             * @param columnIndex the first column is 1, the second 2, ...
08045:             * @param nClob the value for the column to be updated
08046:             * @throws SQLException if a database access error occurs
08047:             * @since 6.0
08048:             */
08049:            public void updateNClob(int columnIndex, NClob nClob)
08050:                    throws SQLException {
08051:                throw new SQLFeatureNotSupportedException(resBundle
08052:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08053:                        .toString());
08054:            }
08055:
08056:            /**
08057:             * This method is used for updating SQL <code>NCLOB</code>  type that maps
08058:             * to <code>java.sql.Types.NCLOB</code>
08059:             * @param columnName name of the column
08060:             * @param nClob the value for the column to be updated
08061:             * @throws SQLException if a database access error occurs
08062:             * @since 6.0
08063:             */
08064:            public void updateNClob(String columnName, NClob nClob)
08065:                    throws SQLException {
08066:                throw new SQLFeatureNotSupportedException(resBundle
08067:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08068:                        .toString());
08069:            }
08070:
08071:            /**
08072:             * Retrieves the value of the designated column in the current row
08073:             * of this <code>ResultSet</code> object as a <code>NClob</code> object
08074:             * in the Java programming language.
08075:             *
08076:             * @param i the first column is 1, the second is 2, ...
08077:             * @return a <code>NClob</code> object representing the SQL 
08078:             *         <code>NCLOB</code> value in the specified column
08079:             * @exception SQLException if a database access error occurs
08080:             * @since 6.0
08081:             */
08082:            public NClob getNClob(int i) throws SQLException {
08083:                throw new SQLFeatureNotSupportedException(resBundle
08084:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08085:                        .toString());
08086:            }
08087:
08088:            /**
08089:             * Retrieves the value of the designated column in the current row
08090:             * of this <code>ResultSet</code> object as a <code>NClob</code> object
08091:             * in the Java programming language.
08092:             *
08093:             * @param colName the name of the column from which to retrieve the value
08094:             * @return a <code>NClob</code> object representing the SQL <code>NCLOB</code>
08095:             * value in the specified column
08096:             * @exception SQLException if a database access error occurs
08097:             * @since 6.0
08098:             */
08099:            public NClob getNClob(String colName) throws SQLException {
08100:                throw new SQLFeatureNotSupportedException(resBundle
08101:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08102:                        .toString());
08103:            }
08104:
08105:            public <T> T unwrap(java.lang.Class<T> iface)
08106:                    throws java.sql.SQLException {
08107:                return null;
08108:            }
08109:
08110:            public boolean isWrapperFor(Class<?> interfaces)
08111:                    throws SQLException {
08112:                return false;
08113:            }
08114:
08115:            /**
08116:             * Sets the designated parameter to the given <code>java.sql.SQLXML</code> object. The driver converts this to an
08117:             * SQL <code>XML</code> value when it sends it to the database.
08118:             * @param parameterIndex index of the first parameter is 1, the second is 2, ...
08119:             * @param xmlObject a <code>SQLXML</code> object that maps an SQL <code>XML</code> value
08120:             * @throws SQLException if a database access error occurs
08121:             * @since 1.6
08122:             */
08123:            public void setSQLXML(int parameterIndex, SQLXML xmlObject)
08124:                    throws SQLException {
08125:                throw new SQLFeatureNotSupportedException(resBundle
08126:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08127:                        .toString());
08128:            }
08129:
08130:            /**
08131:             * Sets the designated parameter to the given <code>java.sql.SQLXML</code> object. The driver converts this to an
08132:             * <code>SQL XML</code> value when it sends it to the database.
08133:             * @param parameterName the name of the parameter
08134:             * @param xmlObject a <code>SQLXML</code> object that maps an <code>SQL XML</code> value
08135:             * @throws SQLException if a database access error occurs
08136:             * @since 1.6
08137:             */
08138:            public void setSQLXML(String parameterName, SQLXML xmlObject)
08139:                    throws SQLException {
08140:                throw new SQLFeatureNotSupportedException(resBundle
08141:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08142:                        .toString());
08143:            }
08144:
08145:            /**
08146:             * Sets the designated parameter to the given <code>java.sql.RowId</code> object. The
08147:             * driver converts this to a SQL <code>ROWID</code> value when it sends it
08148:             * to the database
08149:             *
08150:             * @param parameterIndex the first parameter is 1, the second is 2, ...
08151:             * @param x the parameter value
08152:             * @throws SQLException if a database access error occurs
08153:             *
08154:             * @since 1.6
08155:             */
08156:            public void setRowId(int parameterIndex, RowId x)
08157:                    throws SQLException {
08158:                throw new SQLFeatureNotSupportedException(resBundle
08159:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08160:                        .toString());
08161:            }
08162:
08163:            /**
08164:             * Sets the designated parameter to the given <code>java.sql.RowId</code> object. The
08165:             * driver converts this to a SQL <code>ROWID</code> when it sends it to the
08166:             * database.
08167:             *
08168:             * @param parameterName the name of the parameter
08169:             * @param x the parameter value
08170:             * @throws SQLException if a database access error occurs
08171:             * @since 1.6
08172:             */
08173:            public void setRowId(String parameterName, RowId x)
08174:                    throws SQLException {
08175:                throw new SQLFeatureNotSupportedException(resBundle
08176:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08177:                        .toString());
08178:            }
08179:
08180:            /**
08181:             * Sets the designated parameter to a <code>Reader</code> object. The
08182:             * <code>Reader</code> reads the data till end-of-file is reached. The
08183:             * driver does the necessary conversion from Java character format to
08184:             * the national character set in the database.
08185:
08186:             * <P><B>Note:</B> This stream object can either be a standard
08187:             * Java stream object or your own subclass that implements the
08188:             * standard interface.
08189:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
08190:             * it might be more efficient to use a version of
08191:             * <code>setNCharacterStream</code> which takes a length parameter.
08192:             *
08193:             * @param parameterIndex of the first parameter is 1, the second is 2, ...
08194:             * @param value the parameter value
08195:             * @throws SQLException if the driver does not support national
08196:             *         character sets;  if the driver can detect that a data conversion
08197:             *  error could occur ; if a database access error occurs; or
08198:             * this method is called on a closed <code>PreparedStatement</code>
08199:             * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
08200:             * @since 1.6
08201:             */
08202:            public void setNCharacterStream(int parameterIndex, Reader value)
08203:                    throws SQLException {
08204:                throw new SQLFeatureNotSupportedException(resBundle
08205:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
08206:                        .toString());
08207:            }
08208:
08209:            /**
08210:             * Sets the designated parameter to a <code>java.sql.NClob</code> object. The object
08211:             * implements the <code>java.sql.NClob</code> interface. This <code>NClob</code>
08212:             * object maps to a SQL <code>NCLOB</code>.
08213:             * @param parameterName the name of the column to be set
08214:             * @param value the parameter value
08215:             * @throws SQLException if the driver does not support national
08216:             *         character sets;  if the driver can detect that a data conversion
08217:             *  error could occur; or if a database access error occurs
08218:             * @since 1.6
08219:             */
08220:            public void setNClob(String parameterName, NClob value)
08221:                    throws SQLException {
08222:                throw new SQLFeatureNotSupportedException(resBundle
08223:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08224:                        .toString());
08225:            }
08226:
08227:            /**
08228:             * Retrieves the value of the designated column in the current row
08229:             * of this <code>ResultSet</code> object as a
08230:             * <code>java.io.Reader</code> object.
08231:             * It is intended for use when
08232:             * accessing  <code>NCHAR</code>,<code>NVARCHAR</code>
08233:             * and <code>LONGNVARCHAR</code> columns.
08234:             *
08235:             * @return a <code>java.io.Reader</code> object that contains the column
08236:             * value; if the value is SQL <code>NULL</code>, the value returned is
08237:             * <code>null</code> in the Java programming language.
08238:             * @param columnIndex the first column is 1, the second is 2, ...
08239:             * @exception SQLException if a database access error occurs
08240:             * @since 1.6
08241:             */
08242:            public java.io.Reader getNCharacterStream(int columnIndex)
08243:                    throws SQLException {
08244:                throw new SQLFeatureNotSupportedException(resBundle
08245:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08246:                        .toString());
08247:            }
08248:
08249:            /**
08250:             * Retrieves the value of the designated column in the current row
08251:             * of this <code>ResultSet</code> object as a
08252:             * <code>java.io.Reader</code> object.
08253:             * It is intended for use when
08254:             * accessing  <code>NCHAR</code>,<code>NVARCHAR</code>
08255:             * and <code>LONGNVARCHAR</code> columns.
08256:             *
08257:             * @param columnName the name of the column
08258:             * @return a <code>java.io.Reader</code> object that contains the column
08259:             * value; if the value is SQL <code>NULL</code>, the value returned is
08260:             * <code>null</code> in the Java programming language
08261:             * @exception SQLException if a database access error occurs
08262:             * @since 1.6
08263:             */
08264:            public java.io.Reader getNCharacterStream(String columnName)
08265:                    throws SQLException {
08266:                throw new SQLFeatureNotSupportedException(resBundle
08267:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08268:                        .toString());
08269:            }
08270:
08271:            /**
08272:             * Updates the designated column with a <code>java.sql.SQLXML</code> value.
08273:             * The updater
08274:             * methods are used to update column values in the current row or the insert
08275:             * row. The updater methods do not update the underlying database; instead
08276:             * the <code>updateRow</code> or <code>insertRow</code> methods are called
08277:             * to update the database.
08278:             * @param columnIndex the first column is 1, the second 2, ...
08279:             * @param xmlObject the value for the column to be updated
08280:             * @throws SQLException if a database access error occurs
08281:             * @since 1.6
08282:             */
08283:            public void updateSQLXML(int columnIndex, SQLXML xmlObject)
08284:                    throws SQLException {
08285:                throw new SQLFeatureNotSupportedException(resBundle
08286:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08287:                        .toString());
08288:            }
08289:
08290:            /**
08291:             * Updates the designated column with a <code>java.sql.SQLXML</code> value.
08292:             * The updater
08293:             * methods are used to update column values in the current row or the insert
08294:             * row. The updater methods do not update the underlying database; instead
08295:             * the <code>updateRow</code> or <code>insertRow</code> methods are called
08296:             * to update the database.
08297:             *
08298:             * @param columnName the name of the column
08299:             * @param xmlObject the column value
08300:             * @throws SQLException if a database access occurs
08301:             * @since 1.6
08302:             */
08303:            public void updateSQLXML(String columnName, SQLXML xmlObject)
08304:                    throws SQLException {
08305:                throw new SQLFeatureNotSupportedException(resBundle
08306:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08307:                        .toString());
08308:            }
08309:
08310:            /**
08311:             * Retrieves the value of the designated column in the current row
08312:             * of this <code>ResultSet</code> object as
08313:             * a <code>String</code> in the Java programming language.
08314:             * It is intended for use when
08315:             * accessing  <code>NCHAR</code>,<code>NVARCHAR</code>
08316:             * and <code>LONGNVARCHAR</code> columns.
08317:             *
08318:             * @param columnIndex the first column is 1, the second is 2, ...
08319:             * @return the column value; if the value is SQL <code>NULL</code>, the
08320:             * value returned is <code>null</code>
08321:             * @exception SQLException if a database access error occurs
08322:             * @since 1.6
08323:             */
08324:            public String getNString(int columnIndex) throws SQLException {
08325:                throw new SQLFeatureNotSupportedException(resBundle
08326:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08327:                        .toString());
08328:            }
08329:
08330:            /**
08331:             * Retrieves the value of the designated column in the current row
08332:             * of this <code>ResultSet</code> object as
08333:             * a <code>String</code> in the Java programming language.
08334:             * It is intended for use when
08335:             * accessing  <code>NCHAR</code>,<code>NVARCHAR</code>
08336:             * and <code>LONGNVARCHAR</code> columns.
08337:             *
08338:             * @param columnName the SQL name of the column
08339:             * @return the column value; if the value is SQL <code>NULL</code>, the
08340:             * value returned is <code>null</code>
08341:             * @exception SQLException if a database access error occurs
08342:             * @since 1.6
08343:             */
08344:            public String getNString(String columnName) throws SQLException {
08345:                throw new SQLFeatureNotSupportedException(resBundle
08346:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08347:                        .toString());
08348:            }
08349:
08350:            /**
08351:             * Updates the designated column with a character stream value, which will 
08352:             * have the specified number of bytes. The driver does the necessary conversion 
08353:             * from Java character format to the national character set in the database. 
08354:             * It is intended for use when updating NCHAR,NVARCHAR and LONGNVARCHAR columns. 
08355:             * The updater methods are used to update column values in the current row or 
08356:             * the insert row. The updater methods do not update the underlying database; 
08357:             * instead the updateRow or insertRow methods are called to update the database.
08358:             * 
08359:             * @param columnIndex - the first column is 1, the second is 2, ...
08360:             * @param x - the new column value
08361:             * @param length - the length of the stream
08362:             * @exception SQLException if a database access error occurs
08363:             * @since 1.6
08364:             */
08365:            public void updateNCharacterStream(int columnIndex,
08366:                    java.io.Reader x, long length) throws SQLException {
08367:                throw new SQLFeatureNotSupportedException(resBundle
08368:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08369:                        .toString());
08370:            }
08371:
08372:            /**
08373:             * Updates the designated column with a character stream value, which will 
08374:             * have the specified number of bytes. The driver does the necessary conversion 
08375:             * from Java character format to the national character set in the database. 
08376:             * It is intended for use when updating NCHAR,NVARCHAR and LONGNVARCHAR columns. 
08377:             * The updater methods are used to update column values in the current row or 
08378:             * the insert row. The updater methods do not update the underlying database; 
08379:             * instead the updateRow or insertRow methods are called to update the database.
08380:             * 
08381:             * @param columnName - name of the Column
08382:             * @param x - the new column value
08383:             * @param length - the length of the stream
08384:             * @exception SQLException if a database access error occurs
08385:             * @since 1.6
08386:             */
08387:            public void updateNCharacterStream(String columnName,
08388:                    java.io.Reader x, long length) throws SQLException {
08389:                throw new SQLFeatureNotSupportedException(resBundle
08390:                        .handleGetObject("cachedrowsetimpl.opnotysupp")
08391:                        .toString());
08392:            }
08393:
08394:            /**
08395:             * Updates the designated column with a character stream value.   The
08396:             * driver does the necessary conversion from Java character format to
08397:             * the national character set in the database.
08398:             * It is intended for use when
08399:             * updating  <code>NCHAR</code>,<code>NVARCHAR</code>
08400:             * and <code>LONGNVARCHAR</code> columns.
08401:             *
08402:             * The updater methods are used to update column values in the
08403:             * current row or the insert row.  The updater methods do not
08404:             * update the underlying database; instead the <code>updateRow</code> or
08405:             * <code>insertRow</code> methods are called to update the database.
08406:             *
08407:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
08408:             * it might be more efficient to use a version of
08409:             * <code>updateNCharacterStream</code> which takes a length parameter.
08410:             *
08411:             * @param columnIndex the first column is 1, the second is 2, ...
08412:             * @param x the new column value
08413:             * @exception SQLException if a database access error occurs,
08414:             * the result set concurrency is <code>CONCUR_READ_ONLY</code> or this method is called on a closed result set
08415:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
08416:             * this method
08417:             * @since 1.6
08418:             */
08419:            public void updateNCharacterStream(int columnIndex, java.io.Reader x)
08420:                    throws SQLException {
08421:                throw new SQLFeatureNotSupportedException(resBundle
08422:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
08423:                        .toString());
08424:            }
08425:
08426:            /**
08427:             * Updates the designated column with a character stream value.  The
08428:             * driver does the necessary conversion from Java character format to
08429:             * the national character set in the database.
08430:             * It is intended for use when
08431:             * updating  <code>NCHAR</code>,<code>NVARCHAR</code>
08432:             * and <code>LONGNVARCHAR</code> columns.
08433:             *   
08434:             * The updater methods are used to update column values in the
08435:             * current row or the insert row.  The updater methods do not
08436:             * update the underlying database; instead the <code>updateRow</code> or
08437:             * <code>insertRow</code> methods are called to update the database.
08438:             *
08439:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
08440:             * it might be more efficient to use a version of
08441:             * <code>updateNCharacterStream</code> which takes a length parameter.
08442:             *
08443:             * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the la
08444:            bel is the name of the column
08445:             * @param reader the <code>java.io.Reader</code> object containing
08446:             *        the new column value
08447:             * @exception SQLException if a database access error occurs,
08448:             * the result set concurrency is <code>CONCUR_READ_ONLY</code> or this method is called on a closed result set
08449:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
08450:             * this method
08451:             * @since 1.6
08452:             */
08453:            public void updateNCharacterStream(String columnLabel,
08454:                    java.io.Reader reader) throws SQLException {
08455:                throw new SQLFeatureNotSupportedException(resBundle
08456:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
08457:                        .toString());
08458:            }
08459:
08460:            //////////////////////////
08461:
08462:            /**
08463:             * Updates the designated column using the given input stream, which
08464:             * will have the specified number of bytes.
08465:             * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
08466:             * parameter, it may be more practical to send it via a
08467:             * <code>java.io.InputStream</code>. Data will be read from the stream
08468:             * as needed until end-of-file is reached.  The JDBC driver will
08469:             * do any necessary conversion from ASCII to the database char format.
08470:             * 
08471:             * <P><B>Note:</B> This stream object can either be a standard
08472:             * Java stream object or your own subclass that implements the
08473:             * standard interface.
08474:             * <p>
08475:             * The updater methods are used to update column values in the
08476:             * current row or the insert row.  The updater methods do not 
08477:             * update the underlying database; instead the <code>updateRow</code> or
08478:             * <code>insertRow</code> methods are called to update the database.
08479:             *
08480:             * @param columnIndex the first column is 1, the second is 2, ...
08481:             * @param inputStream An object that contains the data to set the parameter
08482:             * value to.
08483:             * @param length the number of bytes in the parameter data.
08484:             * @exception SQLException if a database access error occurs,
08485:             * the result set concurrency is <code>CONCUR_READ_ONLY</code> 
08486:             * or this method is called on a closed result set
08487:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
08488:             * this method
08489:             * @since 1.6
08490:             */
08491:            public void updateBlob(int columnIndex, InputStream inputStream,
08492:                    long length) throws SQLException {
08493:                throw new SQLFeatureNotSupportedException(resBundle
08494:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
08495:                        .toString());
08496:            }
08497:
08498:            /** 
08499:             * Updates the designated column using the given input stream, which
08500:             * will have the specified number of bytes.
08501:             * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
08502:             * parameter, it may be more practical to send it via a
08503:             * <code>java.io.InputStream</code>. Data will be read from the stream
08504:             * as needed until end-of-file is reached.  The JDBC driver will
08505:             * do any necessary conversion from ASCII to the database char format.
08506:             * 
08507:             * <P><B>Note:</B> This stream object can either be a standard
08508:             * Java stream object or your own subclass that implements the
08509:             * standard interface.
08510:             * <p>
08511:             * The updater methods are used to update column values in the
08512:             * current row or the insert row.  The updater methods do not 
08513:             * update the underlying database; instead the <code>updateRow</code> or
08514:             * <code>insertRow</code> methods are called to update the database.
08515:             *
08516:             * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the label is the name of the column
08517:             * @param inputStream An object that contains the data to set the parameter
08518:             * value to.
08519:             * @param length the number of bytes in the parameter data.
08520:             * @exception SQLException if a database access error occurs,
08521:             * the result set concurrency is <code>CONCUR_READ_ONLY</code> 
08522:             * or this method is called on a closed result set
08523:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
08524:             * this method
08525:             * @since 1.6
08526:             */
08527:            public void updateBlob(String columnLabel, InputStream inputStream,
08528:                    long length) throws SQLException {
08529:                throw new SQLFeatureNotSupportedException(resBundle
08530:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
08531:                        .toString());
08532:            }
08533:
08534:            /**
08535:             * Updates the designated column using the given input stream.
08536:             * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
08537:             * parameter, it may be more practical to send it via a
08538:             * <code>java.io.InputStream</code>. Data will be read from the stream
08539:             * as needed until end-of-file is reached.  The JDBC driver will
08540:             * do any necessary conversion from ASCII to the database char format.
08541:             *
08542:             * <P><B>Note:</B> This stream object can either be a standard
08543:             * Java stream object or your own subclass that implements the
08544:             * standard interface.
08545:             *
08546:             *  <P><B>Note:</B> Consult your JDBC driver documentation to determine if
08547:             * it might be more efficient to use a version of
08548:             * <code>updateBlob</code> which takes a length parameter.
08549:             * <p>
08550:             * The updater methods are used to update column values in the
08551:             * current row or the insert row.  The updater methods do not
08552:             * update the underlying database; instead the <code>updateRow</code> or
08553:             * <code>insertRow</code> methods are called to update the database.
08554:             *
08555:             * @param columnIndex the first column is 1, the second is 2, ...
08556:             * @param inputStream An object that contains the data to set the parameter
08557:             * value to.
08558:             * @exception SQLException if a database access error occurs,
08559:             * the result set concurrency is <code>CONCUR_READ_ONLY</code>
08560:             * or this method is called on a closed result set
08561:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
08562:             * this method
08563:             * @since 1.6
08564:             */
08565:            public void updateBlob(int columnIndex, InputStream inputStream)
08566:                    throws SQLException {
08567:                throw new SQLFeatureNotSupportedException(resBundle
08568:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
08569:                        .toString());
08570:            }
08571:
08572:            /**
08573:             * Updates the designated column using the given input stream.
08574:             * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
08575:             * parameter, it may be more practical to send it via a
08576:             * <code>java.io.InputStream</code>. Data will be read from the stream
08577:             * as needed until end-of-file is reached.  The JDBC driver will
08578:             * do any necessary conversion from ASCII to the database char format.
08579:             *
08580:             * <P><B>Note:</B> This stream object can either be a standard
08581:             * Java stream object or your own subclass that implements the
08582:             * standard interface.
08583:             *   <P><B>Note:</B> Consult your JDBC driver documentation to determine if
08584:             * it might be more efficient to use a version of
08585:             * <code>updateBlob</code> which takes a length parameter.
08586:             * <p>
08587:             * The updater methods are used to update column values in the
08588:             * current row or the insert row.  The updater methods do not
08589:             * update the underlying database; instead the <code>updateRow</code> or
08590:             * <code>insertRow</code> methods are called to update the database.
08591:             *
08592:             * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the la
08593:            bel is the name of the column
08594:             * @param inputStream An object that contains the data to set the parameter
08595:             * value to.
08596:             * @exception SQLException if a database access error occurs,
08597:             * the result set concurrency is <code>CONCUR_READ_ONLY</code>
08598:             * or this method is called on a closed result set
08599:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
08600:             * this method
08601:             * @since 1.6
08602:             */
08603:            public void updateBlob(String columnLabel, InputStream inputStream)
08604:                    throws SQLException {
08605:                throw new SQLFeatureNotSupportedException(resBundle
08606:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
08607:                        .toString());
08608:            }
08609:
08610:            /**
08611:             * Updates the designated column using the given <code>Reader</code>
08612:             * object, which is the given number of characters long.
08613:             * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
08614:             * parameter, it may be more practical to send it via a
08615:             * <code>java.io.Reader</code> object. The data will be read from the stream
08616:             * as needed until end-of-file is reached.  The JDBC driver will
08617:             * do any necessary conversion from UNICODE to the database char format.
08618:             * 
08619:             * <P><B>Note:</B> This stream object can either be a standard
08620:             * Java stream object or your own subclass that implements the
08621:             * standard interface.
08622:             * <p>
08623:             * The updater methods are used to update column values in the
08624:             * current row or the insert row.  The updater methods do not 
08625:             * update the underlying database; instead the <code>updateRow</code> or
08626:             * <code>insertRow</code> methods are called to update the database.
08627:             *
08628:             * @param columnIndex the first column is 1, the second is 2, ...
08629:             * @param reader An object that contains the data to set the parameter value to.
08630:             * @param length the number of characters in the parameter data.
08631:             * @exception SQLException if a database access error occurs,
08632:             * the result set concurrency is <code>CONCUR_READ_ONLY</code> 
08633:             * or this method is called on a closed result set
08634:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
08635:             * this method 
08636:             * @since 1.6
08637:             */
08638:            public void updateClob(int columnIndex, Reader reader, long length)
08639:                    throws SQLException {
08640:                throw new SQLFeatureNotSupportedException(resBundle
08641:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
08642:                        .toString());
08643:            }
08644:
08645:            /** 
08646:             * Updates the designated column using the given <code>Reader</code>
08647:             * object, which is the given number of characters long.
08648:             * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
08649:             * parameter, it may be more practical to send it via a
08650:             * <code>java.io.Reader</code> object. The data will be read from the stream
08651:             * as needed until end-of-file is reached.  The JDBC driver will
08652:             * do any necessary conversion from UNICODE to the database char format.
08653:             * 
08654:             * <P><B>Note:</B> This stream object can either be a standard
08655:             * Java stream object or your own subclass that implements the
08656:             * standard interface.
08657:             * <p>
08658:             * The updater methods are used to update column values in the
08659:             * current row or the insert row.  The updater methods do not 
08660:             * update the underlying database; instead the <code>updateRow</code> or
08661:             * <code>insertRow</code> methods are called to update the database.
08662:             *
08663:             * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the label is the name of the column
08664:             * @param reader An object that contains the data to set the parameter value to.
08665:             * @param length the number of characters in the parameter data.
08666:             * @exception SQLException if a database access error occurs,
08667:             * the result set concurrency is <code>CONCUR_READ_ONLY</code> 
08668:             * or this method is called on a closed result set
08669:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
08670:             * this method
08671:             * @since 1.6
08672:             */
08673:            public void updateClob(String columnLabel, Reader reader,
08674:                    long length) throws SQLException {
08675:                throw new SQLFeatureNotSupportedException(resBundle
08676:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
08677:                        .toString());
08678:            }
08679:
08680:            /**
08681:             * Updates the designated column using the given <code>Reader</code>
08682:             * object.
08683:             * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
08684:             * parameter, it may be more practical to send it via a
08685:             * <code>java.io.Reader</code> object. The data will be read from the stream
08686:             * as needed until end-of-file is reached.  The JDBC driver will
08687:             * do any necessary conversion from UNICODE to the database char format.
08688:             *
08689:             * <P><B>Note:</B> This stream object can either be a standard
08690:             * Java stream object or your own subclass that implements the
08691:             * standard interface.
08692:             *   <P><B>Note:</B> Consult your JDBC driver documentation to determine if
08693:             * it might be more efficient to use a version of
08694:             * <code>updateClob</code> which takes a length parameter.
08695:             * <p>
08696:             * The updater methods are used to update column values in the
08697:             * current row or the insert row.  The updater methods do not
08698:             * update the underlying database; instead the <code>updateRow</code> or
08699:             * <code>insertRow</code> methods are called to update the database.
08700:             *
08701:             * @param columnIndex the first column is 1, the second is 2, ...
08702:             * @param reader An object that contains the data to set the parameter value to.
08703:             * @exception SQLException if a database access error occurs,
08704:             * the result set concurrency is <code>CONCUR_READ_ONLY</code>
08705:             * or this method is called on a closed result set
08706:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
08707:             * this method
08708:             * @since 1.6
08709:             */
08710:            public void updateClob(int columnIndex, Reader reader)
08711:                    throws SQLException {
08712:                throw new SQLFeatureNotSupportedException(resBundle
08713:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
08714:                        .toString());
08715:            }
08716:
08717:            /**
08718:             * Updates the designated column using the given <code>Reader</code>
08719:             * object.
08720:             * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
08721:             * parameter, it may be more practical to send it via a
08722:             * <code>java.io.Reader</code> object. The data will be read from the stream
08723:             * as needed until end-of-file is reached.  The JDBC driver will
08724:             * do any necessary conversion from UNICODE to the database char format.
08725:             *
08726:             * <P><B>Note:</B> This stream object can either be a standard
08727:             * Java stream object or your own subclass that implements the
08728:             * standard interface.
08729:             *  <P><B>Note:</B> Consult your JDBC driver documentation to determine if
08730:             * it might be more efficient to use a version of
08731:             * <code>updateClob</code> which takes a length parameter.
08732:             * <p>
08733:             * The updater methods are used to update column values in the
08734:             * current row or the insert row.  The updater methods do not
08735:             * update the underlying database; instead the <code>updateRow</code> or
08736:             * <code>insertRow</code> methods are called to update the database.
08737:             *
08738:             * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the la
08739:            bel is the name of the column
08740:             * @param reader An object that contains the data to set the parameter value to.
08741:             * @exception SQLException if a database access error occurs,
08742:             * the result set concurrency is <code>CONCUR_READ_ONLY</code>
08743:             * or this method is called on a closed result set
08744:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
08745:             * this method
08746:             * @since 1.6
08747:             */
08748:            public void updateClob(String columnLabel, Reader reader)
08749:                    throws SQLException {
08750:                throw new SQLFeatureNotSupportedException(resBundle
08751:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
08752:                        .toString());
08753:            }
08754:
08755:            /**
08756:             * Updates the designated column using the given <code>Reader</code>
08757:             * object, which is the given number of characters long.
08758:             * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
08759:             * parameter, it may be more practical to send it via a
08760:             * <code>java.io.Reader</code> object. The data will be read from the stream
08761:             * as needed until end-of-file is reached.  The JDBC driver will
08762:             * do any necessary conversion from UNICODE to the database char format.
08763:             * 
08764:             * <P><B>Note:</B> This stream object can either be a standard
08765:             * Java stream object or your own subclass that implements the
08766:             * standard interface.
08767:             * <p>
08768:             * The updater methods are used to update column values in the
08769:             * current row or the insert row.  The updater methods do not 
08770:             * update the underlying database; instead the <code>updateRow</code> or
08771:             * <code>insertRow</code> methods are called to update the database.
08772:             *
08773:             * @param columnIndex the first column is 1, the second 2, ...
08774:             * @param reader An object that contains the data to set the parameter value to.
08775:             * @param length the number of characters in the parameter data.
08776:             * @throws SQLException if the driver does not support national
08777:             *         character sets;  if the driver can detect that a data conversion
08778:             *  error could occur; this method is called on a closed result set,  
08779:             * if a database access error occurs or
08780:             * the result set concurrency is <code>CONCUR_READ_ONLY</code> 
08781:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
08782:             * this method
08783:             * @since 1.6
08784:             */
08785:            public void updateNClob(int columnIndex, Reader reader, long length)
08786:                    throws SQLException {
08787:                throw new SQLFeatureNotSupportedException(resBundle
08788:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
08789:                        .toString());
08790:            }
08791:
08792:            /**
08793:             * Updates the designated column using the given <code>Reader</code>
08794:             * object, which is the given number of characters long.
08795:             * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
08796:             * parameter, it may be more practical to send it via a
08797:             * <code>java.io.Reader</code> object. The data will be read from the stream
08798:             * as needed until end-of-file is reached.  The JDBC driver will
08799:             * do any necessary conversion from UNICODE to the database char format.
08800:             * 
08801:             * <P><B>Note:</B> This stream object can either be a standard
08802:             * Java stream object or your own subclass that implements the
08803:             * standard interface.
08804:             * <p>
08805:             * The updater methods are used to update column values in the
08806:             * current row or the insert row.  The updater methods do not 
08807:             * update the underlying database; instead the <code>updateRow</code> or
08808:             * <code>insertRow</code> methods are called to update the database.
08809:             *
08810:             * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the label is the name of the column
08811:             * @param reader An object that contains the data to set the parameter value to.
08812:             * @param length the number of characters in the parameter data.
08813:             * @throws SQLException if the driver does not support national
08814:             *         character sets;  if the driver can detect that a data conversion
08815:             *  error could occur; this method is called on a closed result set;
08816:             *  if a database access error occurs or
08817:             * the result set concurrency is <code>CONCUR_READ_ONLY</code> 
08818:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
08819:             * this method
08820:             * @since 1.6
08821:             */
08822:            public void updateNClob(String columnLabel, Reader reader,
08823:                    long length) throws SQLException {
08824:                throw new SQLFeatureNotSupportedException(resBundle
08825:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
08826:                        .toString());
08827:            }
08828:
08829:            /**
08830:             * Updates the designated column using the given <code>Reader</code>
08831:             * object.
08832:             * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
08833:             * parameter, it may be more practical to send it via a
08834:             * <code>java.io.Reader</code> object. The data will be read from the stream
08835:             * as needed until end-of-file is reached.  The JDBC driver will
08836:             * do any necessary conversion from UNICODE to the database char format.
08837:             *
08838:             * <P><B>Note:</B> This stream object can either be a standard
08839:             * Java stream object or your own subclass that implements the
08840:             * standard interface.
08841:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
08842:             * it might be more efficient to use a version of
08843:             * <code>updateNClob</code> which takes a length parameter.
08844:             * <p>
08845:             * The updater methods are used to update column values in the
08846:             * current row or the insert row.  The updater methods do not
08847:             * update the underlying database; instead the <code>updateRow</code> or
08848:             * <code>insertRow</code> methods are called to update the database.
08849:             *
08850:             * @param columnIndex the first column is 1, the second 2, ...
08851:             * @param reader An object that contains the data to set the parameter value to.
08852:             * @throws SQLException if the driver does not support national
08853:             *         character sets;  if the driver can detect that a data conversion
08854:             *  error could occur; this method is called on a closed result set,
08855:             * if a database access error occurs or
08856:             * the result set concurrency is <code>CONCUR_READ_ONLY</code>
08857:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
08858:             * this method
08859:             * @since 1.6
08860:             */
08861:            public void updateNClob(int columnIndex, Reader reader)
08862:                    throws SQLException {
08863:                throw new SQLFeatureNotSupportedException(resBundle
08864:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
08865:                        .toString());
08866:            }
08867:
08868:            /**
08869:             * Updates the designated column using the given <code>Reader</code>
08870:             * object.
08871:             * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
08872:             * parameter, it may be more practical to send it via a
08873:             * <code>java.io.Reader</code> object. The data will be read from the stream
08874:             * as needed until end-of-file is reached.  The JDBC driver will
08875:             * do any necessary conversion from UNICODE to the database char format.
08876:             *
08877:             * <P><B>Note:</B> This stream object can either be a standard
08878:             * Java stream object or your own subclass that implements the
08879:             * standard interface.
08880:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
08881:             * it might be more efficient to use a version of
08882:             * <code>updateNClob</code> which takes a length parameter.
08883:             * <p>
08884:             * The updater methods are used to update column values in the
08885:             * current row or the insert row.  The updater methods do not
08886:             * update the underlying database; instead the <code>updateRow</code> or
08887:             * <code>insertRow</code> methods are called to update the database.
08888:             *
08889:             * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the la
08890:            bel is the name of the column
08891:             * @param reader An object that contains the data to set the parameter value to.
08892:             * @throws SQLException if the driver does not support national
08893:             *         character sets;  if the driver can detect that a data conversion
08894:             *  error could occur; this method is called on a closed result set;
08895:             *  if a database access error occurs or
08896:             * the result set concurrency is <code>CONCUR_READ_ONLY</code>
08897:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
08898:             * this method
08899:             * @since 1.6
08900:             */
08901:            public void updateNClob(String columnLabel, Reader reader)
08902:                    throws SQLException {
08903:                throw new SQLFeatureNotSupportedException(resBundle
08904:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
08905:                        .toString());
08906:            }
08907:
08908:            /** 
08909:             * Updates the designated column with an ascii stream value, which will have
08910:             * the specified number of bytes.
08911:             * The updater methods are used to update column values in the
08912:             * current row or the insert row.  The updater methods do not 
08913:             * update the underlying database; instead the <code>updateRow</code> or
08914:             * <code>insertRow</code> methods are called to update the database.
08915:             *
08916:             * @param columnIndex the first column is 1, the second is 2, ...
08917:             * @param x the new column value
08918:             * @param length the length of the stream
08919:             * @exception SQLException if a database access error occurs,
08920:             * the result set concurrency is <code>CONCUR_READ_ONLY</code> 
08921:             * or this method is called on a closed result set
08922:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
08923:             * this method
08924:             * @since 1.6
08925:             */
08926:            public void updateAsciiStream(int columnIndex,
08927:                    java.io.InputStream x, long length) throws SQLException {
08928:
08929:            }
08930:
08931:            /** 
08932:             * Updates the designated column with a binary stream value, which will have
08933:             * the specified number of bytes.
08934:             * The updater methods are used to update column values in the
08935:             * current row or the insert row.  The updater methods do not 
08936:             * update the underlying database; instead the <code>updateRow</code> or
08937:             * <code>insertRow</code> methods are called to update the database.
08938:             *
08939:             * @param columnIndex the first column is 1, the second is 2, ...
08940:             * @param x the new column value     
08941:             * @param length the length of the stream
08942:             * @exception SQLException if a database access error occurs,
08943:             * the result set concurrency is <code>CONCUR_READ_ONLY</code> 
08944:             * or this method is called on a closed result set
08945:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
08946:             * this method
08947:             * @since 1.6
08948:             */
08949:            public void updateBinaryStream(int columnIndex,
08950:                    java.io.InputStream x, long length) throws SQLException {
08951:            }
08952:
08953:            /**
08954:             * Updates the designated column with a character stream value, which will have
08955:             * the specified number of bytes.
08956:             * The updater methods are used to update column values in the
08957:             * current row or the insert row.  The updater methods do not 
08958:             * update the underlying database; instead the <code>updateRow</code> or
08959:             * <code>insertRow</code> methods are called to update the database.
08960:             *
08961:             * @param columnIndex the first column is 1, the second is 2, ...
08962:             * @param x the new column value
08963:             * @param length the length of the stream
08964:             * @exception SQLException if a database access error occurs,
08965:             * the result set concurrency is <code>CONCUR_READ_ONLY</code> 
08966:             * or this method is called on a closed result set
08967:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
08968:             * this method
08969:             * @since 1.6
08970:             */
08971:            public void updateCharacterStream(int columnIndex,
08972:                    java.io.Reader x, long length) throws SQLException {
08973:                throw new SQLFeatureNotSupportedException(resBundle
08974:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
08975:                        .toString());
08976:            }
08977:
08978:            /**
08979:             * Updates the designated column with a character stream value, which will have
08980:             * the specified number of bytes.
08981:             * The updater methods are used to update column values in the
08982:             * current row or the insert row.  The updater methods do not
08983:             * update the underlying database; instead the <code>updateRow</code> or
08984:             * <code>insertRow</code> methods are called to update the database.
08985:             *
08986:             * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the la
08987:            bel is the name of the column
08988:             * @param reader the <code>java.io.Reader</code> object containing
08989:             *        the new column value
08990:             * @param length the length of the stream
08991:             * @exception SQLException if a database access error occurs,
08992:             * the result set concurrency is <code>CONCUR_READ_ONLY</code>
08993:             * or this method is called on a closed result set
08994:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
08995:             * this method
08996:             * @since 1.6
08997:             */
08998:            public void updateCharacterStream(String columnLabel,
08999:                    java.io.Reader reader, long length) throws SQLException {
09000:                throw new SQLFeatureNotSupportedException(resBundle
09001:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09002:                        .toString());
09003:            }
09004:
09005:            /** 
09006:             * Updates the designated column with an ascii stream value, which will have
09007:             * the specified number of bytes..
09008:             * The updater methods are used to update column values in the
09009:             * current row or the insert row.  The updater methods do not 
09010:             * update the underlying database; instead the <code>updateRow</code> or
09011:             * <code>insertRow</code> methods are called to update the database.
09012:             *
09013:             * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the label is the name of the column
09014:             * @param x the new column value
09015:             * @param length the length of the stream
09016:             * @exception SQLException if a database access error occurs,
09017:             * the result set concurrency is <code>CONCUR_READ_ONLY</code> 
09018:             * or this method is called on a closed result set
09019:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09020:             * this method
09021:             * @since 1.6
09022:             */
09023:            public void updateAsciiStream(String columnLabel,
09024:                    java.io.InputStream x, long length) throws SQLException {
09025:            }
09026:
09027:            /** 
09028:             * Updates the designated column with a binary stream value, which will have
09029:             * the specified number of bytes.
09030:             * The updater methods are used to update column values in the
09031:             * current row or the insert row.  The updater methods do not 
09032:             * update the underlying database; instead the <code>updateRow</code> or
09033:             * <code>insertRow</code> methods are called to update the database.
09034:             *
09035:             * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the label is the name of the column
09036:             * @param x the new column value
09037:             * @param length the length of the stream
09038:             * @exception SQLException if a database access error occurs,
09039:             * the result set concurrency is <code>CONCUR_READ_ONLY</code> 
09040:             * or this method is called on a closed result set
09041:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09042:             * this method
09043:             * @since 1.6
09044:             */
09045:            public void updateBinaryStream(String columnLabel,
09046:                    java.io.InputStream x, long length) throws SQLException {
09047:            }
09048:
09049:            /**
09050:             * Updates the designated column with a binary stream value.
09051:             * The updater methods are used to update column values in the
09052:             * current row or the insert row.  The updater methods do not
09053:             * update the underlying database; instead the <code>updateRow</code> or
09054:             * <code>insertRow</code> methods are called to update the database.
09055:             *
09056:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
09057:             * it might be more efficient to use a version of
09058:             * <code>updateBinaryStream</code> which takes a length parameter.
09059:             *
09060:             * @param columnIndex the first column is 1, the second is 2, ...
09061:             * @param x the new column value
09062:             * @exception SQLException if a database access error occurs,
09063:             * the result set concurrency is <code>CONCUR_READ_ONLY</code>
09064:             * or this method is called on a closed result set
09065:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09066:             * this method
09067:             * @since 1.6
09068:             */
09069:            public void updateBinaryStream(int columnIndex,
09070:                    java.io.InputStream x) throws SQLException {
09071:                throw new SQLFeatureNotSupportedException(resBundle
09072:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09073:                        .toString());
09074:            }
09075:
09076:            /**
09077:             * Updates the designated column with a binary stream value.
09078:             * The updater methods are used to update column values in the
09079:             * current row or the insert row.  The updater methods do not
09080:             * update the underlying database; instead the <code>updateRow</code> or
09081:             * <code>insertRow</code> methods are called to update the database.
09082:             *
09083:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
09084:             * it might be more efficient to use a version of
09085:             * <code>updateBinaryStream</code> which takes a length parameter.
09086:             *
09087:             * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the la
09088:            bel is the name of the column
09089:             * @param x the new column value
09090:             * @exception SQLException if a database access error occurs,
09091:             * the result set concurrency is <code>CONCUR_READ_ONLY</code>
09092:             * or this method is called on a closed result set
09093:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09094:             * this method
09095:             * @since 1.6
09096:             */
09097:            public void updateBinaryStream(String columnLabel,
09098:                    java.io.InputStream x) throws SQLException {
09099:                throw new SQLFeatureNotSupportedException(resBundle
09100:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09101:                        .toString());
09102:            }
09103:
09104:            /**
09105:             * Updates the designated column with a character stream value.
09106:             * The updater methods are used to update column values in the
09107:             * current row or the insert row.  The updater methods do not
09108:             * update the underlying database; instead the <code>updateRow</code> or
09109:             * <code>insertRow</code> methods are called to update the database.
09110:             *
09111:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
09112:             * it might be more efficient to use a version of
09113:             * <code>updateCharacterStream</code> which takes a length parameter.
09114:             *
09115:             * @param columnIndex the first column is 1, the second is 2, ...
09116:             * @param x the new column value
09117:             * @exception SQLException if a database access error occurs,
09118:             * the result set concurrency is <code>CONCUR_READ_ONLY</code>
09119:             * or this method is called on a closed result set
09120:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09121:             * this method
09122:             * @since 1.6
09123:             */
09124:            public void updateCharacterStream(int columnIndex, java.io.Reader x)
09125:                    throws SQLException {
09126:                throw new SQLFeatureNotSupportedException(resBundle
09127:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09128:                        .toString());
09129:            }
09130:
09131:            /**
09132:             * Updates the designated column with a character stream value.
09133:             * The updater methods are used to update column values in the
09134:             * current row or the insert row.  The updater methods do not
09135:             * update the underlying database; instead the <code>updateRow</code> or
09136:             * <code>insertRow</code> methods are called to update the database.
09137:             *
09138:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
09139:             * it might be more efficient to use a version of
09140:             * <code>updateCharacterStream</code> which takes a length parameter.
09141:             *
09142:             * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the la
09143:            bel is the name of the column
09144:             * @param reader the <code>java.io.Reader</code> object containing
09145:             *        the new column value
09146:             * @exception SQLException if a database access error occurs,
09147:             * the result set concurrency is <code>CONCUR_READ_ONLY</code>
09148:             * or this method is called on a closed result set
09149:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09150:             * this method
09151:             * @since 1.6
09152:             */
09153:            public void updateCharacterStream(String columnLabel,
09154:                    java.io.Reader reader) throws SQLException {
09155:                throw new SQLFeatureNotSupportedException(resBundle
09156:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09157:                        .toString());
09158:            }
09159:
09160:            /**
09161:             * Updates the designated column with an ascii stream value.
09162:             * The updater methods are used to update column values in the
09163:             * current row or the insert row.  The updater methods do not
09164:             * update the underlying database; instead the <code>updateRow</code> or
09165:             * <code>insertRow</code> methods are called to update the database.
09166:             *
09167:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
09168:             * it might be more efficient to use a version of
09169:             * <code>updateAsciiStream</code> which takes a length parameter.
09170:             *
09171:             * @param columnIndex the first column is 1, the second is 2, ...
09172:             * @param x the new column value
09173:             * @exception SQLException if a database access error occurs,
09174:             * the result set concurrency is <code>CONCUR_READ_ONLY</code>
09175:             * or this method is called on a closed result set
09176:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09177:             * this method
09178:             * @since 1.6
09179:             */
09180:            public void updateAsciiStream(int columnIndex, java.io.InputStream x)
09181:                    throws SQLException {
09182:                throw new SQLFeatureNotSupportedException(resBundle
09183:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09184:                        .toString());
09185:            }
09186:
09187:            /**
09188:             * Updates the designated column with an ascii stream value.
09189:             * The updater methods are used to update column values in the
09190:             * current row or the insert row.  The updater methods do not
09191:             * update the underlying database; instead the <code>updateRow</code> or
09192:             * <code>insertRow</code> methods are called to update the database.
09193:             *
09194:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
09195:             * it might be more efficient to use a version of
09196:             * <code>updateAsciiStream</code> which takes a length parameter.
09197:             *
09198:             * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the la
09199:            bel is the name of the column
09200:             * @param x the new column value
09201:             * @exception SQLException if a database access error occurs,
09202:             * the result set concurrency is <code>CONCUR_READ_ONLY</code>
09203:             * or this method is called on a closed result set
09204:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09205:             * this method
09206:             * @since 1.6
09207:             */
09208:            public void updateAsciiStream(String columnLabel,
09209:                    java.io.InputStream x) throws SQLException {
09210:
09211:            }
09212:
09213:            /**
09214:             * Sets the designated parameter to the given <code>java.net.URL</code> value.
09215:             * The driver converts this to an SQL <code>DATALINK</code> value
09216:             * when it sends it to the database.
09217:             *
09218:             * @param parameterIndex the first parameter is 1, the second is 2, ...
09219:             * @param x the <code>java.net.URL</code> object to be set
09220:             * @exception SQLException if a database access error occurs or
09221:             * this method is called on a closed <code>PreparedStatement</code>
09222:             * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
09223:             * @since 1.4
09224:             */
09225:            public void setURL(int parameterIndex, java.net.URL x)
09226:                    throws SQLException {
09227:                throw new SQLFeatureNotSupportedException(resBundle
09228:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09229:                        .toString());
09230:            }
09231:
09232:            /**
09233:             * Sets the designated parameter to a <code>Reader</code> object.
09234:             * This method differs from the <code>setCharacterStream (int, Reader)</code> method
09235:             * because it informs the driver that the parameter value should be sent to
09236:             * the server as a <code>NCLOB</code>.  When the <code>setCharacterStream</code> method is used, the
09237:             * driver may have to do extra work to determine whether the parameter
09238:             * data should be sent to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
09239:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
09240:             * it might be more efficient to use a version of
09241:             * <code>setNClob</code> which takes a length parameter.
09242:             *
09243:             * @param parameterIndex index of the first parameter is 1, the second is 2, ...
09244:             * @param reader An object that contains the data to set the parameter value to.
09245:             * @throws SQLException if parameterIndex does not correspond to a parameter
09246:             * marker in the SQL statement;
09247:             * if the driver does not support national character sets;
09248:             * if the driver can detect that a data conversion
09249:             *  error could occur;  if a database access error occurs or
09250:             * this method is called on a closed <code>PreparedStatement</code>
09251:             * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
09252:             *
09253:             * @since 1.6
09254:             */
09255:            public void setNClob(int parameterIndex, Reader reader)
09256:                    throws SQLException {
09257:                throw new SQLFeatureNotSupportedException(resBundle
09258:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09259:                        .toString());
09260:            }
09261:
09262:            /**
09263:             * Sets the designated parameter to a <code>Reader</code> object.  The <code>reader</code> must contain  the number
09264:             * of characters specified by length otherwise a <code>SQLException</code> will be
09265:             * generated when the <code>CallableStatement</code> is executed.
09266:             * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
09267:             * because it informs the driver that the parameter value should be sent to
09268:             * the server as a <code>NCLOB</code>.  When the <code>setCharacterStream</code> method is used, the
09269:             * driver may have to do extra work to determine whether the parameter
09270:             * data should be send to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
09271:             *
09272:             * @param parameterName the name of the parameter to be set
09273:             * @param reader An object that contains the data to set the parameter value to.
09274:             * @param length the number of characters in the parameter data.
09275:             * @throws SQLException if parameterIndex does not correspond to a parameter
09276:             * marker in the SQL statement; if the length specified is less than zero;
09277:             * if the driver does not support national
09278:             *         character sets;  if the driver can detect that a data conversion
09279:             *  error could occur; if a database access error occurs or
09280:             * this method is called on a closed <code>CallableStatement</code>
09281:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09282:             * this method
09283:             * @since 1.6
09284:             */
09285:            public void setNClob(String parameterName, Reader reader,
09286:                    long length) throws SQLException {
09287:                throw new SQLFeatureNotSupportedException(resBundle
09288:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09289:                        .toString());
09290:            }
09291:
09292:            /**
09293:             * Sets the designated parameter to a <code>Reader</code> object.
09294:             * This method differs from the <code>setCharacterStream (int, Reader)</code> method
09295:             * because it informs the driver that the parameter value should be sent to
09296:             * the server as a <code>NCLOB</code>.  When the <code>setCharacterStream</code> method is used, the
09297:             * driver may have to do extra work to determine whether the parameter
09298:             * data should be send to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
09299:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
09300:             * it might be more efficient to use a version of
09301:             * <code>setNClob</code> which takes a length parameter.
09302:             *
09303:             * @param parameterName the name of the parameter
09304:             * @param reader An object that contains the data to set the parameter value to.
09305:             * @throws SQLException if the driver does not support national character sets;
09306:             * if the driver can detect that a data conversion
09307:             *  error could occur;  if a database access error occurs or
09308:             * this method is called on a closed <code>CallableStatement</code>
09309:             * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
09310:             *
09311:             * @since 1.6
09312:             */
09313:            public void setNClob(String parameterName, Reader reader)
09314:                    throws SQLException {
09315:                throw new SQLFeatureNotSupportedException(resBundle
09316:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09317:                        .toString());
09318:            }
09319:
09320:            /**
09321:             * Sets the designated parameter to a <code>Reader</code> object.  The reader must contain  the number
09322:             * of characters specified by length otherwise a <code>SQLException</code> will be
09323:             * generated when the <code>PreparedStatement</code> is executed.
09324:             * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
09325:             * because it informs the driver that the parameter value should be sent to
09326:             * the server as a <code>NCLOB</code>.  When the <code>setCharacterStream</code> method is used, the
09327:             * driver may have to do extra work to determine whether the parameter
09328:             * data should be sent to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
09329:             * @param parameterIndex index of the first parameter is 1, the second is 2, ...
09330:             * @param reader An object that contains the data to set the parameter value to.
09331:             * @param length the number of characters in the parameter data.
09332:             * @throws SQLException if parameterIndex does not correspond to a parameter
09333:             * marker in the SQL statement; if the length specified is less than zero;
09334:             * if the driver does not support national character sets;
09335:             * if the driver can detect that a data conversion
09336:             *  error could occur;  if a database access error occurs or
09337:             * this method is called on a closed <code>PreparedStatement</code>
09338:             * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
09339:             *
09340:             * @since 1.6
09341:             */
09342:            public void setNClob(int parameterIndex, Reader reader, long length)
09343:                    throws SQLException {
09344:                throw new SQLFeatureNotSupportedException(resBundle
09345:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09346:                        .toString());
09347:            }
09348:
09349:            /**
09350:             * Sets the designated parameter to a <code>java.sql.NClob</code> object. The driver converts this to
09351:            a
09352:             * SQL <code>NCLOB</code> value when it sends it to the database.
09353:             * @param parameterIndex of the first parameter is 1, the second is 2, ...
09354:             * @param value the parameter value
09355:             * @throws SQLException if the driver does not support national
09356:             *         character sets;  if the driver can detect that a data conversion
09357:             *  error could occur ; or if a database access error occurs
09358:             * @since 1.6
09359:             */
09360:            public void setNClob(int parameterIndex, NClob value)
09361:                    throws SQLException {
09362:                throw new SQLFeatureNotSupportedException(resBundle
09363:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09364:                        .toString());
09365:            }
09366:
09367:            /**
09368:             * Sets the designated paramter to the given <code>String</code> object.
09369:             * The driver converts this to a SQL <code>NCHAR</code> or
09370:             * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code> value
09371:             * (depending on the argument's
09372:             * size relative to the driver's limits on <code>NVARCHAR</code> values)
09373:             * when it sends it to the database.
09374:             *
09375:             * @param parameterIndex of the first parameter is 1, the second is 2, ...
09376:             * @param value the parameter value
09377:             * @throws SQLException if the driver does not support national
09378:             *         character sets;  if the driver can detect that a data conversion
09379:             *  error could occur ; or if a database access error occurs
09380:             * @since 1.6
09381:             */
09382:            public void setNString(int parameterIndex, String value)
09383:                    throws SQLException {
09384:                throw new SQLFeatureNotSupportedException(resBundle
09385:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09386:                        .toString());
09387:            }
09388:
09389:            /**
09390:             * Sets the designated paramter to the given <code>String</code> object.
09391:             * The driver converts this to a SQL <code>NCHAR</code> or
09392:             * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code>
09393:             * @param parameterName the name of the column to be set
09394:             * @param value the parameter value
09395:             * @throws SQLException if the driver does not support national
09396:             *         character sets;  if the driver can detect that a data conversion
09397:             *  error could occur; or if a database access error occurs
09398:             * @since 1.6
09399:             */
09400:            public void setNString(String parameterName, String value)
09401:                    throws SQLException {
09402:                throw new SQLFeatureNotSupportedException(resBundle
09403:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09404:                        .toString());
09405:            }
09406:
09407:            /**
09408:             * Sets the designated parameter to a <code>Reader</code> object. The
09409:             * <code>Reader</code> reads the data till end-of-file is reached. The
09410:             * driver does the necessary conversion from Java character format to
09411:             * the national character set in the database.
09412:             * @param parameterIndex of the first parameter is 1, the second is 2, ...
09413:             * @param value the parameter value
09414:             * @param length the number of characters in the parameter data.
09415:             * @throws SQLException if the driver does not support national
09416:             *         character sets;  if the driver can detect that a data conversion
09417:             *  error could occur ; or if a database access error occurs
09418:             * @since 1.6
09419:             */
09420:            public void setNCharacterStream(int parameterIndex, Reader value,
09421:                    long length) throws SQLException {
09422:                throw new SQLFeatureNotSupportedException(resBundle
09423:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09424:                        .toString());
09425:            }
09426:
09427:            /**
09428:             * Sets the designated parameter to a <code>Reader</code> object. The
09429:             * <code>Reader</code> reads the data till end-of-file is reached. The
09430:             * driver does the necessary conversion from Java character format to
09431:             * the national character set in the database.
09432:             * @param parameterName the name of the column to be set
09433:             * @param value the parameter value
09434:             * @param length the number of characters in the parameter data.
09435:             * @throws SQLException if the driver does not support national
09436:             *         character sets;  if the driver can detect that a data conversion
09437:             *  error could occur; or if a database access error occurs
09438:             * @since 1.6
09439:             */
09440:            public void setNCharacterStream(String parameterName, Reader value,
09441:                    long length) throws SQLException {
09442:                throw new SQLFeatureNotSupportedException(resBundle
09443:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09444:                        .toString());
09445:            }
09446:
09447:            /**
09448:             * Sets the designated parameter to a <code>Reader</code> object. The
09449:             * <code>Reader</code> reads the data till end-of-file is reached. The
09450:             * driver does the necessary conversion from Java character format to
09451:             * the national character set in the database.
09452:
09453:             * <P><B>Note:</B> This stream object can either be a standard
09454:             * Java stream object or your own subclass that implements the
09455:             * standard interface.
09456:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
09457:             * it might be more efficient to use a version of
09458:             * <code>setNCharacterStream</code> which takes a length parameter.
09459:             *
09460:             * @param parameterName the name of the parameter
09461:             * @param value the parameter value
09462:             * @throws SQLException if the driver does not support national
09463:             *         character sets;  if the driver can detect that a data conversion
09464:             *  error could occur ; if a database access error occurs; or
09465:             * this method is called on a closed <code>CallableStatement</code>
09466:             * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
09467:             * @since 1.6
09468:             */
09469:            public void setNCharacterStream(String parameterName, Reader value)
09470:                    throws SQLException {
09471:                throw new SQLFeatureNotSupportedException(resBundle
09472:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09473:                        .toString());
09474:            }
09475:
09476:            /**
09477:             * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value,
09478:             * using the given <code>Calendar</code> object.  The driver uses
09479:             * the <code>Calendar</code> object to construct an SQL <code>TIMESTAMP</code> value,
09480:             * which the driver then sends to the database.  With a
09481:             * a <code>Calendar</code> object, the driver can calculate the timestamp
09482:             * taking into account a custom timezone.  If no
09483:             * <code>Calendar</code> object is specified, the driver uses the default
09484:             * timezone, which is that of the virtual machine running the application.
09485:             *
09486:             * @param parameterName the name of the parameter
09487:             * @param x the parameter value
09488:             * @param cal the <code>Calendar</code> object the driver will use
09489:             *            to construct the timestamp
09490:             * @exception SQLException if a database access error occurs or
09491:             * this method is called on a closed <code>CallableStatement</code>
09492:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09493:             * this method
09494:             * @see #getTimestamp
09495:             * @since 1.4
09496:             */
09497:            public void setTimestamp(String parameterName,
09498:                    java.sql.Timestamp x, Calendar cal) throws SQLException {
09499:                throw new SQLFeatureNotSupportedException(resBundle
09500:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09501:                        .toString());
09502:            }
09503:
09504:            /**
09505:             * Sets the designated parameter to a <code>Reader</code> object.  The <code>reader</code> must contain  the number
09506:             * of characters specified by length otherwise a <code>SQLException</code> will be
09507:             * generated when the <code>CallableStatement</code> is executed.
09508:             * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
09509:             * because it informs the driver that the parameter value should be sent to
09510:             * the server as a <code>CLOB</code>.  When the <code>setCharacterStream</code> method is used, the
09511:             * driver may have to do extra work to determine whether the parameter
09512:             * data should be send to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>
09513:             * @param parameterName the name of the parameter to be set
09514:             * @param reader An object that contains the data to set the parameter value to.
09515:             * @param length the number of characters in the parameter data.
09516:             * @throws SQLException if parameterIndex does not correspond to a parameter
09517:             * marker in the SQL statement; if the length specified is less than zero;
09518:             * a database access error occurs or
09519:             * this method is called on a closed <code>CallableStatement</code>
09520:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09521:             * this method
09522:             *
09523:             * @since 1.6
09524:             */
09525:            public void setClob(String parameterName, Reader reader, long length)
09526:                    throws SQLException {
09527:                throw new SQLFeatureNotSupportedException(resBundle
09528:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09529:                        .toString());
09530:            }
09531:
09532:            /**
09533:             * Sets the designated parameter to the given <code>java.sql.Clob</code> object.
09534:             * The driver converts this to an SQL <code>CLOB</code> value when it
09535:             * sends it to the database.
09536:             *
09537:             * @param parameterName the name of the parameter
09538:             * @param x a <code>Clob</code> object that maps an SQL <code>CLOB</code> value
09539:             * @exception SQLException if a database access error occurs or
09540:             * this method is called on a closed <code>CallableStatement</code>
09541:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09542:             * this method
09543:             * @since 1.6
09544:             */
09545:            public void setClob(String parameterName, Clob x)
09546:                    throws SQLException {
09547:                throw new SQLFeatureNotSupportedException(resBundle
09548:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09549:                        .toString());
09550:            }
09551:
09552:            /**
09553:             * Sets the designated parameter to a <code>Reader</code> object.
09554:             * This method differs from the <code>setCharacterStream (int, Reader)</code> method
09555:             * because it informs the driver that the parameter value should be sent to
09556:             * the server as a <code>CLOB</code>.  When the <code>setCharacterStream</code> method is used, the
09557:             * driver may have to do extra work to determine whether the parameter
09558:             * data should be send to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>
09559:             *
09560:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
09561:             * it might be more efficient to use a version of
09562:             * <code>setClob</code> which takes a length parameter.
09563:             *
09564:             * @param parameterName the name of the parameter
09565:             * @param reader An object that contains the data to set the parameter value to.
09566:             * @throws SQLException if a database access error occurs or this method is called on
09567:             * a closed <code>CallableStatement</code>
09568:             *
09569:             * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
09570:             * @since 1.6
09571:             */
09572:            public void setClob(String parameterName, Reader reader)
09573:                    throws SQLException {
09574:                throw new SQLFeatureNotSupportedException(resBundle
09575:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09576:                        .toString());
09577:            }
09578:
09579:            /**
09580:             * Sets the designated parameter to the given <code>java.sql.Date</code> value
09581:             * using the default time zone of the virtual machine that is running
09582:             * the application.
09583:             * The driver converts this
09584:             * to an SQL <code>DATE</code> value when it sends it to the database.
09585:             *
09586:             * @param parameterName the name of the parameter
09587:             * @param x the parameter value
09588:             * @exception SQLException if a database access error occurs or
09589:             * this method is called on a closed <code>CallableStatement</code>
09590:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09591:             * this method
09592:             * @see #getDate
09593:             * @since 1.4
09594:             */
09595:            public void setDate(String parameterName, java.sql.Date x)
09596:                    throws SQLException {
09597:                throw new SQLFeatureNotSupportedException(resBundle
09598:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09599:                        .toString());
09600:            }
09601:
09602:            /**
09603:             * Sets the designated parameter to the given <code>java.sql.Date</code> value,
09604:             * using the given <code>Calendar</code> object.  The driver uses
09605:             * the <code>Calendar</code> object to construct an SQL <code>DATE</code> value,
09606:             * which the driver then sends to the database.  With a
09607:             * a <code>Calendar</code> object, the driver can calculate the date
09608:             * taking into account a custom timezone.  If no
09609:             * <code>Calendar</code> object is specified, the driver uses the default
09610:             * timezone, which is that of the virtual machine running the application.
09611:             *
09612:             * @param parameterName the name of the parameter
09613:             * @param x the parameter value
09614:             * @param cal the <code>Calendar</code> object the driver will use
09615:             *            to construct the date
09616:             * @exception SQLException if a database access error occurs or
09617:             * this method is called on a closed <code>CallableStatement</code>
09618:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09619:             * this method
09620:             * @see #getDate
09621:             * @since 1.4
09622:             */
09623:            public void setDate(String parameterName, java.sql.Date x,
09624:                    Calendar cal) throws SQLException {
09625:                throw new SQLFeatureNotSupportedException(resBundle
09626:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09627:                        .toString());
09628:            }
09629:
09630:            /**
09631:             * Sets the designated parameter to the given <code>java.sql.Time</code> value.
09632:             * The driver converts this
09633:             * to an SQL <code>TIME</code> value when it sends it to the database.
09634:             *
09635:             * @param parameterName the name of the parameter
09636:             * @param x the parameter value
09637:             * @exception SQLException if a database access error occurs or
09638:             * this method is called on a closed <code>CallableStatement</code>
09639:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09640:             * this method
09641:             * @see #getTime
09642:             * @since 1.4
09643:             */
09644:            public void setTime(String parameterName, java.sql.Time x)
09645:                    throws SQLException {
09646:                throw new SQLFeatureNotSupportedException(resBundle
09647:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09648:                        .toString());
09649:            }
09650:
09651:            /**
09652:             * Sets the designated parameter to the given <code>java.sql.Time</code> value,
09653:             * using the given <code>Calendar</code> object.  The driver uses
09654:             * the <code>Calendar</code> object to construct an SQL <code>TIME</code> value,
09655:             * which the driver then sends to the database.  With a
09656:             * a <code>Calendar</code> object, the driver can calculate the time
09657:             * taking into account a custom timezone.  If no
09658:             * <code>Calendar</code> object is specified, the driver uses the default
09659:             * timezone, which is that of the virtual machine running the application.
09660:             *
09661:             * @param parameterName the name of the parameter
09662:             * @param x the parameter value
09663:             * @param cal the <code>Calendar</code> object the driver will use
09664:             *            to construct the time
09665:             * @exception SQLException if a database access error occurs or
09666:             * this method is called on a closed <code>CallableStatement</code>
09667:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09668:             * this method
09669:             * @see #getTime
09670:             * @since 1.4
09671:             */
09672:            public void setTime(String parameterName, java.sql.Time x,
09673:                    Calendar cal) throws SQLException {
09674:                throw new SQLFeatureNotSupportedException(resBundle
09675:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09676:                        .toString());
09677:            }
09678:
09679:            /**
09680:             * Sets the designated parameter to a <code>Reader</code> object.
09681:             * This method differs from the <code>setCharacterStream (int, Reader)</code> method
09682:             * because it informs the driver that the parameter value should be sent to
09683:             * the server as a <code>CLOB</code>.  When the <code>setCharacterStream</code> method is used, the
09684:             * driver may have to do extra work to determine whether the parameter
09685:             * data should be sent to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>
09686:             *
09687:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
09688:             * it might be more efficient to use a version of
09689:             * <code>setClob</code> which takes a length parameter.
09690:             *
09691:             * @param parameterIndex index of the first parameter is 1, the second is 2, ...
09692:             * @param reader An object that contains the data to set the parameter value to.
09693:             * @throws SQLException if a database access error occurs, this method is called on
09694:             * a closed <code>PreparedStatement</code>or if parameterIndex does not correspond to a parameter
09695:             * marker in the SQL statement
09696:             *
09697:             * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
09698:             * @since 1.6
09699:             */
09700:            public void setClob(int parameterIndex, Reader reader)
09701:                    throws SQLException {
09702:                throw new SQLFeatureNotSupportedException(resBundle
09703:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09704:                        .toString());
09705:            }
09706:
09707:            /**
09708:             * Sets the designated parameter to a <code>Reader</code> object.  The reader must contain  the number
09709:             * of characters specified by length otherwise a <code>SQLException</code> will be
09710:             * generated when the <code>PreparedStatement</code> is executed.
09711:             *This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
09712:             * because it informs the driver that the parameter value should be sent to
09713:             * the server as a <code>CLOB</code>.  When the <code>setCharacterStream</code> method is used, the
09714:             * driver may have to do extra work to determine whether the parameter
09715:             * data should be sent to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>
09716:             * @param parameterIndex index of the first parameter is 1, the second is 2, ...
09717:             * @param reader An object that contains the data to set the parameter value to.
09718:             * @param length the number of characters in the parameter data.
09719:             * @throws SQLException if a database access error occurs, this method is called on
09720:             * a closed <code>PreparedStatement</code>, if parameterIndex does not correspond to a parameter
09721:             * marker in the SQL statement, or if the length specified is less than zero.
09722:             *
09723:             * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
09724:             * @since 1.6
09725:             */
09726:            public void setClob(int parameterIndex, Reader reader, long length)
09727:                    throws SQLException {
09728:                throw new SQLFeatureNotSupportedException(resBundle
09729:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09730:                        .toString());
09731:            }
09732:
09733:            /**
09734:             * Sets the designated parameter to a <code>InputStream</code> object.  The inputstream must contain  the number
09735:             * of characters specified by length otherwise a <code>SQLException</code> will be
09736:             * generated when the <code>PreparedStatement</code> is executed.
09737:             * This method differs from the <code>setBinaryStream (int, InputStream, int)</code>
09738:             * method because it informs the driver that the parameter value should be
09739:             * sent to the server as a <code>BLOB</code>.  When the <code>setBinaryStream</code> method is used,
09740:             * the driver may have to do extra work to determine whether the parameter
09741:             * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
09742:             * @param parameterIndex index of the first parameter is 1,
09743:             * the second is 2, ...
09744:             * @param inputStream An object that contains the data to set the parameter
09745:             * value to.
09746:             * @param length the number of bytes in the parameter data.
09747:             * @throws SQLException if a database access error occurs,
09748:             * this method is called on a closed <code>PreparedStatement</code>,
09749:             * if parameterIndex does not correspond
09750:             * to a parameter marker in the SQL statement,  if the length specified
09751:             * is less than zero or if the number of bytes in the inputstream does not match
09752:             * the specfied length.
09753:             * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
09754:             *
09755:             * @since 1.6
09756:             */
09757:            public void setBlob(int parameterIndex, InputStream inputStream,
09758:                    long length) throws SQLException {
09759:                throw new SQLFeatureNotSupportedException(resBundle
09760:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09761:                        .toString());
09762:            }
09763:
09764:            /**
09765:             * Sets the designated parameter to a <code>InputStream</code> object.
09766:             * This method differs from the <code>setBinaryStream (int, InputStream)</code>
09767:             * method because it informs the driver that the parameter value should be
09768:             * sent to the server as a <code>BLOB</code>.  When the <code>setBinaryStream</code> method is used,
09769:             * the driver may have to do extra work to determine whether the parameter
09770:             * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
09771:             *
09772:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
09773:             * it might be more efficient to use a version of
09774:             * <code>setBlob</code> which takes a length parameter.
09775:             *
09776:             * @param parameterIndex index of the first parameter is 1,
09777:             * the second is 2, ...
09778:             * @param inputStream An object that contains the data to set the parameter
09779:             * value to.
09780:             * @throws SQLException if a database access error occurs,
09781:             * this method is called on a closed <code>PreparedStatement</code> or
09782:             * if parameterIndex does not correspond
09783:             * to a parameter marker in the SQL statement,
09784:             * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
09785:             *
09786:             * @since 1.6
09787:             */
09788:            public void setBlob(int parameterIndex, InputStream inputStream)
09789:                    throws SQLException {
09790:                throw new SQLFeatureNotSupportedException(resBundle
09791:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09792:                        .toString());
09793:            }
09794:
09795:            /**
09796:             * Sets the designated parameter to a <code>InputStream</code> object.  The <code>inputstream</code> must contain  the number
09797:             * of characters specified by length, otherwise a <code>SQLException</code> will be
09798:             * generated when the <code>CallableStatement</code> is executed.
09799:             * This method differs from the <code>setBinaryStream (int, InputStream, int)</code>
09800:             * method because it informs the driver that the parameter value should be
09801:             * sent to the server as a <code>BLOB</code>.  When the <code>setBinaryStream</code> method is used,
09802:             * the driver may have to do extra work to determine whether the parameter
09803:             * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
09804:             *
09805:             * @param parameterName the name of the parameter to be set
09806:             * the second is 2, ...
09807:             *
09808:             * @param inputStream An object that contains the data to set the parameter
09809:             * value to.
09810:             * @param length the number of bytes in the parameter data.
09811:             * @throws SQLException  if parameterIndex does not correspond
09812:             * to a parameter marker in the SQL statement,  or if the length specified
09813:             * is less than zero; if the number of bytes in the inputstream does not match
09814:             * the specfied length; if a database access error occurs or
09815:             * this method is called on a closed <code>CallableStatement</code>
09816:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09817:             * this method
09818:             *
09819:             * @since 1.6
09820:             */
09821:            public void setBlob(String parameterName, InputStream inputStream,
09822:                    long length) throws SQLException {
09823:                throw new SQLFeatureNotSupportedException(resBundle
09824:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09825:                        .toString());
09826:            }
09827:
09828:            /**
09829:             * Sets the designated parameter to the given <code>java.sql.Blob</code> object.
09830:             * The driver converts this to an SQL <code>BLOB</code> value when it
09831:             * sends it to the database.
09832:             *
09833:             * @param parameterName the name of the parameter
09834:             * @param x a <code>Blob</code> object that maps an SQL <code>BLOB</code> value
09835:             * @exception SQLException if a database access error occurs or
09836:             * this method is called on a closed <code>CallableStatement</code>
09837:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09838:             * this method
09839:             * @since 1.6
09840:             */
09841:            public void setBlob(String parameterName, Blob x)
09842:                    throws SQLException {
09843:                throw new SQLFeatureNotSupportedException(resBundle
09844:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09845:                        .toString());
09846:            }
09847:
09848:            /**
09849:             * Sets the designated parameter to a <code>InputStream</code> object.
09850:             * This method differs from the <code>setBinaryStream (int, InputStream)</code>
09851:             * method because it informs the driver that the parameter value should be
09852:             * sent to the server as a <code>BLOB</code>.  When the <code>setBinaryStream</code> method is used,
09853:             * the driver may have to do extra work to determine whether the parameter
09854:             * data should be send to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
09855:             *
09856:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
09857:             * it might be more efficient to use a version of
09858:             * <code>setBlob</code> which takes a length parameter.
09859:             *
09860:             * @param parameterName the name of the parameter
09861:             * @param inputStream An object that contains the data to set the parameter
09862:             * value to.
09863:             * @throws SQLException if a database access error occurs or
09864:             * this method is called on a closed <code>CallableStatement</code>
09865:             * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
09866:             *
09867:             * @since 1.6
09868:             */
09869:            public void setBlob(String parameterName, InputStream inputStream)
09870:                    throws SQLException {
09871:                throw new SQLFeatureNotSupportedException(resBundle
09872:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09873:                        .toString());
09874:            }
09875:
09876:            /**
09877:             * Sets the value of the designated parameter with the given object. The second
09878:             * argument must be an object type; for integral values, the
09879:             * <code>java.lang</code> equivalent objects should be used.
09880:             *
09881:             * <p>The given Java object will be converted to the given targetSqlType
09882:             * before being sent to the database.
09883:             *
09884:             * If the object has a custom mapping (is of a class implementing the
09885:             * interface <code>SQLData</code>),
09886:             * the JDBC driver should call the method <code>SQLData.writeSQL</code> to write it
09887:             * to the SQL data stream.
09888:             * If, on the other hand, the object is of a class implementing
09889:             * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>,  <code>NClob</code>,
09890:             *  <code>Struct</code>, <code>java.net.URL</code>,
09891:             * or <code>Array</code>, the driver should pass it to the database as a
09892:             * value of the corresponding SQL type.
09893:             * <P>
09894:             * Note that this method may be used to pass datatabase-
09895:             * specific abstract data types.
09896:             *
09897:             * @param parameterName the name of the parameter
09898:             * @param x the object containing the input parameter value
09899:             * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
09900:             * sent to the database. The scale argument may further qualify this type.
09901:             * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types,
09902:             *          this is the number of digits after the decimal point.  For all other
09903:             *          types, this value will be ignored.
09904:             * @exception SQLException if a database access error occurs or
09905:             * this method is called on a closed <code>CallableStatement</code>
09906:             * @exception SQLFeatureNotSupportedException if <code>targetSqlType</code> is
09907:             * a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>,
09908:             * <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>,
09909:             * <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>,
09910:             *  <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code>
09911:             * or  <code>STRUCT</code> data type and the JDBC driver does not support
09912:             * this data type
09913:             * @see Types
09914:             * @see #getObject
09915:             * @since 1.4
09916:             */
09917:            public void setObject(String parameterName, Object x,
09918:                    int targetSqlType, int scale) throws SQLException {
09919:                throw new SQLFeatureNotSupportedException(resBundle
09920:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09921:                        .toString());
09922:            }
09923:
09924:            /**
09925:             * Sets the value of the designated parameter with the given object.
09926:             * This method is like the method <code>setObject</code>
09927:             * above, except that it assumes a scale of zero.
09928:             *
09929:             * @param parameterName the name of the parameter
09930:             * @param x the object containing the input parameter value
09931:             * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
09932:             *                      sent to the database
09933:             * @exception SQLException if a database access error occurs or
09934:             * this method is called on a closed <code>CallableStatement</code>
09935:             * @exception SQLFeatureNotSupportedException if <code>targetSqlType</code> is
09936:             * a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>,
09937:             * <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>,
09938:             * <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>,
09939:             *  <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code>
09940:             * or  <code>STRUCT</code> data type and the JDBC driver does not support
09941:             * this data type
09942:             * @see #getObject
09943:             * @since 1.4
09944:             */
09945:            public void setObject(String parameterName, Object x,
09946:                    int targetSqlType) throws SQLException {
09947:                throw new SQLFeatureNotSupportedException(resBundle
09948:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09949:                        .toString());
09950:            }
09951:
09952:            /**
09953:             * Sets the value of the designated parameter with the given object.
09954:             * The second parameter must be of type <code>Object</code>; therefore, the
09955:             * <code>java.lang</code> equivalent objects should be used for built-in types.
09956:             *
09957:             * <p>The JDBC specification specifies a standard mapping from
09958:             * Java <code>Object</code> types to SQL types.  The given argument
09959:             * will be converted to the corresponding SQL type before being
09960:             * sent to the database.
09961:             *
09962:             * <p>Note that this method may be used to pass datatabase-
09963:             * specific abstract data types, by using a driver-specific Java
09964:             * type.
09965:             *
09966:             * If the object is of a class implementing the interface <code>SQLData</code>,
09967:             * the JDBC driver should call the method <code>SQLData.writeSQL</code>
09968:             * to write it to the SQL data stream.
09969:             * If, on the other hand, the object is of a class implementing
09970:             * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>,  <code>NClob</code>,
09971:             *  <code>Struct</code>, <code>java.net.URL</code>,
09972:             * or <code>Array</code>, the driver should pass it to the database as a
09973:             * value of the corresponding SQL type.
09974:             * <P>
09975:             * This method throws an exception if there is an ambiguity, for example, if the
09976:             * object is of a class implementing more than one of the interfaces named above.
09977:             *
09978:             * @param parameterName the name of the parameter
09979:             * @param x the object containing the input parameter value
09980:             * @exception SQLException if a database access error occurs,
09981:             * this method is called on a closed <code>CallableStatement</code> or if the given
09982:             *            <code>Object</code> parameter is ambiguous
09983:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
09984:             * this method
09985:             * @see #getObject
09986:             * @since 1.4
09987:             */
09988:            public void setObject(String parameterName, Object x)
09989:                    throws SQLException {
09990:                throw new SQLFeatureNotSupportedException(resBundle
09991:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
09992:                        .toString());
09993:            }
09994:
09995:            /**
09996:             * Sets the designated parameter to the given input stream, which will have
09997:             * the specified number of bytes.
09998:             * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
09999:             * parameter, it may be more practical to send it via a
10000:             * <code>java.io.InputStream</code>. Data will be read from the stream
10001:             * as needed until end-of-file is reached.  The JDBC driver will
10002:             * do any necessary conversion from ASCII to the database char format.
10003:             *
10004:             * <P><B>Note:</B> This stream object can either be a standard
10005:             * Java stream object or your own subclass that implements the
10006:             * standard interface.
10007:             *
10008:             * @param parameterName the name of the parameter
10009:             * @param x the Java input stream that contains the ASCII parameter value
10010:             * @param length the number of bytes in the stream
10011:             * @exception SQLException if a database access error occurs or
10012:             * this method is called on a closed <code>CallableStatement</code>
10013:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
10014:             * this method
10015:             * @since 1.4
10016:             */
10017:            public void setAsciiStream(String parameterName,
10018:                    java.io.InputStream x, int length) throws SQLException {
10019:                throw new SQLFeatureNotSupportedException(resBundle
10020:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10021:                        .toString());
10022:            }
10023:
10024:            /**
10025:             * Sets the designated parameter to the given input stream, which will have
10026:             * the specified number of bytes.
10027:             * When a very large binary value is input to a <code>LONGVARBINARY</code>
10028:             * parameter, it may be more practical to send it via a
10029:             * <code>java.io.InputStream</code> object. The data will be read from the stream
10030:             * as needed until end-of-file is reached.
10031:             *
10032:             * <P><B>Note:</B> This stream object can either be a standard
10033:             * Java stream object or your own subclass that implements the
10034:             * standard interface.
10035:             *
10036:             * @param parameterName the name of the parameter
10037:             * @param x the java input stream which contains the binary parameter value
10038:             * @param length the number of bytes in the stream
10039:             * @exception SQLException if a database access error occurs or
10040:             * this method is called on a closed <code>CallableStatement</code>
10041:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
10042:             * this method
10043:             * @since 1.4
10044:             */
10045:            public void setBinaryStream(String parameterName,
10046:                    java.io.InputStream x, int length) throws SQLException {
10047:                throw new SQLFeatureNotSupportedException(resBundle
10048:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10049:                        .toString());
10050:            }
10051:
10052:            /**
10053:             * Sets the designated parameter to the given <code>Reader</code>
10054:             * object, which is the given number of characters long.
10055:             * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
10056:             * parameter, it may be more practical to send it via a
10057:             * <code>java.io.Reader</code> object. The data will be read from the stream
10058:             * as needed until end-of-file is reached.  The JDBC driver will
10059:             * do any necessary conversion from UNICODE to the database char format.
10060:             *
10061:             * <P><B>Note:</B> This stream object can either be a standard
10062:             * Java stream object or your own subclass that implements the
10063:             * standard interface.
10064:             *
10065:             * @param parameterName the name of the parameter
10066:             * @param reader the <code>java.io.Reader</code> object that
10067:             *        contains the UNICODE data used as the designated parameter
10068:             * @param length the number of characters in the stream
10069:             * @exception SQLException if a database access error occurs or
10070:             * this method is called on a closed <code>CallableStatement</code>
10071:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
10072:             * this method
10073:             * @since 1.4
10074:             */
10075:            public void setCharacterStream(String parameterName,
10076:                    java.io.Reader reader, int length) throws SQLException {
10077:                throw new SQLFeatureNotSupportedException(resBundle
10078:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10079:                        .toString());
10080:            }
10081:
10082:            /**
10083:             * Sets the designated parameter to the given input stream.
10084:             * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
10085:             * parameter, it may be more practical to send it via a
10086:             * <code>java.io.InputStream</code>. Data will be read from the stream
10087:             * as needed until end-of-file is reached.  The JDBC driver will
10088:             * do any necessary conversion from ASCII to the database char format.
10089:             *
10090:             * <P><B>Note:</B> This stream object can either be a standard
10091:             * Java stream object or your own subclass that implements the
10092:             * standard interface.
10093:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
10094:             * it might be more efficient to use a version of
10095:             * <code>setAsciiStream</code> which takes a length parameter.
10096:             *
10097:             * @param parameterName the name of the parameter
10098:             * @param x the Java input stream that contains the ASCII parameter value
10099:             * @exception SQLException if a database access error occurs or
10100:             * this method is called on a closed <code>CallableStatement</code>
10101:             * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
10102:             * @since 1.6
10103:             */
10104:            public void setAsciiStream(String parameterName,
10105:                    java.io.InputStream x) throws SQLException {
10106:                throw new SQLFeatureNotSupportedException(resBundle
10107:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10108:                        .toString());
10109:            }
10110:
10111:            /**
10112:             * Sets the designated parameter to the given input stream.
10113:             * When a very large binary value is input to a <code>LONGVARBINARY</code>
10114:             * parameter, it may be more practical to send it via a
10115:             * <code>java.io.InputStream</code> object. The data will be read from the
10116:             * stream as needed until end-of-file is reached.
10117:             *
10118:             * <P><B>Note:</B> This stream object can either be a standard
10119:             * Java stream object or your own subclass that implements the
10120:             * standard interface.
10121:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
10122:             * it might be more efficient to use a version of
10123:             * <code>setBinaryStream</code> which takes a length parameter.
10124:             *
10125:             * @param parameterName the name of the parameter
10126:             * @param x the java input stream which contains the binary parameter value
10127:             * @exception SQLException if a database access error occurs or
10128:             * this method is called on a closed <code>CallableStatement</code>
10129:             * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
10130:             * @since 1.6
10131:             */
10132:            public void setBinaryStream(String parameterName,
10133:                    java.io.InputStream x) throws SQLException {
10134:                throw new SQLFeatureNotSupportedException(resBundle
10135:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10136:                        .toString());
10137:            }
10138:
10139:            /**
10140:             * Sets the designated parameter to the given <code>Reader</code>
10141:             * object.
10142:             * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
10143:             * parameter, it may be more practical to send it via a
10144:             * <code>java.io.Reader</code> object. The data will be read from the stream
10145:             * as needed until end-of-file is reached.  The JDBC driver will
10146:             * do any necessary conversion from UNICODE to the database char format.
10147:             *
10148:             * <P><B>Note:</B> This stream object can either be a standard
10149:             * Java stream object or your own subclass that implements the
10150:             * standard interface.
10151:             * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
10152:             * it might be more efficient to use a version of
10153:             * <code>setCharacterStream</code> which takes a length parameter.
10154:             *
10155:             * @param parameterName the name of the parameter
10156:             * @param reader the <code>java.io.Reader</code> object that contains the
10157:             *        Unicode data
10158:             * @exception SQLException if a database access error occurs or
10159:             * this method is called on a closed <code>CallableStatement</code>
10160:             * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
10161:             * @since 1.6
10162:             */
10163:            public void setCharacterStream(String parameterName,
10164:                    java.io.Reader reader) throws SQLException {
10165:                throw new SQLFeatureNotSupportedException(resBundle
10166:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10167:                        .toString());
10168:            }
10169:
10170:            /**
10171:             * Sets the designated parameter to the given
10172:             * <code>java.math.BigDecimal</code> value.
10173:             * The driver converts this to an SQL <code>NUMERIC</code> value when
10174:             * it sends it to the database.
10175:             *
10176:             * @param parameterName the name of the parameter
10177:             * @param x the parameter value
10178:             * @exception SQLException if a database access error occurs or
10179:             * this method is called on a closed <code>CallableStatement</code>
10180:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
10181:             * this method
10182:             * @see #getBigDecimal
10183:             * @since 1.4
10184:             */
10185:            public void setBigDecimal(String parameterName, BigDecimal x)
10186:                    throws SQLException {
10187:                throw new SQLFeatureNotSupportedException(resBundle
10188:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10189:                        .toString());
10190:            }
10191:
10192:            /**
10193:             * Sets the designated parameter to the given Java <code>String</code> value.
10194:             * The driver converts this
10195:             * to an SQL <code>VARCHAR</code> or <code>LONGVARCHAR</code> value
10196:             * (depending on the argument's
10197:             * size relative to the driver's limits on <code>VARCHAR</code> values)
10198:             * when it sends it to the database.
10199:             *
10200:             * @param parameterName the name of the parameter
10201:             * @param x the parameter value
10202:             * @exception SQLException if a database access error occurs or
10203:             * this method is called on a closed <code>CallableStatement</code>
10204:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
10205:             * this method
10206:             * @see #getString
10207:             * @since 1.4
10208:             */
10209:            public void setString(String parameterName, String x)
10210:                    throws SQLException {
10211:                throw new SQLFeatureNotSupportedException(resBundle
10212:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10213:                        .toString());
10214:            }
10215:
10216:            /**
10217:             * Sets the designated parameter to the given Java array of bytes.
10218:             * The driver converts this to an SQL <code>VARBINARY</code> or
10219:             * <code>LONGVARBINARY</code> (depending on the argument's size relative
10220:             * to the driver's limits on <code>VARBINARY</code> values) when it sends
10221:             * it to the database.
10222:             *
10223:             * @param parameterName the name of the parameter
10224:             * @param x the parameter value
10225:             * @exception SQLException if a database access error occurs or
10226:             * this method is called on a closed <code>CallableStatement</code>
10227:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
10228:             * this method
10229:             * @see #getBytes
10230:             * @since 1.4
10231:             */
10232:            public void setBytes(String parameterName, byte x[])
10233:                    throws SQLException {
10234:                throw new SQLFeatureNotSupportedException(resBundle
10235:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10236:                        .toString());
10237:            }
10238:
10239:            /**
10240:             * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value.
10241:             * The driver
10242:             * converts this to an SQL <code>TIMESTAMP</code> value when it sends it to the
10243:             * database.
10244:             *
10245:             * @param parameterName the name of the parameter
10246:             * @param x the parameter value
10247:             * @exception SQLException if a database access error occurs or
10248:             * this method is called on a closed <code>CallableStatement</code>
10249:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
10250:             * this method
10251:             * @see #getTimestamp
10252:             * @since 1.4
10253:             */
10254:            public void setTimestamp(String parameterName, java.sql.Timestamp x)
10255:                    throws SQLException {
10256:                throw new SQLFeatureNotSupportedException(resBundle
10257:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10258:                        .toString());
10259:            }
10260:
10261:            /**
10262:             * Sets the designated parameter to SQL <code>NULL</code>.
10263:             *
10264:             * <P><B>Note:</B> You must specify the parameter's SQL type.
10265:             *
10266:             * @param parameterName the name of the parameter
10267:             * @param sqlType the SQL type code defined in <code>java.sql.Types</code>
10268:             * @exception SQLException if a database access error occurs or
10269:             * this method is called on a closed <code>CallableStatement</code>
10270:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
10271:             * this method
10272:             * @since 1.4
10273:             */
10274:            public void setNull(String parameterName, int sqlType)
10275:                    throws SQLException {
10276:                throw new SQLFeatureNotSupportedException(resBundle
10277:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10278:                        .toString());
10279:            }
10280:
10281:            /**
10282:             * Sets the designated parameter to SQL <code>NULL</code>.
10283:             * This version of the method <code>setNull</code> should
10284:             * be used for user-defined types and REF type parameters.  Examples
10285:             * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and
10286:             * named array types.
10287:             *
10288:             * <P><B>Note:</B> To be portable, applications must give the
10289:             * SQL type code and the fully-qualified SQL type name when specifying
10290:             * a NULL user-defined or REF parameter.  In the case of a user-defined type
10291:             * the name is the type name of the parameter itself.  For a REF
10292:             * parameter, the name is the type name of the referenced type.  If
10293:             * a JDBC driver does not need the type code or type name information,
10294:             * it may ignore it.
10295:             *
10296:             * Although it is intended for user-defined and Ref parameters,
10297:             * this method may be used to set a null parameter of any JDBC type.
10298:             * If the parameter does not have a user-defined or REF type, the given
10299:             * typeName is ignored.
10300:             *
10301:             *
10302:             * @param parameterName the name of the parameter
10303:             * @param sqlType a value from <code>java.sql.Types</code>
10304:             * @param typeName the fully-qualified name of an SQL user-defined type;
10305:             *        ignored if the parameter is not a user-defined type or
10306:             *        SQL <code>REF</code> value
10307:             * @exception SQLException if a database access error occurs or
10308:             * this method is called on a closed <code>CallableStatement</code>
10309:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
10310:             * this method
10311:             * @since 1.4
10312:             */
10313:            public void setNull(String parameterName, int sqlType,
10314:                    String typeName) throws SQLException {
10315:                throw new SQLFeatureNotSupportedException(resBundle
10316:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10317:                        .toString());
10318:            }
10319:
10320:            /**
10321:             * Sets the designated parameter to the given Java <code>boolean</code> value.
10322:             * The driver converts this
10323:             * to an SQL <code>BIT</code> or <code>BOOLEAN</code> value when it sends it to the database.
10324:             *
10325:             * @param parameterName the name of the parameter
10326:             * @param x the parameter value
10327:             * @exception SQLException if a database access error occurs or
10328:             * this method is called on a closed <code>CallableStatement</code>
10329:             * @see #getBoolean
10330:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
10331:             * this method
10332:             * @since 1.4
10333:             */
10334:            public void setBoolean(String parameterName, boolean x)
10335:                    throws SQLException {
10336:                throw new SQLFeatureNotSupportedException(resBundle
10337:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10338:                        .toString());
10339:            }
10340:
10341:            /**
10342:             * Sets the designated parameter to the given Java <code>byte</code> value.
10343:             * The driver converts this
10344:             * to an SQL <code>TINYINT</code> value when it sends it to the database.
10345:             *
10346:             * @param parameterName the name of the parameter
10347:             * @param x the parameter value
10348:             * @exception SQLException if a database access error occurs or
10349:             * this method is called on a closed <code>CallableStatement</code>
10350:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
10351:             * this method
10352:             * @see #getByte
10353:             * @since 1.4
10354:             */
10355:            public void setByte(String parameterName, byte x)
10356:                    throws SQLException {
10357:                throw new SQLFeatureNotSupportedException(resBundle
10358:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10359:                        .toString());
10360:            }
10361:
10362:            /**
10363:             * Sets the designated parameter to the given Java <code>short</code> value.
10364:             * The driver converts this
10365:             * to an SQL <code>SMALLINT</code> value when it sends it to the database.
10366:             *
10367:             * @param parameterName the name of the parameter
10368:             * @param x the parameter value
10369:             * @exception SQLException if a database access error occurs or
10370:             * this method is called on a closed <code>CallableStatement</code>
10371:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
10372:             * this method
10373:             * @see #getShort
10374:             * @since 1.4
10375:             */
10376:            public void setShort(String parameterName, short x)
10377:                    throws SQLException {
10378:                throw new SQLFeatureNotSupportedException(resBundle
10379:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10380:                        .toString());
10381:            }
10382:
10383:            /**
10384:             * Sets the designated parameter to the given Java <code>int</code> value.
10385:             * The driver converts this
10386:             * to an SQL <code>INTEGER</code> value when it sends it to the database.
10387:             *
10388:             * @param parameterName the name of the parameter
10389:             * @param x the parameter value
10390:             * @exception SQLException if a database access error occurs or
10391:             * this method is called on a closed <code>CallableStatement</code>
10392:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
10393:             * this method
10394:             * @see #getInt
10395:             * @since 1.4
10396:             */
10397:            public void setInt(String parameterName, int x) throws SQLException {
10398:                throw new SQLFeatureNotSupportedException(resBundle
10399:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10400:                        .toString());
10401:            }
10402:
10403:            /**
10404:             * Sets the designated parameter to the given Java <code>long</code> value.
10405:             * The driver converts this
10406:             * to an SQL <code>BIGINT</code> value when it sends it to the database.
10407:             *
10408:             * @param parameterName the name of the parameter
10409:             * @param x the parameter value
10410:             * @exception SQLException if a database access error occurs or
10411:             * this method is called on a closed <code>CallableStatement</code>
10412:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
10413:             * this method
10414:             * @see #getLong
10415:             * @since 1.4
10416:             */
10417:            public void setLong(String parameterName, long x)
10418:                    throws SQLException {
10419:                throw new SQLFeatureNotSupportedException(resBundle
10420:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10421:                        .toString());
10422:            }
10423:
10424:            /**
10425:             * Sets the designated parameter to the given Java <code>float</code> value.
10426:             * The driver converts this
10427:             * to an SQL <code>FLOAT</code> value when it sends it to the database.
10428:             *
10429:             * @param parameterName the name of the parameter
10430:             * @param x the parameter value
10431:             * @exception SQLException if a database access error occurs or
10432:             * this method is called on a closed <code>CallableStatement</code>
10433:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
10434:             * this method
10435:             * @see #getFloat
10436:             * @since 1.4
10437:             */
10438:            public void setFloat(String parameterName, float x)
10439:                    throws SQLException {
10440:                throw new SQLFeatureNotSupportedException(resBundle
10441:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10442:                        .toString());
10443:            }
10444:
10445:            /**
10446:             * Sets the designated parameter to the given Java <code>double</code> value.
10447:             * The driver converts this
10448:             * to an SQL <code>DOUBLE</code> value when it sends it to the database.
10449:             *
10450:             * @param parameterName the name of the parameter
10451:             * @param x the parameter value
10452:             * @exception SQLException if a database access error occurs or
10453:             * this method is called on a closed <code>CallableStatement</code>
10454:             * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
10455:             * this method
10456:             * @see #getDouble
10457:             * @since 1.4
10458:             */
10459:            public void setDouble(String parameterName, double x)
10460:                    throws SQLException {
10461:                throw new SQLFeatureNotSupportedException(resBundle
10462:                        .handleGetObject("cachedrowsetimpl.featnotsupp")
10463:                        .toString());
10464:            }
10465:
10466:            /**
10467:             * This method re populates the resBundle
10468:             * during the deserialization process 
10469:             *
10470:             */
10471:            protected void readObject(ObjectInputStream ois)
10472:                    throws IOException, ClassNotFoundException {
10473:                // Default state initialization happens here 
10474:                ois.defaultReadObject();
10475:                // Initialization of transient Res Bundle happens here . 
10476:                try {
10477:                    resBundle = JdbcRowSetResourceBundle
10478:                            .getJdbcRowSetResourceBundle();
10479:                } catch (IOException ioe) {
10480:                    throw new RuntimeException(ioe);
10481:                }
10482:
10483:            }
10484:
10485:            static final long serialVersionUID = 1884577171200622428L;
10486:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.