Source Code Cross Referenced for JdbcResultSet.java in  » Database-DBMS » h2database » org » h2 » jdbc » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » h2database » org.h2.jdbc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
0003:         * (http://h2database.com/html/license.html).
0004:         * Initial Developer: H2 Group
0005:         */
0006:        package org.h2.jdbc;
0007:
0008:        import java.io.InputStream;
0009:        import java.io.Reader;
0010:        import java.math.BigDecimal;
0011:        import java.net.URL;
0012:        import java.sql.Array;
0013:        import java.sql.Blob;
0014:        import java.sql.Clob;
0015:        import java.sql.Date;
0016:        import java.sql.Ref;
0017:        import java.sql.ResultSet;
0018:        import java.sql.ResultSetMetaData;
0019:        import java.sql.SQLException;
0020:        import java.sql.SQLWarning;
0021:        import java.sql.Statement;
0022:        import java.sql.Time;
0023:        import java.sql.Timestamp;
0024:        import java.util.Calendar;
0025:        import java.util.HashMap;
0026:        import java.util.Map;
0027:
0028:        //#ifdef JDK16
0029:        /*
0030:         import java.sql.NClob;
0031:         import java.sql.RowId;
0032:         import java.sql.SQLXML;
0033:         */
0034:        //#endif
0035:        import org.h2.constant.ErrorCode;
0036:        import org.h2.constant.SysProperties;
0037:        import org.h2.engine.Constants;
0038:        import org.h2.engine.SessionInterface;
0039:        import org.h2.message.Message;
0040:        import org.h2.message.TraceObject;
0041:        import org.h2.result.ResultInterface;
0042:        import org.h2.result.UpdatableRow;
0043:        import org.h2.util.DateTimeUtils;
0044:        import org.h2.util.IOUtils;
0045:        import org.h2.util.MathUtils;
0046:        import org.h2.util.ObjectUtils;
0047:        import org.h2.util.StringUtils;
0048:        import org.h2.value.DataType;
0049:        import org.h2.value.Value;
0050:        import org.h2.value.ValueBoolean;
0051:        import org.h2.value.ValueByte;
0052:        import org.h2.value.ValueBytes;
0053:        import org.h2.value.ValueDate;
0054:        import org.h2.value.ValueDecimal;
0055:        import org.h2.value.ValueDouble;
0056:        import org.h2.value.ValueFloat;
0057:        import org.h2.value.ValueInt;
0058:        import org.h2.value.ValueLong;
0059:        import org.h2.value.ValueNull;
0060:        import org.h2.value.ValueShort;
0061:        import org.h2.value.ValueString;
0062:        import org.h2.value.ValueTime;
0063:        import org.h2.value.ValueTimestamp;
0064:
0065:        /**
0066:         * Represents a result set. Column names are case-insensitive, quotes are not
0067:         * supported. The first column has the column index 1. Result sets are updatable
0068:         * when the result only contains columns from one table, and if it contains all
0069:         * columns of a unique index (primary key or other) of this table.
0070:         */
0071:        public class JdbcResultSet extends TraceObject implements  ResultSet {
0072:            private final SessionInterface session;
0073:            private final boolean closeStatement;
0074:            private final boolean scrollable;
0075:            private ResultInterface result;
0076:            private JdbcConnection conn;
0077:            private JdbcStatement stat;
0078:            private int columnCount;
0079:            private boolean wasNull;
0080:            private Value[] insertRow;
0081:            private Value[] updateRow;
0082:            private HashMap columnNameMap;
0083:
0084:            JdbcResultSet(SessionInterface session, JdbcConnection conn,
0085:                    JdbcStatement stat, ResultInterface result, int id,
0086:                    boolean closeStatement, boolean scrollable) {
0087:                setTrace(session.getTrace(), TraceObject.RESULT_SET, id);
0088:                this .session = session;
0089:                this .conn = conn;
0090:                this .stat = stat;
0091:                this .result = result;
0092:                columnCount = result.getVisibleColumnCount();
0093:                this .closeStatement = closeStatement;
0094:                this .scrollable = scrollable;
0095:            }
0096:
0097:            /**
0098:             * Moves the cursor to the next row of the result set.
0099:             *
0100:             * @return true if successful, false if there are no more rows
0101:             */
0102:            public boolean next() throws SQLException {
0103:                try {
0104:                    debugCodeCall("next");
0105:                    checkClosed();
0106:                    return nextRow();
0107:                } catch (Throwable e) {
0108:                    throw logAndConvert(e);
0109:                }
0110:            }
0111:
0112:            /**
0113:             * Gets the meta data of this result set.
0114:             *
0115:             * @return the meta data
0116:             */
0117:            public ResultSetMetaData getMetaData() throws SQLException {
0118:                try {
0119:                    int id = getNextId(TraceObject.RESULT_SET_META_DATA);
0120:                    if (debug()) {
0121:                        debugCodeAssign("ResultSetMetaData",
0122:                                TraceObject.RESULT_SET_META_DATA, id,
0123:                                "getMetaData()");
0124:                    }
0125:                    checkClosed();
0126:                    String catalog = conn.getCatalog();
0127:                    JdbcResultSetMetaData meta = new JdbcResultSetMetaData(
0128:                            this , null, result, catalog, session.getTrace(), id);
0129:                    return meta;
0130:                } catch (Throwable e) {
0131:                    throw logAndConvert(e);
0132:                }
0133:            }
0134:
0135:            /**
0136:             * Returns whether the last column accessed was a null value.
0137:             *
0138:             * @return true if the last column accessed was a null value
0139:             */
0140:            public boolean wasNull() throws SQLException {
0141:                try {
0142:                    debugCodeCall("wasNull");
0143:                    checkClosed();
0144:                    return wasNull;
0145:                } catch (Throwable e) {
0146:                    throw logAndConvert(e);
0147:                }
0148:            }
0149:
0150:            /**
0151:             * Searches for a specific column in the result set. A case-insensitive
0152:             * search is made.
0153:             * 
0154:             * @param columnName the name of the column label
0155:             * @return the column index (1,2,...)
0156:             * @throws SQLException if the column is not found or if the result set is
0157:             *             closed
0158:             */
0159:            public int findColumn(String columnName) throws SQLException {
0160:                try {
0161:                    debugCodeCall("findColumn", columnName);
0162:                    return getColumnIndex(columnName);
0163:                } catch (Throwable e) {
0164:                    throw logAndConvert(e);
0165:                }
0166:            }
0167:
0168:            /**
0169:             * Closes the result set.
0170:             */
0171:            public void close() throws SQLException {
0172:                try {
0173:                    debugCodeCall("close");
0174:                    closeInternal();
0175:                } catch (Throwable e) {
0176:                    throw logAndConvert(e);
0177:                }
0178:            }
0179:
0180:            void closeInternal() throws SQLException {
0181:                if (result != null) {
0182:                    try {
0183:                        result.close();
0184:                        if (closeStatement && stat != null) {
0185:                            stat.close();
0186:                        }
0187:                    } finally {
0188:                        columnCount = 0;
0189:                        result = null;
0190:                        stat = null;
0191:                        conn = null;
0192:                        insertRow = null;
0193:                        updateRow = null;
0194:                    }
0195:                }
0196:            }
0197:
0198:            /**
0199:             * Returns the statement that created this object.
0200:             * 
0201:             * @return the statement or prepared statement, or null if created by a
0202:             *         DatabaseMetaData call.
0203:             */
0204:            public Statement getStatement() throws SQLException {
0205:                try {
0206:                    debugCodeCall("getStatement");
0207:                    checkClosed();
0208:                    if (closeStatement) {
0209:                        // if the result set was opened by a DatabaseMetaData call
0210:                        return null;
0211:                    }
0212:                    return stat;
0213:                } catch (Throwable e) {
0214:                    throw logAndConvert(e);
0215:                }
0216:            }
0217:
0218:            /**
0219:             * Gets the first warning reported by calls on this object.
0220:             *
0221:             * @return null
0222:             */
0223:            public SQLWarning getWarnings() throws SQLException {
0224:                try {
0225:                    debugCodeCall("getWarnings");
0226:                    checkClosed();
0227:                    return null;
0228:                } catch (Throwable e) {
0229:                    throw logAndConvert(e);
0230:                }
0231:            }
0232:
0233:            /**
0234:             * Clears all warnings.
0235:             */
0236:            public void clearWarnings() throws SQLException {
0237:                try {
0238:                    debugCodeCall("clearWarnings");
0239:                    checkClosed();
0240:                } catch (Throwable e) {
0241:                    throw logAndConvert(e);
0242:                }
0243:            }
0244:
0245:            // =============================================================
0246:
0247:            /**
0248:             * Returns the value of the specified column as a String.
0249:             *
0250:             * @param columnIndex (1,2,...)
0251:             * @return the value
0252:             * @throws SQLException if the column is not found or if the result set is closed
0253:             */
0254:            public String getString(int columnIndex) throws SQLException {
0255:                try {
0256:                    debugCodeCall("getString", columnIndex);
0257:                    return get(columnIndex).getString();
0258:                } catch (Throwable e) {
0259:                    throw logAndConvert(e);
0260:                }
0261:            }
0262:
0263:            /**
0264:             * Returns the value of the specified column as a String.
0265:             *
0266:             * @param columnName the name of the column label
0267:             * @return the value
0268:             * @throws SQLException if the column is not found or if the result set is closed
0269:             */
0270:            public String getString(String columnName) throws SQLException {
0271:                try {
0272:                    debugCodeCall("getString", columnName);
0273:                    return get(columnName).getString();
0274:                } catch (Throwable e) {
0275:                    throw logAndConvert(e);
0276:                }
0277:            }
0278:
0279:            /**
0280:             * Returns the value of the specified column as an int.
0281:             *
0282:             * @param columnIndex (1,2,...)
0283:             * @return the value
0284:             * @throws SQLException if the column is not found or if the result set is closed
0285:             */
0286:            public int getInt(int columnIndex) throws SQLException {
0287:                try {
0288:                    debugCodeCall("getInt", columnIndex);
0289:                    return get(columnIndex).getInt();
0290:                } catch (Throwable e) {
0291:                    throw logAndConvert(e);
0292:                }
0293:            }
0294:
0295:            /**
0296:             * Returns the value of the specified column as an int.
0297:             *
0298:             * @param columnName the name of the column label
0299:             * @return the value
0300:             * @throws SQLException if the column is not found or if the result set is closed
0301:             */
0302:            public int getInt(String columnName) throws SQLException {
0303:                try {
0304:                    debugCodeCall("getInt", columnName);
0305:                    return get(columnName).getInt();
0306:                } catch (Throwable e) {
0307:                    throw logAndConvert(e);
0308:                }
0309:            }
0310:
0311:            /**
0312:             * Returns the value of the specified column as a String.
0313:             *
0314:             * @param columnIndex (1,2,...)
0315:             * @return the value
0316:             * @throws SQLException if the column is not found or if the result set is closed
0317:             */
0318:            public BigDecimal getBigDecimal(int columnIndex)
0319:                    throws SQLException {
0320:                try {
0321:                    debugCodeCall("getBigDecimal", columnIndex);
0322:                    return get(columnIndex).getBigDecimal();
0323:                } catch (Throwable e) {
0324:                    throw logAndConvert(e);
0325:                }
0326:            }
0327:
0328:            /**
0329:             * Returns the value of the specified column as a java.sql.Date.
0330:             *
0331:             * @param columnIndex (1,2,...)
0332:             * @return the value
0333:             * @throws SQLException if the column is not found or if the result set is closed
0334:             */
0335:            public Date getDate(int columnIndex) throws SQLException {
0336:                try {
0337:                    debugCodeCall("getDate", columnIndex);
0338:                    return get(columnIndex).getDate();
0339:                } catch (Throwable e) {
0340:                    throw logAndConvert(e);
0341:                }
0342:            }
0343:
0344:            /**
0345:             * Returns the value of the specified column as a java.sql.Time.
0346:             *
0347:             * @param columnIndex (1,2,...)
0348:             * @return the value
0349:             * @throws SQLException if the column is not found or if the result set is closed
0350:             */
0351:            public Time getTime(int columnIndex) throws SQLException {
0352:                try {
0353:                    debugCodeCall("getTime", columnIndex);
0354:                    return get(columnIndex).getTime();
0355:                } catch (Throwable e) {
0356:                    throw logAndConvert(e);
0357:                }
0358:            }
0359:
0360:            /**
0361:             * Returns the value of the specified column as a java.sql.Timestamp.
0362:             *
0363:             * @param columnIndex (1,2,...)
0364:             * @return the value
0365:             * @throws SQLException if the column is not found or if the result set is closed
0366:             */
0367:            public Timestamp getTimestamp(int columnIndex) throws SQLException {
0368:                try {
0369:                    debugCodeCall("getTimestamp", columnIndex);
0370:                    return get(columnIndex).getTimestamp();
0371:                } catch (Throwable e) {
0372:                    throw logAndConvert(e);
0373:                }
0374:            }
0375:
0376:            /**
0377:             * Returns the value of the specified column as a String.
0378:             *
0379:             * @param columnName the name of the column label
0380:             * @return the value
0381:             * @throws SQLException if the column is not found or if the result set is closed
0382:             */
0383:            public BigDecimal getBigDecimal(String columnName)
0384:                    throws SQLException {
0385:                try {
0386:                    debugCodeCall("getBigDecimal", columnName);
0387:                    return get(columnName).getBigDecimal();
0388:                } catch (Throwable e) {
0389:                    throw logAndConvert(e);
0390:                }
0391:            }
0392:
0393:            /**
0394:             * Returns the value of the specified column as a java.sql.Date.
0395:             *
0396:             * @param columnName the name of the column label
0397:             * @return the value
0398:             * @throws SQLException if the column is not found or if the result set is closed
0399:             */
0400:            public Date getDate(String columnName) throws SQLException {
0401:                try {
0402:                    debugCodeCall("getDate", columnName);
0403:                    return get(columnName).getDate();
0404:                } catch (Throwable e) {
0405:                    throw logAndConvert(e);
0406:                }
0407:            }
0408:
0409:            /**
0410:             * Returns the value of the specified column as a java.sql.Time.
0411:             *
0412:             * @param columnName the name of the column label
0413:             * @return the value
0414:             * @throws SQLException if the column is not found or if the result set is closed
0415:             */
0416:            public Time getTime(String columnName) throws SQLException {
0417:                try {
0418:                    debugCodeCall("getTime", columnName);
0419:                    return get(columnName).getTime();
0420:                } catch (Throwable e) {
0421:                    throw logAndConvert(e);
0422:                }
0423:            }
0424:
0425:            /**
0426:             * Returns the value of the specified column as a java.sql.Timestamp.
0427:             *
0428:             * @param columnName the name of the column label
0429:             * @return the value
0430:             * @throws SQLException if the column is not found or if the result set is closed
0431:             */
0432:            public Timestamp getTimestamp(String columnName)
0433:                    throws SQLException {
0434:                try {
0435:                    debugCodeCall("getTimestamp", columnName);
0436:                    return get(columnName).getTimestamp();
0437:                } catch (Throwable e) {
0438:                    throw logAndConvert(e);
0439:                }
0440:            }
0441:
0442:            /**
0443:             * Returns a column value as a Java object. For BINARY data, the data is
0444:             * de-serialized into a Java Object.
0445:             * 
0446:             * @param columnIndex (1,2,...)
0447:             * @return the value or null
0448:             * @throws SQLException if the column is not found or if the result set is
0449:             *             closed
0450:             */
0451:            public Object getObject(int columnIndex) throws SQLException {
0452:                try {
0453:                    debugCodeCall("getObject", columnIndex);
0454:                    Value v = get(columnIndex);
0455:                    if (Constants.SERIALIZE_JAVA_OBJECTS) {
0456:                        if (v.getType() == Value.JAVA_OBJECT) {
0457:                            return ObjectUtils.deserialize(v.getBytesNoCopy());
0458:                        }
0459:                    }
0460:                    return v.getObject();
0461:                } catch (Throwable e) {
0462:                    throw logAndConvert(e);
0463:                }
0464:            }
0465:
0466:            /**
0467:             * Returns a column value as a Java object. For BINARY data, the data is
0468:             * de-serialized into a Java Object.
0469:             * 
0470:             * @param columnName the name of the column label
0471:             * @return the value or null
0472:             * @throws SQLException if the column is not found or if the result set is
0473:             *             closed
0474:             */
0475:            public Object getObject(String columnName) throws SQLException {
0476:                try {
0477:                    debugCodeCall("getObject", columnName);
0478:                    Value v = get(columnName);
0479:                    if (Constants.SERIALIZE_JAVA_OBJECTS) {
0480:                        if (v.getType() == Value.JAVA_OBJECT) {
0481:                            return ObjectUtils.deserialize(v.getBytesNoCopy());
0482:                        }
0483:                    }
0484:                    return v.getObject();
0485:                } catch (Throwable e) {
0486:                    throw logAndConvert(e);
0487:                }
0488:            }
0489:
0490:            /**
0491:             * Returns the value of the specified column as a boolean.
0492:             * 
0493:             * @param columnIndex (1,2,...)
0494:             * @return the value
0495:             * @throws SQLException if the column is not found or if the result set is
0496:             *             closed
0497:             */
0498:            public boolean getBoolean(int columnIndex) throws SQLException {
0499:                try {
0500:                    debugCodeCall("getBoolean", columnIndex);
0501:                    Boolean v = get(columnIndex).getBoolean();
0502:                    return v == null ? false : v.booleanValue();
0503:                } catch (Throwable e) {
0504:                    throw logAndConvert(e);
0505:                }
0506:            }
0507:
0508:            /**
0509:             * Returns the value of the specified column as a boolean.
0510:             * 
0511:             * @param columnName the name of the column label
0512:             * @return the value
0513:             * @throws SQLException if the column is not found or if the result set is
0514:             *             closed
0515:             */
0516:            public boolean getBoolean(String columnName) throws SQLException {
0517:                try {
0518:                    debugCodeCall("getBoolean", columnName);
0519:                    Boolean v = get(columnName).getBoolean();
0520:                    return v == null ? false : v.booleanValue();
0521:                } catch (Throwable e) {
0522:                    throw logAndConvert(e);
0523:                }
0524:            }
0525:
0526:            /**
0527:             * Returns the value of the specified column as a byte.
0528:             * 
0529:             * @param columnIndex (1,2,...)
0530:             * @return the value
0531:             * @throws SQLException if the column is not found or if the result set is
0532:             *             closed
0533:             */
0534:            public byte getByte(int columnIndex) throws SQLException {
0535:                try {
0536:                    debugCodeCall("getByte", columnIndex);
0537:                    return get(columnIndex).getByte();
0538:                } catch (Throwable e) {
0539:                    throw logAndConvert(e);
0540:                }
0541:            }
0542:
0543:            /**
0544:             * Returns the value of the specified column as a byte.
0545:             * 
0546:             * @param columnName the name of the column label
0547:             * @return the value
0548:             * @throws SQLException if the column is not found or if the result set is
0549:             *             closed
0550:             */
0551:            public byte getByte(String columnName) throws SQLException {
0552:                try {
0553:                    debugCodeCall("getByte", columnName);
0554:                    return get(columnName).getByte();
0555:                } catch (Throwable e) {
0556:                    throw logAndConvert(e);
0557:                }
0558:            }
0559:
0560:            /**
0561:             * Returns the value of the specified column as a short.
0562:             * 
0563:             * @param columnIndex (1,2,...)
0564:             * @return the value
0565:             * @throws SQLException if the column is not found or if the result set is
0566:             *             closed
0567:             */
0568:            public short getShort(int columnIndex) throws SQLException {
0569:                try {
0570:                    debugCodeCall("getShort", columnIndex);
0571:                    return get(columnIndex).getShort();
0572:                } catch (Throwable e) {
0573:                    throw logAndConvert(e);
0574:                }
0575:            }
0576:
0577:            /**
0578:             * Returns the value of the specified column as a short.
0579:             * 
0580:             * @param columnName the name of the column label
0581:             * @return the value
0582:             * @throws SQLException if the column is not found or if the result set is
0583:             *             closed
0584:             */
0585:            public short getShort(String columnName) throws SQLException {
0586:                try {
0587:                    debugCodeCall("getShort", columnName);
0588:                    return get(columnName).getShort();
0589:                } catch (Throwable e) {
0590:                    throw logAndConvert(e);
0591:                }
0592:            }
0593:
0594:            /**
0595:             * Returns the value of the specified column as a long.
0596:             * 
0597:             * @param columnIndex (1,2,...)
0598:             * @return the value
0599:             * @throws SQLException if the column is not found or if the result set is
0600:             *             closed
0601:             */
0602:            public long getLong(int columnIndex) throws SQLException {
0603:                try {
0604:                    debugCodeCall("getLong", columnIndex);
0605:                    return get(columnIndex).getLong();
0606:                } catch (Throwable e) {
0607:                    throw logAndConvert(e);
0608:                }
0609:            }
0610:
0611:            /**
0612:             * Returns the value of the specified column as a long.
0613:             * 
0614:             * @param columnName the name of the column label
0615:             * @return the value
0616:             * @throws SQLException if the column is not found or if the result set is
0617:             *             closed
0618:             */
0619:            public long getLong(String columnName) throws SQLException {
0620:                try {
0621:                    debugCodeCall("getLong", columnName);
0622:                    return get(columnName).getLong();
0623:                } catch (Throwable e) {
0624:                    throw logAndConvert(e);
0625:                }
0626:            }
0627:
0628:            /**
0629:             * Returns the value of the specified column as a float.
0630:             * 
0631:             * @param columnIndex (1,2,...)
0632:             * @return the value
0633:             * @throws SQLException if the column is not found or if the result set is
0634:             *             closed
0635:             */
0636:            public float getFloat(int columnIndex) throws SQLException {
0637:                try {
0638:                    debugCodeCall("getFloat", columnIndex);
0639:                    return get(columnIndex).getFloat();
0640:                } catch (Throwable e) {
0641:                    throw logAndConvert(e);
0642:                }
0643:            }
0644:
0645:            /**
0646:             * Returns the value of the specified column as a float.
0647:             * 
0648:             * @param columnName the name of the column label
0649:             * @return the value
0650:             * @throws SQLException if the column is not found or if the result set is
0651:             *             closed
0652:             */
0653:            public float getFloat(String columnName) throws SQLException {
0654:                try {
0655:                    debugCodeCall("getFloat", columnName);
0656:                    return get(columnName).getFloat();
0657:                } catch (Throwable e) {
0658:                    throw logAndConvert(e);
0659:                }
0660:            }
0661:
0662:            /**
0663:             * Returns the value of the specified column as a double.
0664:             * 
0665:             * @param columnIndex (1,2,...)
0666:             * @return the value
0667:             * @throws SQLException if the column is not found or if the result set is
0668:             *             closed
0669:             */
0670:            public double getDouble(int columnIndex) throws SQLException {
0671:                try {
0672:                    debugCodeCall("getDouble", columnIndex);
0673:                    return get(columnIndex).getDouble();
0674:                } catch (Throwable e) {
0675:                    throw logAndConvert(e);
0676:                }
0677:            }
0678:
0679:            /**
0680:             * Returns the value of the specified column as a double.
0681:             * 
0682:             * @param columnName the name of the column label
0683:             * @return the value
0684:             * @throws SQLException if the column is not found or if the result set is
0685:             *             closed
0686:             */
0687:            public double getDouble(String columnName) throws SQLException {
0688:                try {
0689:                    debugCodeCall("getDouble", columnName);
0690:                    return get(columnName).getDouble();
0691:                } catch (Throwable e) {
0692:                    throw logAndConvert(e);
0693:                }
0694:            }
0695:
0696:            /**
0697:             * Returns the value of the specified column as a String.
0698:             * 
0699:             * @deprecated
0700:             * 
0701:             * @param columnName
0702:             * @return the value
0703:             * @throws SQLException if the column is not found or if the result set is
0704:             *             closed
0705:             */
0706:            public BigDecimal getBigDecimal(String columnName, int scale)
0707:                    throws SQLException {
0708:                try {
0709:                    if (debug()) {
0710:                        debugCode("getBigDecimal("
0711:                                + StringUtils.quoteJavaString(columnName)
0712:                                + ", " + scale + ");");
0713:                    }
0714:                    if (scale < 0) {
0715:                        throw Message.getInvalidValueException("" + scale,
0716:                                "scale");
0717:                    }
0718:                    BigDecimal bd = get(columnName).getBigDecimal();
0719:                    return bd == null ? null : MathUtils.setScale(bd, scale);
0720:                } catch (Throwable e) {
0721:                    throw logAndConvert(e);
0722:                }
0723:            }
0724:
0725:            /**
0726:             * Returns the value of the specified column as a String.
0727:             * 
0728:             * @deprecated
0729:             * 
0730:             * @param columnIndex (1,2,...)
0731:             * @return the value
0732:             * @throws SQLException if the column is not found or if the result set is
0733:             *             closed
0734:             */
0735:            public BigDecimal getBigDecimal(int columnIndex, int scale)
0736:                    throws SQLException {
0737:                try {
0738:                    if (debug()) {
0739:                        debugCode("getBigDecimal(" + columnIndex + ", " + scale
0740:                                + ");");
0741:                    }
0742:                    if (scale < 0) {
0743:                        throw Message.getInvalidValueException("" + scale,
0744:                                "scale");
0745:                    }
0746:                    BigDecimal bd = get(columnIndex).getBigDecimal();
0747:                    return bd == null ? null : MathUtils.setScale(bd, scale);
0748:                } catch (Throwable e) {
0749:                    throw logAndConvert(e);
0750:                }
0751:            }
0752:
0753:            /**
0754:             * [Not supported]
0755:             * @deprecated
0756:             */
0757:            public InputStream getUnicodeStream(int columnIndex)
0758:                    throws SQLException {
0759:                try {
0760:                    debugCodeCall("getUnicodeStream", columnIndex);
0761:                    throw Message.getUnsupportedException();
0762:                } catch (Throwable e) {
0763:                    throw logAndConvert(e);
0764:                }
0765:            }
0766:
0767:            /**
0768:             * [Not supported]
0769:             * @deprecated
0770:             */
0771:            public InputStream getUnicodeStream(String columnName)
0772:                    throws SQLException {
0773:                try {
0774:                    debugCodeCall("getUnicodeStream", columnName);
0775:                    throw Message.getUnsupportedException();
0776:                } catch (Throwable e) {
0777:                    throw logAndConvert(e);
0778:                }
0779:            }
0780:
0781:            /**
0782:             * [Not supported] Gets a column as a object using the specified type
0783:             * mapping.
0784:             */
0785:            public Object getObject(int columnIndex, Map map)
0786:                    throws SQLException {
0787:                try {
0788:                    if (debug()) {
0789:                        debugCode("getObject(" + columnIndex + ", map);");
0790:                    }
0791:                    throw Message.getUnsupportedException();
0792:                } catch (Throwable e) {
0793:                    throw logAndConvert(e);
0794:                }
0795:            }
0796:
0797:            /**
0798:             * [Not supported] Gets a column as a object using the specified type
0799:             * mapping.
0800:             */
0801:            public Object getObject(String columnName, Map map)
0802:                    throws SQLException {
0803:                try {
0804:                    if (debug()) {
0805:                        debugCode("getObject(" + quote(columnName) + ", map);");
0806:                    }
0807:                    throw Message.getUnsupportedException();
0808:                } catch (Throwable e) {
0809:                    throw logAndConvert(e);
0810:                }
0811:            }
0812:
0813:            /**
0814:             * [Not supported] Gets a column as a reference.
0815:             */
0816:            public Ref getRef(int columnIndex) throws SQLException {
0817:                try {
0818:                    debugCodeCall("getRef", columnIndex);
0819:                    throw Message.getUnsupportedException();
0820:                } catch (Throwable e) {
0821:                    throw logAndConvert(e);
0822:                }
0823:            }
0824:
0825:            /**
0826:             * [Not supported] Gets a column as a reference.
0827:             */
0828:            public Ref getRef(String columnName) throws SQLException {
0829:                try {
0830:                    debugCodeCall("getRef", columnName);
0831:                    throw Message.getUnsupportedException();
0832:                } catch (Throwable e) {
0833:                    throw logAndConvert(e);
0834:                }
0835:            }
0836:
0837:            /**
0838:             * Returns the value of the specified column as a java.sql.Date using a
0839:             * specified timezone.
0840:             * 
0841:             * @param columnIndex (1,2,...)
0842:             * @param calendar the calendar
0843:             * @return the value
0844:             * @throws SQLException if the column is not found or if the result set is
0845:             *             closed
0846:             */
0847:            public Date getDate(int columnIndex, Calendar calendar)
0848:                    throws SQLException {
0849:                try {
0850:                    if (debug()) {
0851:                        debugCode("getDate(" + columnIndex + ", calendar)");
0852:                    }
0853:                    Date x = get(columnIndex).getDate();
0854:                    return DateTimeUtils.convertDateToCalendar(x, calendar);
0855:                } catch (Throwable e) {
0856:                    throw logAndConvert(e);
0857:                }
0858:            }
0859:
0860:            /**
0861:             * Returns the value of the specified column as a java.sql.Date using a
0862:             * specified timezone.
0863:             * 
0864:             * @param columnName the name of the column label
0865:             * @param calendar the calendar
0866:             * @return the value
0867:             * @throws SQLException if the column is not found or if the result set is
0868:             *             closed
0869:             */
0870:            public Date getDate(String columnName, Calendar calendar)
0871:                    throws SQLException {
0872:                try {
0873:                    if (debug()) {
0874:                        debugCode("getDate("
0875:                                + StringUtils.quoteJavaString(columnName)
0876:                                + ", calendar)");
0877:                    }
0878:                    Date x = get(columnName).getDate();
0879:                    return DateTimeUtils.convertDateToCalendar(x, calendar);
0880:                } catch (Throwable e) {
0881:                    throw logAndConvert(e);
0882:                }
0883:            }
0884:
0885:            /**
0886:             * Returns the value of the specified column as a java.sql.Time using a
0887:             * specified timezone.
0888:             * 
0889:             * @param columnIndex (1,2,...)
0890:             * @param calendar the calendar
0891:             * @return the value
0892:             * @throws SQLException if the column is not found or if the result set is
0893:             *             closed
0894:             */
0895:            public Time getTime(int columnIndex, Calendar calendar)
0896:                    throws SQLException {
0897:                try {
0898:                    if (debug()) {
0899:                        debugCode("getTime(" + columnIndex + ", calendar)");
0900:                    }
0901:                    Time x = get(columnIndex).getTime();
0902:                    return DateTimeUtils.convertTimeToCalendar(x, calendar);
0903:                } catch (Throwable e) {
0904:                    throw logAndConvert(e);
0905:                }
0906:            }
0907:
0908:            /**
0909:             * Returns the value of the specified column as a java.sql.Time using a
0910:             * specified timezone.
0911:             * 
0912:             * @param columnName the name of the column label
0913:             * @param calendar the calendar
0914:             * @return the value
0915:             * @throws SQLException if the column is not found or if the result set is
0916:             *             closed
0917:             */
0918:            public Time getTime(String columnName, Calendar calendar)
0919:                    throws SQLException {
0920:                try {
0921:                    if (debug()) {
0922:                        debugCode("getTime("
0923:                                + StringUtils.quoteJavaString(columnName)
0924:                                + ", calendar)");
0925:                    }
0926:                    Time x = get(columnName).getTime();
0927:                    return DateTimeUtils.convertTimeToCalendar(x, calendar);
0928:                } catch (Throwable e) {
0929:                    throw logAndConvert(e);
0930:                }
0931:            }
0932:
0933:            /**
0934:             * Returns the value of the specified column as a java.sql.Timestamp using a
0935:             * specified timezone.
0936:             * 
0937:             * @param columnIndex (1,2,...)
0938:             * @param calendar the calendar
0939:             * @return the value
0940:             * @throws SQLException if the column is not found or if the result set is
0941:             *             closed
0942:             */
0943:            public Timestamp getTimestamp(int columnIndex, Calendar calendar)
0944:                    throws SQLException {
0945:                try {
0946:                    if (debug()) {
0947:                        debugCode("getTimestamp(" + columnIndex + ", calendar)");
0948:                    }
0949:                    Timestamp x = get(columnIndex).getTimestamp();
0950:                    return DateTimeUtils
0951:                            .convertTimestampToCalendar(x, calendar);
0952:                } catch (Throwable e) {
0953:                    throw logAndConvert(e);
0954:                }
0955:            }
0956:
0957:            /**
0958:             * Returns the value of the specified column as a java.sql.Timestamp.
0959:             * 
0960:             * @param columnName the name of the column label
0961:             * @param calendar the calendar
0962:             * @return the value
0963:             * @throws SQLException if the column is not found or if the result set is
0964:             *             closed
0965:             */
0966:            public Timestamp getTimestamp(String columnName, Calendar calendar)
0967:                    throws SQLException {
0968:                try {
0969:                    if (debug()) {
0970:                        debugCode("getTimestamp("
0971:                                + StringUtils.quoteJavaString(columnName)
0972:                                + ", calendar)");
0973:                    }
0974:                    Timestamp x = get(columnName).getTimestamp();
0975:                    return DateTimeUtils
0976:                            .convertTimestampToCalendar(x, calendar);
0977:                } catch (Throwable e) {
0978:                    throw logAndConvert(e);
0979:                }
0980:            }
0981:
0982:            /**
0983:             * Returns the value of the specified column as a Blob.
0984:             * 
0985:             * @param columnIndex (1,2,...)
0986:             * @return the value
0987:             * @throws SQLException if the column is not found or if the result set is
0988:             *             closed
0989:             */
0990:            public Blob getBlob(int columnIndex) throws SQLException {
0991:                try {
0992:                    int id = getNextId(TraceObject.BLOB);
0993:                    debugCodeAssign("Blob", TraceObject.BLOB, id, "getBlob("
0994:                            + columnIndex + ")");
0995:                    Value v = get(columnIndex);
0996:                    return v == ValueNull.INSTANCE ? null : new JdbcBlob(
0997:                            session, conn, v, id);
0998:                } catch (Throwable e) {
0999:                    throw logAndConvert(e);
1000:                }
1001:            }
1002:
1003:            /**
1004:             * Returns the value of the specified column as a Blob.
1005:             * 
1006:             * @param columnName the name of the column label
1007:             * @return the value
1008:             * @throws SQLException if the column is not found or if the result set is
1009:             *             closed
1010:             */
1011:            public Blob getBlob(String columnName) throws SQLException {
1012:                try {
1013:                    int id = getNextId(TraceObject.BLOB);
1014:                    debugCodeAssign("Blob", TraceObject.BLOB, id, "getBlob("
1015:                            + quote(columnName) + ")");
1016:                    Value v = get(columnName);
1017:                    return v == ValueNull.INSTANCE ? null : new JdbcBlob(
1018:                            session, conn, v, id);
1019:                } catch (Throwable e) {
1020:                    throw logAndConvert(e);
1021:                }
1022:            }
1023:
1024:            /**
1025:             * Returns the value of the specified column as a byte array.
1026:             * 
1027:             * @param columnIndex (1,2,...)
1028:             * @return the value
1029:             * @throws SQLException if the column is not found or if the result set is
1030:             *             closed
1031:             */
1032:            public byte[] getBytes(int columnIndex) throws SQLException {
1033:                try {
1034:                    debugCodeCall("getBytes", columnIndex);
1035:                    return get(columnIndex).getBytes();
1036:                } catch (Throwable e) {
1037:                    throw logAndConvert(e);
1038:                }
1039:            }
1040:
1041:            /**
1042:             * Returns the value of the specified column as a byte array.
1043:             * 
1044:             * @param columnName the name of the column label
1045:             * @return the value
1046:             * @throws SQLException if the column is not found or if the result set is
1047:             *             closed
1048:             */
1049:            public byte[] getBytes(String columnName) throws SQLException {
1050:                try {
1051:                    debugCodeCall("getBytes", columnName);
1052:                    return get(columnName).getBytes();
1053:                } catch (Throwable e) {
1054:                    throw logAndConvert(e);
1055:                }
1056:            }
1057:
1058:            /**
1059:             * Returns the value of the specified column as input stream.
1060:             * 
1061:             * @param columnIndex (1,2,...)
1062:             * @return the value
1063:             * @throws SQLException if the column is not found or if the result set is
1064:             *             closed
1065:             */
1066:            public InputStream getBinaryStream(int columnIndex)
1067:                    throws SQLException {
1068:                try {
1069:                    debugCodeCall("getBinaryStream", columnIndex);
1070:                    return get(columnIndex).getInputStream();
1071:                } catch (Throwable e) {
1072:                    throw logAndConvert(e);
1073:                }
1074:            }
1075:
1076:            /**
1077:             * Returns the value of the specified column as input stream.
1078:             * 
1079:             * @param columnName the name of the column label
1080:             * @return the value
1081:             * @throws SQLException if the column is not found or if the result set is
1082:             *             closed
1083:             */
1084:            public InputStream getBinaryStream(String columnName)
1085:                    throws SQLException {
1086:                try {
1087:                    debugCodeCall("getBinaryStream", columnName);
1088:                    return get(columnName).getInputStream();
1089:                } catch (Throwable e) {
1090:                    throw logAndConvert(e);
1091:                }
1092:            }
1093:
1094:            /**
1095:             * Returns the value of the specified column as a Clob.
1096:             * 
1097:             * @param columnIndex (1,2,...)
1098:             * @return the value
1099:             * @throws SQLException if the column is not found or if the result set is
1100:             *             closed
1101:             */
1102:            public Clob getClob(int columnIndex) throws SQLException {
1103:                try {
1104:                    int id = getNextId(TraceObject.CLOB);
1105:                    debugCodeAssign("Clob", TraceObject.CLOB, id, "getClob("
1106:                            + columnIndex + ")");
1107:                    Value v = get(columnIndex);
1108:                    return v == ValueNull.INSTANCE ? null : new JdbcClob(
1109:                            session, conn, v, id);
1110:                } catch (Throwable e) {
1111:                    throw logAndConvert(e);
1112:                }
1113:            }
1114:
1115:            /**
1116:             * Returns the value of the specified column as a Clob.
1117:             * 
1118:             * @param columnName the name of the column label
1119:             * @return the value
1120:             * @throws SQLException if the column is not found or if the result set is
1121:             *             closed
1122:             */
1123:            public Clob getClob(String columnName) throws SQLException {
1124:                try {
1125:                    int id = getNextId(TraceObject.CLOB);
1126:                    debugCodeAssign("Clob", TraceObject.CLOB, id, "getClob("
1127:                            + quote(columnName) + ")");
1128:                    Value v = get(columnName);
1129:                    return v == ValueNull.INSTANCE ? null : new JdbcClob(
1130:                            session, conn, v, id);
1131:                } catch (Throwable e) {
1132:                    throw logAndConvert(e);
1133:                }
1134:            }
1135:
1136:            /**
1137:             * Returns the value of the specified column as an Array.
1138:             * 
1139:             * @param columnIndex (1,2,...)
1140:             * @return the value
1141:             * @throws SQLException if the column is not found or if the result set is
1142:             *             closed
1143:             */
1144:            public Array getArray(int columnIndex) throws SQLException {
1145:                try {
1146:                    int id = getNextId(TraceObject.ARRAY);
1147:                    debugCodeAssign("Clob", TraceObject.ARRAY, id, "getArray("
1148:                            + columnIndex + ")");
1149:                    Value v = get(columnIndex);
1150:                    return v == ValueNull.INSTANCE ? null : new JdbcArray(
1151:                            session, conn, v, id);
1152:                } catch (Throwable e) {
1153:                    throw logAndConvert(e);
1154:                }
1155:            }
1156:
1157:            /**
1158:             * Returns the value of the specified column as an Array.
1159:             * 
1160:             * @param columnName the name of the column label
1161:             * @return the value
1162:             * @throws SQLException if the column is not found or if the result set is
1163:             *             closed
1164:             */
1165:            public Array getArray(String columnName) throws SQLException {
1166:                try {
1167:                    int id = getNextId(TraceObject.ARRAY);
1168:                    debugCodeAssign("Clob", TraceObject.ARRAY, id, "getArray("
1169:                            + quote(columnName) + ")");
1170:                    Value v = get(columnName);
1171:                    return v == ValueNull.INSTANCE ? null : new JdbcArray(
1172:                            session, conn, v, id);
1173:                } catch (Throwable e) {
1174:                    throw logAndConvert(e);
1175:                }
1176:            }
1177:
1178:            /**
1179:             * Returns the value of the specified column as input stream.
1180:             * 
1181:             * @param columnIndex (1,2,...)
1182:             * @return the value
1183:             * @throws SQLException if the column is not found or if the result set is
1184:             *             closed
1185:             */
1186:            public InputStream getAsciiStream(int columnIndex)
1187:                    throws SQLException {
1188:                try {
1189:                    debugCodeCall("getAsciiStream", columnIndex);
1190:                    String s = get(columnIndex).getString();
1191:                    // TODO ascii stream: convert the reader to a ascii stream
1192:                    return s == null ? null : IOUtils.getInputStream(s);
1193:                } catch (Throwable e) {
1194:                    throw logAndConvert(e);
1195:                }
1196:            }
1197:
1198:            /**
1199:             * Returns the value of the specified column as input stream.
1200:             * 
1201:             * @param columnName the name of the column label
1202:             * @return the value
1203:             * @throws SQLException if the column is not found or if the result set is
1204:             *             closed
1205:             */
1206:            public InputStream getAsciiStream(String columnName)
1207:                    throws SQLException {
1208:                try {
1209:                    debugCodeCall("getAsciiStream", columnName);
1210:                    String s = get(columnName).getString();
1211:                    // TODO ascii stream: convert the reader to a ascii stream
1212:                    return IOUtils.getInputStream(s);
1213:                } catch (Throwable e) {
1214:                    throw logAndConvert(e);
1215:                }
1216:            }
1217:
1218:            /**
1219:             * Returns the value of the specified column as input stream.
1220:             * 
1221:             * @param columnIndex (1,2,...)
1222:             * @return the value
1223:             * @throws SQLException if the column is not found or if the result set is
1224:             *             closed
1225:             */
1226:            public Reader getCharacterStream(int columnIndex)
1227:                    throws SQLException {
1228:                try {
1229:                    debugCodeCall("getCharacterStream", columnIndex);
1230:                    return get(columnIndex).getReader();
1231:                } catch (Throwable e) {
1232:                    throw logAndConvert(e);
1233:                }
1234:            }
1235:
1236:            /**
1237:             * Returns the value of the specified column as input stream.
1238:             * 
1239:             * @param columnName the name of the column label
1240:             * @return the value
1241:             * @throws SQLException if the column is not found or if the result set is
1242:             *             closed
1243:             */
1244:            public Reader getCharacterStream(String columnName)
1245:                    throws SQLException {
1246:                try {
1247:                    debugCodeCall("getCharacterStream", columnName);
1248:                    return get(columnName).getReader();
1249:                } catch (Throwable e) {
1250:                    throw logAndConvert(e);
1251:                }
1252:            }
1253:
1254:            /**
1255:             * [Not supported]
1256:             */
1257:            public URL getURL(int columnIndex) throws SQLException {
1258:                try {
1259:                    debugCodeCall("getURL", columnIndex);
1260:                    throw Message.getUnsupportedException();
1261:                } catch (Throwable e) {
1262:                    throw logAndConvert(e);
1263:                }
1264:            }
1265:
1266:            /**
1267:             * [Not supported]
1268:             */
1269:            public URL getURL(String columnName) throws SQLException {
1270:                try {
1271:                    debugCodeCall("getURL", columnName);
1272:                    throw Message.getUnsupportedException();
1273:                } catch (Throwable e) {
1274:                    throw logAndConvert(e);
1275:                }
1276:            }
1277:
1278:            // =============================================================
1279:
1280:            /**
1281:             * Updates a column in the current or insert row.
1282:             *
1283:             * @param columnIndex (1,2,...)
1284:             * @throws SQLException if the result set is closed
1285:             */
1286:            public void updateNull(int columnIndex) throws SQLException {
1287:                try {
1288:                    debugCodeCall("updateNull", columnIndex);
1289:                    update(columnIndex, ValueNull.INSTANCE);
1290:                } catch (Throwable e) {
1291:                    throw logAndConvert(e);
1292:                }
1293:            }
1294:
1295:            /**
1296:             * Updates a column in the current or insert row.
1297:             *
1298:             * @param columnName the name of the column label
1299:             * @throws SQLException if the result set is closed
1300:             */
1301:            public void updateNull(String columnName) throws SQLException {
1302:                try {
1303:                    debugCodeCall("updateNull", columnName);
1304:                    update(columnName, ValueNull.INSTANCE);
1305:                } catch (Throwable e) {
1306:                    throw logAndConvert(e);
1307:                }
1308:            }
1309:
1310:            /**
1311:             * Updates a column in the current or insert row.
1312:             *
1313:             * @param columnIndex (1,2,...)
1314:             * @param x the value
1315:             * @throws SQLException if the result set is closed
1316:             */
1317:            public void updateBoolean(int columnIndex, boolean x)
1318:                    throws SQLException {
1319:                try {
1320:                    if (debug()) {
1321:                        debugCode("updateBoolean(" + columnIndex + ", " + x
1322:                                + ");");
1323:                    }
1324:                    update(columnIndex, ValueBoolean.get(x));
1325:                } catch (Throwable e) {
1326:                    throw logAndConvert(e);
1327:                }
1328:            }
1329:
1330:            /**
1331:             * Updates a column in the current or insert row.
1332:             *
1333:             * @param columnName the name of the column label
1334:             * @param x the value
1335:             * @throws SQLException if result set is closed
1336:             */
1337:            public void updateBoolean(String columnName, boolean x)
1338:                    throws SQLException {
1339:                try {
1340:                    if (debug()) {
1341:                        debugCode("updateBoolean(" + quote(columnName) + ", "
1342:                                + x + ");");
1343:                    }
1344:                    update(columnName, ValueBoolean.get(x));
1345:                } catch (Throwable e) {
1346:                    throw logAndConvert(e);
1347:                }
1348:            }
1349:
1350:            /**
1351:             * Updates a column in the current or insert row.
1352:             *
1353:             * @param columnIndex (1,2,...)
1354:             * @param x the value
1355:             * @throws SQLException if the result set is closed
1356:             */
1357:            public void updateByte(int columnIndex, byte x) throws SQLException {
1358:                try {
1359:                    if (debug()) {
1360:                        debugCode("updateByte(" + columnIndex + ", " + x + ");");
1361:                    }
1362:                    update(columnIndex, ValueByte.get(x));
1363:                } catch (Throwable e) {
1364:                    throw logAndConvert(e);
1365:                }
1366:            }
1367:
1368:            /**
1369:             * Updates a column in the current or insert row.
1370:             *
1371:             * @param columnName the name of the column label
1372:             * @param x the value
1373:             * @throws SQLException if the result set is closed
1374:             */
1375:            public void updateByte(String columnName, byte x)
1376:                    throws SQLException {
1377:                try {
1378:                    if (debug()) {
1379:                        debugCode("updateByte(" + columnName + ", " + x + ");");
1380:                    }
1381:                    update(columnName, ValueByte.get(x));
1382:                } catch (Throwable e) {
1383:                    throw logAndConvert(e);
1384:                }
1385:            }
1386:
1387:            /**
1388:             * Updates a column in the current or insert row.
1389:             *
1390:             * @param columnIndex (1,2,...)
1391:             * @param x the value
1392:             * @throws SQLException if the result set is closed
1393:             */
1394:            public void updateBytes(int columnIndex, byte[] x)
1395:                    throws SQLException {
1396:                try {
1397:                    if (debug()) {
1398:                        debugCode("updateBytes(" + columnIndex + ", x);");
1399:                    }
1400:                    update(columnIndex, x == null ? (Value) ValueNull.INSTANCE
1401:                            : ValueBytes.get(x));
1402:                } catch (Throwable e) {
1403:                    throw logAndConvert(e);
1404:                }
1405:            }
1406:
1407:            /**
1408:             * Updates a column in the current or insert row.
1409:             *
1410:             * @param columnName the name of the column label
1411:             * @param x the value
1412:             * @throws SQLException if the result set is closed
1413:             */
1414:            public void updateBytes(String columnName, byte[] x)
1415:                    throws SQLException {
1416:                try {
1417:                    if (debug()) {
1418:                        debugCode("updateBytes(" + quote(columnName) + ", x);");
1419:                    }
1420:                    update(columnName, x == null ? (Value) ValueNull.INSTANCE
1421:                            : ValueBytes.get(x));
1422:                } catch (Throwable e) {
1423:                    throw logAndConvert(e);
1424:                }
1425:            }
1426:
1427:            /**
1428:             * Updates a column in the current or insert row.
1429:             *
1430:             * @param columnIndex (1,2,...)
1431:             * @param x the value
1432:             * @throws SQLException if the result set is closed
1433:             */
1434:            public void updateShort(int columnIndex, short x)
1435:                    throws SQLException {
1436:                try {
1437:                    if (debug()) {
1438:                        debugCode("updateShort(" + columnIndex + ", (short) "
1439:                                + x + ");");
1440:                    }
1441:                    update(columnIndex, ValueShort.get(x));
1442:                } catch (Throwable e) {
1443:                    throw logAndConvert(e);
1444:                }
1445:            }
1446:
1447:            /**
1448:             * Updates a column in the current or insert row.
1449:             *
1450:             * @param columnName the name of the column label
1451:             * @param x the value
1452:             * @throws SQLException if the result set is closed
1453:             */
1454:            public void updateShort(String columnName, short x)
1455:                    throws SQLException {
1456:                try {
1457:                    if (debug()) {
1458:                        debugCode("updateShort(" + quote(columnName)
1459:                                + ", (short) " + x + ");");
1460:                    }
1461:                    update(columnName, ValueShort.get(x));
1462:                } catch (Throwable e) {
1463:                    throw logAndConvert(e);
1464:                }
1465:            }
1466:
1467:            /**
1468:             * Updates a column in the current or insert row.
1469:             *
1470:             * @param columnIndex (1,2,...)
1471:             * @param x the value
1472:             * @throws SQLException if the result set is closed
1473:             */
1474:            public void updateInt(int columnIndex, int x) throws SQLException {
1475:                try {
1476:                    if (debug()) {
1477:                        debugCode("updateInt(" + columnIndex + ", " + x + ");");
1478:                    }
1479:                    update(columnIndex, ValueInt.get(x));
1480:                } catch (Throwable e) {
1481:                    throw logAndConvert(e);
1482:                }
1483:            }
1484:
1485:            /**
1486:             * Updates a column in the current or insert row.
1487:             *
1488:             * @param columnName the name of the column label
1489:             * @param x the value
1490:             * @throws SQLException if the result set is closed
1491:             */
1492:            public void updateInt(String columnName, int x) throws SQLException {
1493:                try {
1494:                    if (debug()) {
1495:                        debugCode("updateInt(" + quote(columnName) + ", " + x
1496:                                + ");");
1497:                    }
1498:                    update(columnName, ValueInt.get(x));
1499:                } catch (Throwable e) {
1500:                    throw logAndConvert(e);
1501:                }
1502:            }
1503:
1504:            /**
1505:             * Updates a column in the current or insert row.
1506:             *
1507:             * @param columnIndex (1,2,...)
1508:             * @param x the value
1509:             * @throws SQLException if the result set is closed
1510:             */
1511:            public void updateLong(int columnIndex, long x) throws SQLException {
1512:                try {
1513:                    if (debug()) {
1514:                        debugCode("updateLong(" + columnIndex + ", " + x
1515:                                + "L);");
1516:                    }
1517:                    update(columnIndex, ValueLong.get(x));
1518:                } catch (Throwable e) {
1519:                    throw logAndConvert(e);
1520:                }
1521:            }
1522:
1523:            /**
1524:             * Updates a column in the current or insert row.
1525:             *
1526:             * @param columnName the name of the column label
1527:             * @param x the value
1528:             * @throws SQLException if the result set is closed
1529:             */
1530:            public void updateLong(String columnName, long x)
1531:                    throws SQLException {
1532:                try {
1533:                    if (debug()) {
1534:                        debugCode("updateLong(" + quote(columnName) + ", " + x
1535:                                + "L);");
1536:                    }
1537:                    update(columnName, ValueLong.get(x));
1538:                } catch (Throwable e) {
1539:                    throw logAndConvert(e);
1540:                }
1541:            }
1542:
1543:            /**
1544:             * Updates a column in the current or insert row.
1545:             *
1546:             * @param columnIndex (1,2,...)
1547:             * @param x the value
1548:             * @throws SQLException if the result set is closed
1549:             */
1550:            public void updateFloat(int columnIndex, float x)
1551:                    throws SQLException {
1552:                try {
1553:                    if (debug()) {
1554:                        debugCode("updateFloat(" + columnIndex + ", " + x
1555:                                + "f);");
1556:                    }
1557:                    update(columnIndex, ValueFloat.get(x));
1558:                } catch (Throwable e) {
1559:                    throw logAndConvert(e);
1560:                }
1561:            }
1562:
1563:            /**
1564:             * Updates a column in the current or insert row.
1565:             *
1566:             * @param columnName the name of the column label
1567:             * @param x the value
1568:             * @throws SQLException if the result set is closed
1569:             */
1570:            public void updateFloat(String columnName, float x)
1571:                    throws SQLException {
1572:                try {
1573:                    if (debug()) {
1574:                        debugCode("updateFloat(" + quote(columnName) + ", " + x
1575:                                + "f);");
1576:                    }
1577:                    update(columnName, ValueFloat.get(x));
1578:                } catch (Throwable e) {
1579:                    throw logAndConvert(e);
1580:                }
1581:            }
1582:
1583:            /**
1584:             * Updates a column in the current or insert row.
1585:             *
1586:             * @param columnIndex (1,2,...)
1587:             * @param x the value
1588:             * @throws SQLException if the result set is closed
1589:             */
1590:            public void updateDouble(int columnIndex, double x)
1591:                    throws SQLException {
1592:                try {
1593:                    if (debug()) {
1594:                        debugCode("updateDouble(" + columnIndex + ", " + x
1595:                                + "d);");
1596:                    }
1597:                    update(columnIndex, ValueDouble.get(x));
1598:                } catch (Throwable e) {
1599:                    throw logAndConvert(e);
1600:                }
1601:            }
1602:
1603:            /**
1604:             * Updates a column in the current or insert row.
1605:             *
1606:             * @param columnName the name of the column label
1607:             * @param x the value
1608:             * @throws SQLException if the result set is closed
1609:             */
1610:            public void updateDouble(String columnName, double x)
1611:                    throws SQLException {
1612:                try {
1613:                    if (debug()) {
1614:                        debugCode("updateDouble(" + quote(columnName) + ", "
1615:                                + x + "d);");
1616:                    }
1617:                    update(columnName, ValueDouble.get(x));
1618:                } catch (Throwable e) {
1619:                    throw logAndConvert(e);
1620:                }
1621:            }
1622:
1623:            /**
1624:             * Updates a column in the current or insert row.
1625:             *
1626:             * @param columnIndex (1,2,...)
1627:             * @param x the value
1628:             * @throws SQLException if the result set is closed
1629:             */
1630:            public void updateBigDecimal(int columnIndex, BigDecimal x)
1631:                    throws SQLException {
1632:                try {
1633:                    if (debug()) {
1634:                        debugCode("updateBigDecimal(" + columnIndex + ", "
1635:                                + quoteBigDecimal(x) + ");");
1636:                    }
1637:                    update(columnIndex, x == null ? (Value) ValueNull.INSTANCE
1638:                            : ValueDecimal.get(x));
1639:                } catch (Throwable e) {
1640:                    throw logAndConvert(e);
1641:                }
1642:            }
1643:
1644:            /**
1645:             * Updates a column in the current or insert row.
1646:             *
1647:             * @param columnName the name of the column label
1648:             * @param x the value
1649:             * @throws SQLException if the result set is closed
1650:             */
1651:            public void updateBigDecimal(String columnName, BigDecimal x)
1652:                    throws SQLException {
1653:                try {
1654:                    if (debug()) {
1655:                        debugCode("updateBigDecimal(" + quote(columnName)
1656:                                + ", " + quoteBigDecimal(x) + ");");
1657:                    }
1658:                    update(columnName, x == null ? (Value) ValueNull.INSTANCE
1659:                            : ValueDecimal.get(x));
1660:                } catch (Throwable e) {
1661:                    throw logAndConvert(e);
1662:                }
1663:            }
1664:
1665:            /**
1666:             * Updates a column in the current or insert row.
1667:             *
1668:             * @param columnIndex (1,2,...)
1669:             * @param x the value
1670:             * @throws SQLException if the result set is closed
1671:             */
1672:            public void updateString(int columnIndex, String x)
1673:                    throws SQLException {
1674:                try {
1675:                    if (debug()) {
1676:                        debugCode("updateString(" + columnIndex + ", "
1677:                                + quote(x) + ");");
1678:                    }
1679:                    update(columnIndex, x == null ? (Value) ValueNull.INSTANCE
1680:                            : ValueString.get(x));
1681:                } catch (Throwable e) {
1682:                    throw logAndConvert(e);
1683:                }
1684:            }
1685:
1686:            /**
1687:             * Updates a column in the current or insert row.
1688:             *
1689:             * @param columnName the name of the column label
1690:             * @param x the value
1691:             * @throws SQLException if the result set is closed
1692:             */
1693:            public void updateString(String columnName, String x)
1694:                    throws SQLException {
1695:                try {
1696:                    if (debug()) {
1697:                        debugCode("updateString(" + quote(columnName) + ", "
1698:                                + quote(x) + ");");
1699:                    }
1700:                    update(columnName, x == null ? (Value) ValueNull.INSTANCE
1701:                            : ValueString.get(x));
1702:                } catch (Throwable e) {
1703:                    throw logAndConvert(e);
1704:                }
1705:            }
1706:
1707:            /**
1708:             * Updates a column in the current or insert row.
1709:             *
1710:             * @param columnIndex (1,2,...)
1711:             * @param x the value
1712:             * @throws SQLException if the result set is closed
1713:             */
1714:            public void updateDate(int columnIndex, Date x) throws SQLException {
1715:                try {
1716:                    if (debug()) {
1717:                        debugCode("updateDate(" + columnIndex + ", x);");
1718:                    }
1719:                    update(columnIndex, x == null ? (Value) ValueNull.INSTANCE
1720:                            : ValueDate.get(x));
1721:                } catch (Throwable e) {
1722:                    throw logAndConvert(e);
1723:                }
1724:            }
1725:
1726:            /**
1727:             * Updates a column in the current or insert row.
1728:             *
1729:             * @param columnName the name of the column label
1730:             * @param x the value
1731:             * @throws SQLException if the result set is closed
1732:             */
1733:            public void updateDate(String columnName, Date x)
1734:                    throws SQLException {
1735:                try {
1736:                    if (debug()) {
1737:                        debugCode("updateDate(" + quote(columnName) + ", x);");
1738:                    }
1739:                    update(columnName, x == null ? (Value) ValueNull.INSTANCE
1740:                            : ValueDate.get(x));
1741:                } catch (Throwable e) {
1742:                    throw logAndConvert(e);
1743:                }
1744:            }
1745:
1746:            /**
1747:             * Updates a column in the current or insert row.
1748:             *
1749:             * @param columnIndex (1,2,...)
1750:             * @param x the value
1751:             * @throws SQLException if the result set is closed
1752:             */
1753:            public void updateTime(int columnIndex, Time x) throws SQLException {
1754:                try {
1755:                    if (debug()) {
1756:                        debugCode("updateTime(" + columnIndex + ", x);");
1757:                    }
1758:                    update(columnIndex, x == null ? (Value) ValueNull.INSTANCE
1759:                            : ValueTime.get(x));
1760:                } catch (Throwable e) {
1761:                    throw logAndConvert(e);
1762:                }
1763:            }
1764:
1765:            /**
1766:             * Updates a column in the current or insert row.
1767:             *
1768:             * @param columnName the name of the column label
1769:             * @param x the value
1770:             * @throws SQLException if the result set is closed
1771:             */
1772:            public void updateTime(String columnName, Time x)
1773:                    throws SQLException {
1774:                try {
1775:                    if (debug()) {
1776:                        debugCode("updateTime(" + quote(columnName) + ", x);");
1777:                    }
1778:                    update(columnName, x == null ? (Value) ValueNull.INSTANCE
1779:                            : ValueTime.get(x));
1780:                } catch (Throwable e) {
1781:                    throw logAndConvert(e);
1782:                }
1783:            }
1784:
1785:            /**
1786:             * Updates a column in the current or insert row.
1787:             *
1788:             * @param columnIndex (1,2,...)
1789:             * @param x the value
1790:             * @throws SQLException if the result set is closed
1791:             */
1792:            public void updateTimestamp(int columnIndex, Timestamp x)
1793:                    throws SQLException {
1794:                try {
1795:                    if (debug()) {
1796:                        debugCode("updateTimestamp(" + columnIndex + ", x);");
1797:                    }
1798:                    update(columnIndex, x == null ? (Value) ValueNull.INSTANCE
1799:                            : ValueTimestamp.get(x));
1800:                } catch (Throwable e) {
1801:                    throw logAndConvert(e);
1802:                }
1803:            }
1804:
1805:            /**
1806:             * Updates a column in the current or insert row.
1807:             *
1808:             * @param columnName the name of the column label
1809:             * @param x the value
1810:             * @throws SQLException if the result set is closed
1811:             */
1812:            public void updateTimestamp(String columnName, Timestamp x)
1813:                    throws SQLException {
1814:                try {
1815:                    if (debug()) {
1816:                        debugCode("updateTimestamp(" + quote(columnName)
1817:                                + ", x);");
1818:                    }
1819:                    update(columnName, x == null ? (Value) ValueNull.INSTANCE
1820:                            : ValueTimestamp.get(x));
1821:                } catch (Throwable e) {
1822:                    throw logAndConvert(e);
1823:                }
1824:            }
1825:
1826:            /**
1827:             * Updates a column in the current or insert row.
1828:             *
1829:             * @param columnIndex (1,2,...)
1830:             * @param x the value
1831:             * @param length the number of characters
1832:             * @throws SQLException if the result set is closed
1833:             */
1834:            public void updateAsciiStream(int columnIndex, InputStream x,
1835:                    int length) throws SQLException {
1836:                updateAsciiStream(columnIndex, x, (long) length);
1837:            }
1838:
1839:            /**
1840:             * Updates a column in the current or insert row.
1841:             *
1842:             * @param columnIndex (1,2,...)
1843:             * @param x the value
1844:             * @throws SQLException if the result set is closed
1845:             */
1846:            public void updateAsciiStream(int columnIndex, InputStream x)
1847:                    throws SQLException {
1848:                updateAsciiStream(columnIndex, x, -1);
1849:            }
1850:
1851:            /**
1852:             * Updates a column in the current or insert row.
1853:             *
1854:             * @param columnIndex (1,2,...)
1855:             * @param x the value
1856:             * @param length the number of characters
1857:             * @throws SQLException if the result set is closed
1858:             */
1859:            public void updateAsciiStream(int columnIndex, InputStream x,
1860:                    long length) throws SQLException {
1861:                try {
1862:                    if (debug()) {
1863:                        debugCode("updateAsciiStream(" + columnIndex + ", x, "
1864:                                + length + "L);");
1865:                    }
1866:                    checkClosed();
1867:                    Value v = conn
1868:                            .createClob(IOUtils.getAsciiReader(x), length);
1869:                    update(columnIndex, v);
1870:                } catch (Throwable e) {
1871:                    throw logAndConvert(e);
1872:                }
1873:            }
1874:
1875:            /**
1876:             * Updates a column in the current or insert row.
1877:             *
1878:             * @param columnName the name of the column label
1879:             * @param x the value
1880:             * @param length the number of characters
1881:             * @throws SQLException if the result set is closed
1882:             */
1883:            public void updateAsciiStream(String columnName, InputStream x,
1884:                    int length) throws SQLException {
1885:                updateAsciiStream(columnName, x, (long) length);
1886:            }
1887:
1888:            /**
1889:             * Updates a column in the current or insert row.
1890:             *
1891:             * @param columnName the name of the column label
1892:             * @param x the value
1893:             * @throws SQLException if the result set is closed
1894:             */
1895:            public void updateAsciiStream(String columnName, InputStream x)
1896:                    throws SQLException {
1897:                updateAsciiStream(columnName, x, -1);
1898:            }
1899:
1900:            /**
1901:             * Updates a column in the current or insert row.
1902:             *
1903:             * @param columnName the name of the column label
1904:             * @param x the value
1905:             * @param length the number of characters
1906:             * @throws SQLException if the result set is closed
1907:             */
1908:            public void updateAsciiStream(String columnName, InputStream x,
1909:                    long length) throws SQLException {
1910:                try {
1911:                    if (debug()) {
1912:                        debugCode("updateAsciiStream(" + quote(columnName)
1913:                                + ", x, " + length + "L);");
1914:                    }
1915:                    checkClosed();
1916:                    Value v = conn
1917:                            .createClob(IOUtils.getAsciiReader(x), length);
1918:                    update(columnName, v);
1919:                } catch (Throwable e) {
1920:                    throw logAndConvert(e);
1921:                }
1922:            }
1923:
1924:            /**
1925:             * Updates a column in the current or insert row.
1926:             *
1927:             * @param columnIndex (1,2,...)
1928:             * @param x the value
1929:             * @param length the number of characters
1930:             * @throws SQLException if the result set is closed
1931:             */
1932:            public void updateBinaryStream(int columnIndex, InputStream x,
1933:                    int length) throws SQLException {
1934:                updateBinaryStream(columnIndex, x, (long) length);
1935:            }
1936:
1937:            /**
1938:             * Updates a column in the current or insert row.
1939:             *
1940:             * @param columnIndex (1,2,...)
1941:             * @param x the value
1942:             * @throws SQLException if the result set is closed
1943:             */
1944:            public void updateBinaryStream(int columnIndex, InputStream x)
1945:                    throws SQLException {
1946:                updateBinaryStream(columnIndex, x, -1);
1947:            }
1948:
1949:            /**
1950:             * Updates a column in the current or insert row.
1951:             *
1952:             * @param columnIndex (1,2,...)
1953:             * @param x the value
1954:             * @param length the number of characters
1955:             * @throws SQLException if the result set is closed
1956:             */
1957:            public void updateBinaryStream(int columnIndex, InputStream x,
1958:                    long length) throws SQLException {
1959:                try {
1960:                    if (debug()) {
1961:                        debugCode("updateBinaryStream(" + columnIndex + ", x, "
1962:                                + length + "L);");
1963:                    }
1964:                    checkClosed();
1965:                    Value v = conn.createBlob(x, length);
1966:                    update(columnIndex, v);
1967:                } catch (Throwable e) {
1968:                    throw logAndConvert(e);
1969:                }
1970:            }
1971:
1972:            /**
1973:             * Updates a column in the current or insert row.
1974:             *
1975:             * @param columnName the name of the column label
1976:             * @param x the value
1977:             * @throws SQLException if the result set is closed
1978:             */
1979:            public void updateBinaryStream(String columnName, InputStream x)
1980:                    throws SQLException {
1981:                updateBinaryStream(columnName, x, -1);
1982:            }
1983:
1984:            /**
1985:             * Updates a column in the current or insert row.
1986:             *
1987:             * @param columnName the name of the column label
1988:             * @param x the value
1989:             * @param length the number of characters
1990:             * @throws SQLException if the result set is closed
1991:             */
1992:            public void updateBinaryStream(String columnName, InputStream x,
1993:                    int length) throws SQLException {
1994:                updateBinaryStream(columnName, x, (long) length);
1995:            }
1996:
1997:            /**
1998:             * Updates a column in the current or insert row.
1999:             *
2000:             * @param columnName the name of the column label
2001:             * @param x the value
2002:             * @param length the number of characters
2003:             * @throws SQLException if the result set is closed
2004:             */
2005:            public void updateBinaryStream(String columnName, InputStream x,
2006:                    long length) throws SQLException {
2007:                try {
2008:                    if (debug()) {
2009:                        debugCode("updateBinaryStream(" + quote(columnName)
2010:                                + ", x, " + length + "L);");
2011:                    }
2012:                    checkClosed();
2013:                    Value v = conn.createBlob(x, length);
2014:                    update(columnName, v);
2015:                } catch (Throwable e) {
2016:                    throw logAndConvert(e);
2017:                }
2018:            }
2019:
2020:            /**
2021:             * Updates a column in the current or insert row.
2022:             *
2023:             * @param columnIndex (1,2,...)
2024:             * @param x the value
2025:             * @param length the number of characters
2026:             * @throws SQLException if the result set is closed
2027:             */
2028:            public void updateCharacterStream(int columnIndex, Reader x,
2029:                    long length) throws SQLException {
2030:                try {
2031:                    if (debug()) {
2032:                        debugCode("updateCharacterStream(" + columnIndex
2033:                                + ", x, " + length + "L);");
2034:                    }
2035:                    checkClosed();
2036:                    Value v = conn.createClob(x, length);
2037:                    update(columnIndex, v);
2038:                } catch (Throwable e) {
2039:                    throw logAndConvert(e);
2040:                }
2041:            }
2042:
2043:            /**
2044:             * Updates a column in the current or insert row.
2045:             *
2046:             * @param columnIndex (1,2,...)
2047:             * @param x the value
2048:             * @param length the number of characters
2049:             * @throws SQLException if the result set is closed
2050:             */
2051:            public void updateCharacterStream(int columnIndex, Reader x,
2052:                    int length) throws SQLException {
2053:                updateCharacterStream(columnIndex, x, (long) length);
2054:            }
2055:
2056:            /**
2057:             * Updates a column in the current or insert row.
2058:             *
2059:             * @param columnIndex (1,2,...)
2060:             * @param x the value
2061:             * @throws SQLException if the result set is closed
2062:             */
2063:            public void updateCharacterStream(int columnIndex, Reader x)
2064:                    throws SQLException {
2065:                updateCharacterStream(columnIndex, x, -1);
2066:            }
2067:
2068:            /**
2069:             * Updates a column in the current or insert row.
2070:             *
2071:             * @param columnName the name of the column label
2072:             * @param x the value
2073:             * @param length the number of characters
2074:             * @throws SQLException if the result set is closed
2075:             */
2076:            public void updateCharacterStream(String columnName, Reader x,
2077:                    int length) throws SQLException {
2078:                updateCharacterStream(columnName, x, (long) length);
2079:            }
2080:
2081:            /**
2082:             * Updates a column in the current or insert row.
2083:             *
2084:             * @param columnName the name of the column label
2085:             * @param x the value
2086:             * @throws SQLException if the result set is closed
2087:             */
2088:            public void updateCharacterStream(String columnName, Reader x)
2089:                    throws SQLException {
2090:                updateCharacterStream(columnName, x, -1);
2091:            }
2092:
2093:            /**
2094:             * Updates a column in the current or insert row.
2095:             *
2096:             * @param columnName the name of the column label
2097:             * @param x the value
2098:             * @param length the number of characters
2099:             * @throws SQLException if the result set is closed
2100:             */
2101:            public void updateCharacterStream(String columnName, Reader x,
2102:                    long length) throws SQLException {
2103:                try {
2104:                    if (debug()) {
2105:                        debugCode("updateCharacterStream(" + quote(columnName)
2106:                                + ", x, " + length + "L);");
2107:                    }
2108:                    checkClosed();
2109:                    Value v = conn.createClob(x, length);
2110:                    update(columnName, v);
2111:                } catch (Throwable e) {
2112:                    throw logAndConvert(e);
2113:                }
2114:            }
2115:
2116:            /**
2117:             * Updates a column in the current or insert row.
2118:             *
2119:             * @param columnIndex (1,2,...)
2120:             * @param x the value
2121:             * @param scale is ignored
2122:             * @throws SQLException if the result set is closed
2123:             */
2124:            public void updateObject(int columnIndex, Object x, int scale)
2125:                    throws SQLException {
2126:                try {
2127:                    if (debug()) {
2128:                        debugCode("updateObject(" + columnIndex + ", x, "
2129:                                + scale + ");");
2130:                    }
2131:                    update(columnIndex, DataType.convertToValue(session, x,
2132:                            Value.UNKNOWN));
2133:                } catch (Throwable e) {
2134:                    throw logAndConvert(e);
2135:                }
2136:            }
2137:
2138:            /**
2139:             * Updates a column in the current or insert row.
2140:             *
2141:             * @param columnName the name of the column label
2142:             * @param x the value
2143:             * @param scale is ignored
2144:             * @throws SQLException if the result set is closed
2145:             */
2146:            public void updateObject(String columnName, Object x, int scale)
2147:                    throws SQLException {
2148:                try {
2149:                    if (debug()) {
2150:                        debugCode("updateObject(" + quote(columnName) + ", x, "
2151:                                + scale + ");");
2152:                    }
2153:                    update(columnName, DataType.convertToValue(session, x,
2154:                            Value.UNKNOWN));
2155:                } catch (Throwable e) {
2156:                    throw logAndConvert(e);
2157:                }
2158:            }
2159:
2160:            /**
2161:             * Updates a column in the current or insert row.
2162:             *
2163:             * @param columnIndex (1,2,...)
2164:             * @param x the value
2165:             * @throws SQLException if the result set is closed
2166:             */
2167:            public void updateObject(int columnIndex, Object x)
2168:                    throws SQLException {
2169:                try {
2170:                    if (debug()) {
2171:                        debugCode("updateObject(" + columnIndex + ", x);");
2172:                    }
2173:                    update(columnIndex, DataType.convertToValue(session, x,
2174:                            Value.UNKNOWN));
2175:                } catch (Throwable e) {
2176:                    throw logAndConvert(e);
2177:                }
2178:            }
2179:
2180:            /**
2181:             * Updates a column in the current or insert row.
2182:             *
2183:             * @param columnName the name of the column label
2184:             * @param x the value
2185:             * @throws SQLException if the result set is closed
2186:             */
2187:            public void updateObject(String columnName, Object x)
2188:                    throws SQLException {
2189:                try {
2190:                    if (debug()) {
2191:                        debugCode("updateObject(" + quote(columnName) + ", x);");
2192:                    }
2193:                    update(columnName, DataType.convertToValue(session, x,
2194:                            Value.UNKNOWN));
2195:                } catch (Throwable e) {
2196:                    throw logAndConvert(e);
2197:                }
2198:            }
2199:
2200:            /**
2201:             * [Not supported]
2202:             */
2203:            public void updateRef(int columnIndex, Ref x) throws SQLException {
2204:                try {
2205:                    if (debug()) {
2206:                        debugCode("updateRef(" + columnIndex + ", x);");
2207:                    }
2208:                    throw Message.getUnsupportedException();
2209:                } catch (Throwable e) {
2210:                    throw logAndConvert(e);
2211:                }
2212:            }
2213:
2214:            /**
2215:             * [Not supported]
2216:             */
2217:            public void updateRef(String columnName, Ref x) throws SQLException {
2218:                try {
2219:                    if (debug()) {
2220:                        debugCode("updateRef(" + quote(columnName) + ", x);");
2221:                    }
2222:                    throw Message.getUnsupportedException();
2223:                } catch (Throwable e) {
2224:                    throw logAndConvert(e);
2225:                }
2226:            }
2227:
2228:            /**
2229:             * Updates a column in the current or insert row.
2230:             *
2231:             * @param columnIndex (1,2,...)
2232:             * @param x the value
2233:             * @throws SQLException if the result set is closed
2234:             */
2235:            public void updateBlob(int columnIndex, InputStream x)
2236:                    throws SQLException {
2237:                updateBlob(columnIndex, x, -1);
2238:            }
2239:
2240:            /**
2241:             * Updates a column in the current or insert row.
2242:             *
2243:             * @param columnIndex (1,2,...)
2244:             * @param x the value
2245:             * @param length the length
2246:             * @throws SQLException if the result set is closed
2247:             */
2248:            public void updateBlob(int columnIndex, InputStream x, long length)
2249:                    throws SQLException {
2250:                try {
2251:                    if (debug()) {
2252:                        debugCode("updateBlob(" + columnIndex + ", x, "
2253:                                + length + "L);");
2254:                    }
2255:                    checkClosed();
2256:                    Value v = conn.createBlob(x, length);
2257:                    update(columnIndex, v);
2258:                } catch (Throwable e) {
2259:                    throw logAndConvert(e);
2260:                }
2261:            }
2262:
2263:            /**
2264:             * Updates a column in the current or insert row.
2265:             *
2266:             * @param columnIndex (1,2,...)
2267:             * @param x the value
2268:             * @throws SQLException if the result set is closed
2269:             */
2270:            public void updateBlob(int columnIndex, Blob x) throws SQLException {
2271:                try {
2272:                    if (debug()) {
2273:                        debugCode("updateBlob(" + columnIndex + ", x);");
2274:                    }
2275:                    checkClosed();
2276:                    Value v;
2277:                    if (x == null) {
2278:                        v = ValueNull.INSTANCE;
2279:                    } else {
2280:                        v = conn.createBlob(x.getBinaryStream(), -1);
2281:                    }
2282:                    update(columnIndex, v);
2283:                } catch (Throwable e) {
2284:                    throw logAndConvert(e);
2285:                }
2286:            }
2287:
2288:            /**
2289:             * Updates a column in the current or insert row.
2290:             *
2291:             * @param columnName the name of the column label
2292:             * @param x the value
2293:             * @throws SQLException if the result set is closed
2294:             */
2295:            public void updateBlob(String columnName, Blob x)
2296:                    throws SQLException {
2297:                try {
2298:                    if (debug()) {
2299:                        debugCode("updateBlob(" + quote(columnName) + ", x);");
2300:                    }
2301:                    checkClosed();
2302:                    Value v;
2303:                    if (x == null) {
2304:                        v = ValueNull.INSTANCE;
2305:                    } else {
2306:                        v = conn.createBlob(x.getBinaryStream(), -1);
2307:                    }
2308:                    update(columnName, v);
2309:                } catch (Throwable e) {
2310:                    throw logAndConvert(e);
2311:                }
2312:            }
2313:
2314:            /**
2315:             * Updates a column in the current or insert row.
2316:             *
2317:             * @param columnName the name of the column label
2318:             * @param x the value
2319:             * @throws SQLException if the result set is closed
2320:             */
2321:            public void updateBlob(String columnName, InputStream x)
2322:                    throws SQLException {
2323:                updateBlob(columnName, x, -1);
2324:            }
2325:
2326:            /**
2327:             * Updates a column in the current or insert row.
2328:             *
2329:             * @param columnName the name of the column label
2330:             * @param x the value
2331:             * @param length the length
2332:             * @throws SQLException if the result set is closed
2333:             */
2334:            public void updateBlob(String columnName, InputStream x, long length)
2335:                    throws SQLException {
2336:                try {
2337:                    if (debug()) {
2338:                        debugCode("updateBlob(" + quote(columnName) + ", x, "
2339:                                + length + "L);");
2340:                    }
2341:                    checkClosed();
2342:                    Value v = conn.createBlob(x, -1);
2343:                    update(columnName, v);
2344:                } catch (Throwable e) {
2345:                    throw logAndConvert(e);
2346:                }
2347:            }
2348:
2349:            /**
2350:             * Updates a column in the current or insert row.
2351:             *
2352:             * @param columnIndex (1,2,...)
2353:             * @param x the value
2354:             * @throws SQLException if the result set is closed
2355:             */
2356:            public void updateClob(int columnIndex, Clob x) throws SQLException {
2357:                try {
2358:                    if (debug()) {
2359:                        debugCode("updateClob(" + columnIndex + ", x);");
2360:                    }
2361:                    checkClosed();
2362:                    Value v;
2363:                    if (x == null) {
2364:                        v = ValueNull.INSTANCE;
2365:                    } else {
2366:                        v = conn.createClob(x.getCharacterStream(), -1);
2367:                    }
2368:                    update(columnIndex, v);
2369:                } catch (Throwable e) {
2370:                    throw logAndConvert(e);
2371:                }
2372:            }
2373:
2374:            /**
2375:             * Updates a column in the current or insert row.
2376:             *
2377:             * @param columnIndex (1,2,...)
2378:             * @param x the value
2379:             * @throws SQLException if the result set is closed
2380:             */
2381:            public void updateClob(int columnIndex, Reader x)
2382:                    throws SQLException {
2383:                updateClob(columnIndex, x, -1);
2384:            }
2385:
2386:            /**
2387:             * Updates a column in the current or insert row.
2388:             *
2389:             * @param columnIndex (1,2,...)
2390:             * @param x the value
2391:             * @param length the length
2392:             * @throws SQLException if the result set is closed
2393:             */
2394:            public void updateClob(int columnIndex, Reader x, long length)
2395:                    throws SQLException {
2396:                try {
2397:                    if (debug()) {
2398:                        debugCode("updateClob(" + columnIndex + ", x, "
2399:                                + length + "L);");
2400:                    }
2401:                    checkClosed();
2402:                    Value v = conn.createClob(x, length);
2403:                    update(columnIndex, v);
2404:                } catch (Throwable e) {
2405:                    throw logAndConvert(e);
2406:                }
2407:            }
2408:
2409:            /**
2410:             * Updates a column in the current or insert row.
2411:             *
2412:             * @param columnName the name of the column label
2413:             * @param x the value
2414:             * @throws SQLException if the result set is closed
2415:             */
2416:            public void updateClob(String columnName, Clob x)
2417:                    throws SQLException {
2418:                try {
2419:                    if (debug()) {
2420:                        debugCode("updateClob(" + quote(columnName) + ", x);");
2421:                    }
2422:                    checkClosed();
2423:                    Value v;
2424:                    if (x == null) {
2425:                        v = ValueNull.INSTANCE;
2426:                    } else {
2427:                        v = conn.createClob(x.getCharacterStream(), -1);
2428:                    }
2429:                    update(columnName, v);
2430:                } catch (Throwable e) {
2431:                    throw logAndConvert(e);
2432:                }
2433:            }
2434:
2435:            /**
2436:             * Updates a column in the current or insert row.
2437:             *
2438:             * @param columnName the name of the column label
2439:             * @param x the value
2440:             * @throws SQLException if the result set is closed
2441:             */
2442:            public void updateClob(String columnName, Reader x)
2443:                    throws SQLException {
2444:                updateClob(columnName, x, -1);
2445:            }
2446:
2447:            /**
2448:             * Updates a column in the current or insert row.
2449:             *
2450:             * @param columnName the name of the column label
2451:             * @param x the value
2452:             * @param length the length
2453:             * @throws SQLException if the result set is closed
2454:             */
2455:            public void updateClob(String columnName, Reader x, long length)
2456:                    throws SQLException {
2457:                try {
2458:                    if (debug()) {
2459:                        debugCode("updateClob(" + quote(columnName) + ", x, "
2460:                                + length + "L);");
2461:                    }
2462:                    checkClosed();
2463:                    Value v = conn.createClob(x, length);
2464:                    update(columnName, v);
2465:                } catch (Throwable e) {
2466:                    throw logAndConvert(e);
2467:                }
2468:            }
2469:
2470:            /**
2471:             * [Not supported]
2472:             */
2473:            public void updateArray(int columnIndex, Array x)
2474:                    throws SQLException {
2475:                try {
2476:                    if (debug()) {
2477:                        debugCode("updateArray(" + columnIndex + ", x);");
2478:                    }
2479:                    throw Message.getUnsupportedException();
2480:                } catch (Throwable e) {
2481:                    throw logAndConvert(e);
2482:                }
2483:            }
2484:
2485:            /**
2486:             * [Not supported]
2487:             */
2488:            public void updateArray(String columnName, Array x)
2489:                    throws SQLException {
2490:                try {
2491:                    if (debug()) {
2492:                        debugCode("updateArray(" + quote(columnName) + ", x);");
2493:                    }
2494:                    throw Message.getUnsupportedException();
2495:                } catch (Throwable e) {
2496:                    throw logAndConvert(e);
2497:                }
2498:            }
2499:
2500:            /**
2501:             * [Not supported] Gets the cursor name if it was defined. This feature is
2502:             * superseded by updateX methods. This method throws a SQLException because
2503:             * cursor names are not supported.
2504:             */
2505:            public String getCursorName() throws SQLException {
2506:                try {
2507:                    debugCodeCall("getCursorName");
2508:                    throw Message.getUnsupportedException();
2509:                } catch (Throwable e) {
2510:                    throw logAndConvert(e);
2511:                }
2512:            }
2513:
2514:            /**
2515:             * Gets the current row number. The first row is row 1, the second 2 and so
2516:             * on. This method returns 0 before the first and after the last row.
2517:             * 
2518:             * @return the row number
2519:             */
2520:            public int getRow() throws SQLException {
2521:                try {
2522:                    debugCodeCall("getRow");
2523:                    checkClosed();
2524:                    int rowId = result.getRowId();
2525:                    if (rowId >= result.getRowCount()) {
2526:                        return 0;
2527:                    } else {
2528:                        return rowId + 1;
2529:                    }
2530:                } catch (Throwable e) {
2531:                    throw logAndConvert(e);
2532:                }
2533:            }
2534:
2535:            /**
2536:             * Gets the result set concurrency.
2537:             *
2538:             * @return ResultSet.CONCUR_UPDATABLE
2539:             */
2540:            public int getConcurrency() throws SQLException {
2541:                try {
2542:                    debugCodeCall("getConcurrency");
2543:                    checkClosed();
2544:                    UpdatableRow row = new UpdatableRow(conn, result, session);
2545:                    return row.isUpdatable() ? ResultSet.CONCUR_UPDATABLE
2546:                            : ResultSet.CONCUR_READ_ONLY;
2547:                } catch (Throwable e) {
2548:                    throw logAndConvert(e);
2549:                }
2550:            }
2551:
2552:            /**
2553:             * Gets the fetch direction.
2554:             *
2555:             * @return the direction: FETCH_FORWARD
2556:             */
2557:            public int getFetchDirection() throws SQLException {
2558:                try {
2559:                    debugCodeCall("getFetchDirection");
2560:                    checkClosed();
2561:                    return ResultSet.FETCH_FORWARD;
2562:                } catch (Throwable e) {
2563:                    throw logAndConvert(e);
2564:                }
2565:            }
2566:
2567:            /**
2568:             * Gets the number of rows suggested to read in one step.
2569:             *
2570:             * @return the current fetch size
2571:             */
2572:            public int getFetchSize() throws SQLException {
2573:                try {
2574:                    debugCodeCall("getFetchSize");
2575:                    checkClosed();
2576:                    return 0;
2577:                } catch (Throwable e) {
2578:                    throw logAndConvert(e);
2579:                }
2580:            }
2581:
2582:            /**
2583:             * Sets the number of rows suggested to read in one step. This value cannot
2584:             * be higher than the maximum rows (setMaxRows) set by the statement or
2585:             * prepared statement, otherwise an exception is throws.
2586:             * 
2587:             * @param rowCount the number of rows
2588:             */
2589:            public void setFetchSize(int rowCount) throws SQLException {
2590:                try {
2591:                    debugCodeCall("setFetchSize", rowCount);
2592:                    checkClosed();
2593:                    if (rowCount < 0) {
2594:                        throw Message.getInvalidValueException("" + rowCount,
2595:                                "rowCount");
2596:                    }
2597:                    if (rowCount > 0) {
2598:                        if (stat != null) {
2599:                            int maxRows = stat.getMaxRows();
2600:                            if (maxRows > 0 && rowCount > maxRows) {
2601:                                throw Message.getInvalidValueException(""
2602:                                        + rowCount, "rowCount");
2603:                            }
2604:                        }
2605:                    }
2606:                } catch (Throwable e) {
2607:                    throw logAndConvert(e);
2608:                }
2609:            }
2610:
2611:            /**
2612:             * Sets (changes) the fetch direction for this result set. This method
2613:             * should only be called for scrollable result sets, otherwise it will throw
2614:             * an exception (no matter what direction is used).
2615:             * 
2616:             * @param direction the new fetch direction
2617:             * @throws SQLException Unsupported Feature if the method is called for a
2618:             *             forward-only result set
2619:             */
2620:            public void setFetchDirection(int direction) throws SQLException {
2621:                try {
2622:                    debugCodeCall("setFetchDirection", direction);
2623:                    throw Message.getUnsupportedException();
2624:                } catch (Throwable e) {
2625:                    throw logAndConvert(e);
2626:                }
2627:            }
2628:
2629:            /**
2630:             * Get the result set type.
2631:             * 
2632:             * @return the result set type (TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE
2633:             *         or TYPE_SCROLL_SENSITIVE)
2634:             * @throws SQLException if the column is not found or if the result set is
2635:             *             closed
2636:             */
2637:            public int getType() throws SQLException {
2638:                try {
2639:                    debugCodeCall("getType");
2640:                    checkClosed();
2641:                    return stat == null ? ResultSet.TYPE_FORWARD_ONLY
2642:                            : stat.resultSetType;
2643:                } catch (Throwable e) {
2644:                    throw logAndConvert(e);
2645:                }
2646:            }
2647:
2648:            /**
2649:             * Checks if the current position is before the first row, that means next()
2650:             * was not called yet.
2651:             * 
2652:             * @return if the current position is before the first row
2653:             * @throws SQLException if the result set is closed
2654:             */
2655:            public boolean isBeforeFirst() throws SQLException {
2656:                try {
2657:                    debugCodeCall("isBeforeFirst");
2658:                    checkClosed();
2659:                    return result.getRowId() < 0;
2660:                } catch (Throwable e) {
2661:                    throw logAndConvert(e);
2662:                }
2663:            }
2664:
2665:            /**
2666:             * Checks if the current position is after the last row, that means next()
2667:             * was called and returned false.
2668:             * 
2669:             * @return if the current position is after the last row
2670:             * @throws SQLException if the result set is closed
2671:             */
2672:            public boolean isAfterLast() throws SQLException {
2673:                try {
2674:                    debugCodeCall("isAfterLast");
2675:                    checkClosed();
2676:                    int row = result.getRowId();
2677:                    int count = result.getRowCount();
2678:                    return row >= count || count == 0;
2679:                } catch (Throwable e) {
2680:                    throw logAndConvert(e);
2681:                }
2682:            }
2683:
2684:            /**
2685:             * Checks if the current position is row 1, that means next() was called
2686:             * once and returned true.
2687:             * 
2688:             * @return if the current position is the first row
2689:             * @throws SQLException if the result set is closed
2690:             */
2691:            public boolean isFirst() throws SQLException {
2692:                try {
2693:                    debugCodeCall("isFirst");
2694:                    checkClosed();
2695:                    int row = result.getRowId();
2696:                    return row == 0 && row < result.getRowCount();
2697:                } catch (Throwable e) {
2698:                    throw logAndConvert(e);
2699:                }
2700:            }
2701:
2702:            /**
2703:             * Checks if the current position is the last row, that means next() was
2704:             * called and did not yet returned false, but will in the next call.
2705:             * 
2706:             * @return if the current position is the last row
2707:             * @throws SQLException if the result set is closed
2708:             */
2709:            public boolean isLast() throws SQLException {
2710:                try {
2711:                    debugCodeCall("isLast");
2712:                    checkClosed();
2713:                    int row = result.getRowId();
2714:                    return row >= 0 && row == result.getRowCount() - 1;
2715:                } catch (Throwable e) {
2716:                    throw logAndConvert(e);
2717:                }
2718:            }
2719:
2720:            /**
2721:             * Moves the current position to before the first row, that means resets the
2722:             * result set.
2723:             * 
2724:             * @throws SQLException if the result set is closed
2725:             */
2726:            public void beforeFirst() throws SQLException {
2727:                try {
2728:                    debugCodeCall("beforeFirst");
2729:                    checkClosed();
2730:                    if (result.getRowId() >= 0) {
2731:                        resetResult();
2732:                    }
2733:                } catch (Throwable e) {
2734:                    throw logAndConvert(e);
2735:                }
2736:            }
2737:
2738:            /**
2739:             * Moves the current position to after the last row, that means after the end.
2740:             *
2741:             * @throws SQLException if the result set is closed
2742:             */
2743:            public void afterLast() throws SQLException {
2744:                try {
2745:                    debugCodeCall("afterLast");
2746:                    checkClosed();
2747:                    while (nextRow()) {
2748:                        // nothing
2749:                    }
2750:                } catch (Throwable e) {
2751:                    throw logAndConvert(e);
2752:                }
2753:            }
2754:
2755:            /**
2756:             * Moves the current position to the first row. This is the same as calling
2757:             * beforeFirst() followed by next().
2758:             * 
2759:             * @return true if there is a row available, false if not
2760:             * @throws SQLException if the result set is closed
2761:             */
2762:            public boolean first() throws SQLException {
2763:                try {
2764:                    debugCodeCall("first");
2765:                    checkClosed();
2766:                    if (result.getRowId() < 0) {
2767:                        return nextRow();
2768:                    } else {
2769:                        resetResult();
2770:                        return nextRow();
2771:                    }
2772:                } catch (Throwable e) {
2773:                    throw logAndConvert(e);
2774:                }
2775:            }
2776:
2777:            /**
2778:             * Moves the current position to the last row.
2779:             *
2780:             * @return true if there is a row available, false if not
2781:             * @throws SQLException if the result set is closed
2782:             */
2783:            public boolean last() throws SQLException {
2784:                try {
2785:                    debugCodeCall("last");
2786:                    checkClosed();
2787:                    return absolute(-1);
2788:                } catch (Throwable e) {
2789:                    throw logAndConvert(e);
2790:                }
2791:            }
2792:
2793:            /**
2794:             * Moves the current position to a specific row.
2795:             * 
2796:             * @param rowNumber the row number. 0 is not allowed, 1 means the first row,
2797:             *            2 the second. -1 means the last row, -2 the row before the
2798:             *            last row. If the value is too large, the position is moved
2799:             *            after the last row, if if the value is too small it is moved
2800:             *            before the first row.
2801:             * @return true if there is a row available, false if not
2802:             * @throws SQLException if the result set is closed
2803:             */
2804:            public boolean absolute(int rowNumber) throws SQLException {
2805:                try {
2806:                    debugCodeCall("absolute", rowNumber);
2807:                    checkClosed();
2808:                    if (rowNumber < 0) {
2809:                        rowNumber = result.getRowCount() + rowNumber + 1;
2810:                    } else if (rowNumber > result.getRowCount() + 1) {
2811:                        rowNumber = result.getRowCount() + 1;
2812:                    }
2813:                    if (rowNumber <= result.getRowId()) {
2814:                        resetResult();
2815:                    }
2816:                    while (result.getRowId() + 1 < rowNumber) {
2817:                        nextRow();
2818:                    }
2819:                    int row = result.getRowId();
2820:                    return row >= 0 && row < result.getRowCount();
2821:                } catch (Throwable e) {
2822:                    throw logAndConvert(e);
2823:                }
2824:            }
2825:
2826:            /**
2827:             * Moves the current position to a specific row relative to the current row.
2828:             * 
2829:             * @param rowCount 0 means don't do anything, 1 is the next row, -1 the
2830:             *            previous. If the value is too large, the position is moved
2831:             *            after the last row, if if the value is too small it is moved
2832:             *            before the first row.
2833:             * @return true if there is a row available, false if not
2834:             * @throws SQLException if the result set is closed
2835:             */
2836:            public boolean relative(int rowCount) throws SQLException {
2837:                try {
2838:                    debugCodeCall("relative", rowCount);
2839:                    checkClosed();
2840:                    int row = result.getRowId() + 1 + rowCount;
2841:                    if (row < 0) {
2842:                        row = 0;
2843:                    } else if (row > result.getRowCount()) {
2844:                        row = result.getRowCount() + 1;
2845:                    }
2846:                    return absolute(row);
2847:                } catch (Throwable e) {
2848:                    throw logAndConvert(e);
2849:                }
2850:            }
2851:
2852:            /**
2853:             * Moves the cursor to the last row, or row before first row if the current
2854:             * position is the first row.
2855:             * 
2856:             * @return true if there is a row available, false if not
2857:             * @throws SQLException if the result set is closed
2858:             */
2859:            public boolean previous() throws SQLException {
2860:                try {
2861:                    debugCodeCall("previous");
2862:                    checkClosed();
2863:                    return relative(-1);
2864:                } catch (Throwable e) {
2865:                    throw logAndConvert(e);
2866:                }
2867:            }
2868:
2869:            /**
2870:             * Moves the current position to the insert row. The current row is remembered.
2871:             *
2872:             * @throws SQLException if the result set is closed
2873:             */
2874:            public void moveToInsertRow() throws SQLException {
2875:                try {
2876:                    debugCodeCall("moveToInsertRow");
2877:                    checkClosed();
2878:                    insertRow = new Value[columnCount];
2879:                } catch (Throwable e) {
2880:                    throw logAndConvert(e);
2881:                }
2882:            }
2883:
2884:            /**
2885:             * Moves the current position to the current row.
2886:             *
2887:             * @throws SQLException if the result set is closed
2888:             */
2889:            public void moveToCurrentRow() throws SQLException {
2890:                try {
2891:                    debugCodeCall("moveToCurrentRow");
2892:                    checkClosed();
2893:                    insertRow = null;
2894:                } catch (Throwable e) {
2895:                    throw logAndConvert(e);
2896:                }
2897:            }
2898:
2899:            /**
2900:             * Detects if the row was updated (by somebody else or the caller).
2901:             *
2902:             * @return false because this driver does not detect this
2903:             */
2904:            public boolean rowUpdated() throws SQLException {
2905:                try {
2906:                    debugCodeCall("rowUpdated");
2907:                    return false;
2908:                } catch (Throwable e) {
2909:                    throw logAndConvert(e);
2910:                }
2911:            }
2912:
2913:            /**
2914:             * Detects if the row was inserted.
2915:             *
2916:             * @return false because this driver does not detect this
2917:             */
2918:            public boolean rowInserted() throws SQLException {
2919:                try {
2920:                    debugCodeCall("rowInserted");
2921:                    return false;
2922:                } catch (Throwable e) {
2923:                    throw logAndConvert(e);
2924:                }
2925:            }
2926:
2927:            /**
2928:             * Detects if the row was deleted (by somebody else or the caller).
2929:             *
2930:             * @return false because this driver does not detect this
2931:             */
2932:            public boolean rowDeleted() throws SQLException {
2933:                try {
2934:                    debugCodeCall("rowDeleted");
2935:                    return false;
2936:                } catch (Throwable e) {
2937:                    throw logAndConvert(e);
2938:                }
2939:            }
2940:
2941:            /**
2942:             * Inserts the current row. The current position must be the insert row.
2943:             *
2944:             * @throws SQLException if the result set is closed or if not on the insert row
2945:             */
2946:            public void insertRow() throws SQLException {
2947:                try {
2948:                    debugCodeCall("insertRow");
2949:                    checkClosed();
2950:                    if (insertRow == null) {
2951:                        throw Message
2952:                                .getSQLException(ErrorCode.NOT_ON_UPDATABLE_ROW);
2953:                    }
2954:                    getUpdatableRow().insertRow(insertRow);
2955:                    insertRow = null;
2956:                } catch (Throwable e) {
2957:                    throw logAndConvert(e);
2958:                }
2959:            }
2960:
2961:            /**
2962:             * Updates the current row.
2963:             * 
2964:             * @throws SQLException if the result set is closed or if the current row is
2965:             *             the insert row or if not on a valid row
2966:             */
2967:            public void updateRow() throws SQLException {
2968:                try {
2969:                    debugCodeCall("updateRow");
2970:                    checkClosed();
2971:                    if (insertRow != null) {
2972:                        throw Message
2973:                                .getSQLException(ErrorCode.NOT_ON_UPDATABLE_ROW);
2974:                    }
2975:                    checkOnValidRow();
2976:                    if (updateRow != null) {
2977:                        getUpdatableRow().updateRow(result.currentRow(),
2978:                                updateRow);
2979:                        updateRow = null;
2980:                    }
2981:                } catch (Throwable e) {
2982:                    throw logAndConvert(e);
2983:                }
2984:            }
2985:
2986:            /**
2987:             * Deletes the current row.
2988:             * 
2989:             * @throws SQLException if the result set is closed or if the current row is
2990:             *             the insert row or if not on a valid row
2991:             */
2992:            public void deleteRow() throws SQLException {
2993:                try {
2994:                    debugCodeCall("deleteRow");
2995:                    checkClosed();
2996:                    if (insertRow != null) {
2997:                        throw Message
2998:                                .getSQLException(ErrorCode.NOT_ON_UPDATABLE_ROW);
2999:                    }
3000:                    checkOnValidRow();
3001:                    getUpdatableRow().deleteRow(result.currentRow());
3002:                    updateRow = null;
3003:                } catch (Throwable e) {
3004:                    throw logAndConvert(e);
3005:                }
3006:            }
3007:
3008:            /**
3009:             * Re-reads the current row from the database.
3010:             * 
3011:             * @throws SQLException if the result set is closed or if the current row is
3012:             *             the insert row or if the row has been deleted or if not on a
3013:             *             valid row
3014:             */
3015:            public void refreshRow() throws SQLException {
3016:                try {
3017:                    debugCodeCall("refreshRow");
3018:                    checkClosed();
3019:                    if (insertRow != null) {
3020:                        throw Message
3021:                                .getSQLException(ErrorCode.NO_DATA_AVAILABLE);
3022:                    }
3023:                    checkOnValidRow();
3024:                    getUpdatableRow().refreshRow(result.currentRow());
3025:                    updateRow = null;
3026:                } catch (Throwable e) {
3027:                    throw logAndConvert(e);
3028:                }
3029:            }
3030:
3031:            /**
3032:             * Cancels updating a row.
3033:             * 
3034:             * @throws SQLException if the result set is closed or if the current row is
3035:             *             the insert row
3036:             */
3037:            public void cancelRowUpdates() throws SQLException {
3038:                try {
3039:                    debugCodeCall("cancelRowUpdates");
3040:                    checkClosed();
3041:                    if (insertRow != null) {
3042:                        throw Message
3043:                                .getSQLException(ErrorCode.NO_DATA_AVAILABLE);
3044:                    }
3045:                    updateRow = null;
3046:                } catch (Throwable e) {
3047:                    throw logAndConvert(e);
3048:                }
3049:            }
3050:
3051:            // =============================================================
3052:
3053:            private UpdatableRow getUpdatableRow() throws SQLException {
3054:                UpdatableRow row = new UpdatableRow(conn, result, session);
3055:                if (!row.isUpdatable()) {
3056:                    throw Message
3057:                            .getSQLException(ErrorCode.RESULT_SET_NOT_UPDATABLE);
3058:                }
3059:                return row;
3060:            }
3061:
3062:            int getColumnIndex(String columnName) throws SQLException {
3063:                checkClosed();
3064:                if (columnName == null) {
3065:                    throw Message.getInvalidValueException("columnName", null);
3066:                }
3067:                if (columnCount >= SysProperties.MIN_COLUMN_NAME_MAP) {
3068:                    if (columnNameMap == null) {
3069:                        HashMap map = new HashMap(columnCount);
3070:                        for (int i = 0; i < columnCount; i++) {
3071:                            String c = result.getAlias(i).toUpperCase();
3072:                            map.put(c, ObjectUtils.getInteger(i));
3073:                            String tabName = result.getTableName(i);
3074:                            if (tabName != null) {
3075:                                String colName = result.getColumnName(i);
3076:                                if (colName != null) {
3077:                                    c = tabName + "." + colName;
3078:                                    if (!map.containsKey(c)) {
3079:                                        map.put(c, ObjectUtils.getInteger(i));
3080:                                    }
3081:                                }
3082:                            }
3083:                        }
3084:                        columnNameMap = map;
3085:                    }
3086:                    Integer index = (Integer) columnNameMap.get(columnName
3087:                            .toUpperCase());
3088:                    if (index == null) {
3089:                        throw Message.getSQLException(
3090:                                ErrorCode.COLUMN_NOT_FOUND_1, columnName);
3091:                    }
3092:                    return index.intValue() + 1;
3093:                }
3094:                for (int i = 0; i < columnCount; i++) {
3095:                    if (columnName.equalsIgnoreCase(result.getAlias(i))) {
3096:                        return i + 1;
3097:                    }
3098:                }
3099:                int idx = columnName.indexOf('.');
3100:                if (idx > 0) {
3101:                    String table = columnName.substring(0, idx);
3102:                    String col = columnName.substring(idx + 1);
3103:                    for (int i = 0; i < columnCount; i++) {
3104:                        if (table.equalsIgnoreCase(result.getTableName(i))
3105:                                && col
3106:                                        .equalsIgnoreCase(result
3107:                                                .getColumnName(i))) {
3108:                            return i + 1;
3109:                        }
3110:                    }
3111:                }
3112:                throw Message.getSQLException(ErrorCode.COLUMN_NOT_FOUND_1,
3113:                        columnName);
3114:            }
3115:
3116:            private void checkColumnIndex(int columnIndex) throws SQLException {
3117:                checkClosed();
3118:                if (columnIndex < 1 || columnIndex > columnCount) {
3119:                    throw Message.getInvalidValueException("" + columnIndex,
3120:                            "columnIndex");
3121:                }
3122:            }
3123:
3124:            void checkClosed() throws SQLException {
3125:                if (result == null) {
3126:                    throw Message.getSQLException(ErrorCode.OBJECT_CLOSED);
3127:                }
3128:                if (stat != null) {
3129:                    stat.checkClosed();
3130:                }
3131:                if (conn != null) {
3132:                    conn.checkClosed();
3133:                }
3134:            }
3135:
3136:            private void checkOnValidRow() throws SQLException {
3137:                if (result.getRowId() < 0
3138:                        || result.getRowId() >= result.getRowCount()) {
3139:                    throw Message.getSQLException(ErrorCode.NO_DATA_AVAILABLE);
3140:                }
3141:            }
3142:
3143:            private Value get(int columnIndex) throws SQLException {
3144:                checkColumnIndex(columnIndex);
3145:                checkOnValidRow();
3146:                Value[] list = result.currentRow();
3147:                Value value = list[columnIndex - 1];
3148:                wasNull = value == ValueNull.INSTANCE;
3149:                return value;
3150:            }
3151:
3152:            private Value get(String columnName) throws SQLException {
3153:                int columnIndex = getColumnIndex(columnName);
3154:                return get(columnIndex);
3155:            }
3156:
3157:            private void update(String columnName, Value v) throws SQLException {
3158:                int columnIndex = getColumnIndex(columnName);
3159:                update(columnIndex, v);
3160:            }
3161:
3162:            private void update(int columnIndex, Value v) throws SQLException {
3163:                checkColumnIndex(columnIndex);
3164:                if (insertRow != null) {
3165:                    insertRow[columnIndex - 1] = v;
3166:                } else {
3167:                    if (updateRow == null) {
3168:                        updateRow = new Value[columnCount];
3169:                    }
3170:                    updateRow[columnIndex - 1] = v;
3171:                }
3172:            }
3173:
3174:            /**
3175:             * INTERNAL
3176:             */
3177:            public int getTraceId() {
3178:                return super .getTraceId();
3179:            }
3180:
3181:            private boolean nextRow() throws SQLException {
3182:                boolean next = result.next();
3183:                if (!next && !scrollable) {
3184:                    result.close();
3185:                }
3186:                return next;
3187:            }
3188:
3189:            private void resetResult() throws SQLException {
3190:                if (!scrollable) {
3191:                    throw Message
3192:                            .getSQLException(ErrorCode.RESULT_SET_NOT_SCROLLABLE);
3193:                }
3194:                result.reset();
3195:            }
3196:
3197:            /**
3198:             * [Not supported] Returns the value of the specified column as a row id.
3199:             *
3200:             * @param columnIndex (1,2,...)
3201:             */
3202:            //#ifdef JDK16
3203:            /*
3204:             public RowId getRowId(int columnIndex) throws SQLException {
3205:             throw Message.getUnsupportedException();
3206:             }
3207:             */
3208:            //#endif
3209:            /**
3210:             * [Not supported] Returns the value of the specified column as a row id.
3211:             *
3212:             * @param columnName the name of the column label
3213:             */
3214:            //#ifdef JDK16
3215:            /*
3216:             public RowId getRowId(String columnName) throws SQLException {
3217:             throw Message.getUnsupportedException();
3218:             }
3219:             */
3220:            //#endif
3221:            /**
3222:             * [Not supported] Updates a column in the current or insert row.
3223:             *
3224:             * @param columnIndex (1,2,...)
3225:             * @param x the value
3226:             */
3227:            //#ifdef JDK16
3228:            /*
3229:             public void updateRowId(int columnIndex, RowId x) throws SQLException {
3230:             throw Message.getUnsupportedException();
3231:             }
3232:             */
3233:            //#endif
3234:            /**
3235:             * [Not supported] Updates a column in the current or insert row.
3236:             *
3237:             * @param columnName the name of the column label
3238:             * @param x the value
3239:             */
3240:            //#ifdef JDK16
3241:            /*
3242:             public void updateRowId(String columnName, RowId x) throws SQLException {
3243:             throw Message.getUnsupportedException();
3244:             }
3245:             */
3246:            //#endif
3247:            /**
3248:             * Returns the current result set holdability.
3249:             *
3250:             * @return the holdability
3251:             * @throws SQLException if the connection is closed
3252:             */
3253:            public int getHoldability() throws SQLException {
3254:                try {
3255:                    debugCodeCall("getHoldability");
3256:                    checkClosed();
3257:                    return conn.getHoldability();
3258:                } catch (Throwable e) {
3259:                    throw logAndConvert(e);
3260:                }
3261:            }
3262:
3263:            /**
3264:             * Returns whether this result set is closed.
3265:             *
3266:             * @return true if the result set is closed
3267:             */
3268:            public boolean isClosed() throws SQLException {
3269:                try {
3270:                    debugCodeCall("isClosed");
3271:                    return result == null;
3272:                } catch (Throwable e) {
3273:                    throw logAndConvert(e);
3274:                }
3275:            }
3276:
3277:            /**
3278:             * Updates a column in the current or insert row.
3279:             *
3280:             * @param columnIndex (1,2,...)
3281:             * @param x the value
3282:             * @throws SQLException if the result set is closed
3283:             */
3284:            public void updateNString(int columnIndex, String x)
3285:                    throws SQLException {
3286:                try {
3287:                    if (debug()) {
3288:                        debugCode("updateNString(" + columnIndex + ", "
3289:                                + quote(x) + ");");
3290:                    }
3291:                    update(columnIndex, x == null ? (Value) ValueNull.INSTANCE
3292:                            : ValueString.get(x));
3293:                } catch (Throwable e) {
3294:                    throw logAndConvert(e);
3295:                }
3296:            }
3297:
3298:            /**
3299:             * Updates a column in the current or insert row.
3300:             *
3301:             * @param columnName the name of the column label
3302:             * @param x the value
3303:             * @throws SQLException if the result set is closed
3304:             */
3305:            public void updateNString(String columnName, String x)
3306:                    throws SQLException {
3307:                try {
3308:                    if (debug()) {
3309:                        debugCode("updateNString(" + quote(columnName) + ", "
3310:                                + quote(x) + ");");
3311:                    }
3312:                    update(columnName, x == null ? (Value) ValueNull.INSTANCE
3313:                            : ValueString.get(x));
3314:                } catch (Throwable e) {
3315:                    throw logAndConvert(e);
3316:                }
3317:            }
3318:
3319:            /**
3320:             * [Not supported]
3321:             */
3322:            //#ifdef JDK16
3323:            /*
3324:             public void updateNClob(int columnIndex, NClob x) throws SQLException {
3325:             try {
3326:             if (debug()) {
3327:             debugCode("updateNClob("+columnIndex+", x);");
3328:             }
3329:             throw Message.getUnsupportedException();
3330:             } catch (Throwable e) {
3331:             throw logAndConvert(e);
3332:             }
3333:             }
3334:             */
3335:            //#endif
3336:            /**
3337:             * [Not supported]
3338:             */
3339:            //#ifdef JDK16
3340:            /*
3341:             public void updateNClob(int columnIndex, Reader x) throws SQLException {
3342:             try {
3343:             if (debug()) {
3344:             debugCode("updateNClob("+columnIndex+", x);");
3345:             }
3346:             throw Message.getUnsupportedException();
3347:             } catch (Throwable e) {
3348:             throw logAndConvert(e);
3349:             }
3350:             }
3351:             */
3352:            //#endif
3353:            /**
3354:             * [Not supported]
3355:             */
3356:            //#ifdef JDK16
3357:            /*
3358:             public void updateNClob(int columnIndex, Reader x, long length) 
3359:             throws SQLException {
3360:             try {
3361:             if (debug()) {
3362:             debugCode("updateNClob("+columnIndex+", x, " + length + "L);");
3363:             }
3364:             throw Message.getUnsupportedException();
3365:             } catch (Throwable e) {
3366:             throw logAndConvert(e);
3367:             }
3368:             }
3369:             */
3370:            //#endif
3371:            /**
3372:             * [Not supported]
3373:             */
3374:            //#ifdef JDK16
3375:            /*
3376:             public void updateNClob(String columnName, Reader x) 
3377:             throws SQLException {
3378:             try {
3379:             if (debug()) {
3380:             debugCode("updateNClob("+quote(columnName)+", x);");
3381:             }
3382:             throw Message.getUnsupportedException();
3383:             } catch (Throwable e) {
3384:             throw logAndConvert(e);
3385:             }
3386:             }
3387:             */
3388:            //#endif
3389:            /**
3390:             * [Not supported]
3391:             */
3392:            //#ifdef JDK16
3393:            /*
3394:             public void updateNClob(String columnName, Reader x, long length) 
3395:             throws SQLException {
3396:             try {
3397:             if (debug()) {
3398:             debugCode("updateNClob("+quote(columnName)+", x, " + length+"L);");
3399:             }
3400:             throw Message.getUnsupportedException();
3401:             } catch (Throwable e) {
3402:             throw logAndConvert(e);
3403:             }
3404:             }
3405:             */
3406:            //#endif
3407:            /**
3408:             * [Not supported]
3409:             */
3410:            //#ifdef JDK16
3411:            /*
3412:             public void updateNClob(String columnName, NClob x) throws SQLException {
3413:             try {
3414:             if (debug()) {
3415:             debugCode("updateNClob("+quote(columnName)+", x);");
3416:             }
3417:             throw Message.getUnsupportedException();
3418:             } catch (Throwable e) {
3419:             throw logAndConvert(e);
3420:             }
3421:             }
3422:             */
3423:            //#endif
3424:
3425:            /**
3426:             * Returns the value of the specified column as a Clob.
3427:             *
3428:             * @param columnIndex (1,2,...)
3429:             * @return the value
3430:             * @throws SQLException if the column is not found or if the result set is closed
3431:             */
3432:            //#ifdef JDK16
3433:            /*
3434:             public NClob getNClob(int columnIndex) throws SQLException {
3435:             try {
3436:             int id = getNextId(TraceObject.CLOB);
3437:             debugCodeAssign("NClob", TraceObject.CLOB, id, "getNClob(" + columnIndex + ")");
3438:             Value v = get(columnIndex);
3439:             return v == ValueNull.INSTANCE ? null : new JdbcClob(session, conn, v, id);
3440:             } catch (Throwable e) {
3441:             throw logAndConvert(e);
3442:             }
3443:             }
3444:             */
3445:            //#endif
3446:            /**
3447:             * Returns the value of the specified column as a Clob.
3448:             *
3449:             * @param columnName the name of the column label
3450:             * @return the value
3451:             * @throws SQLException if the column is not found or if the result set is closed
3452:             */
3453:            //#ifdef JDK16
3454:            /*
3455:             public NClob getNClob(String columnName) throws SQLException {
3456:             try {
3457:             int id = getNextId(TraceObject.CLOB);
3458:             debugCodeAssign("NClob", TraceObject.CLOB, id, "getNClob(" + columnName + ")");
3459:             Value v = get(columnName);
3460:             return v == ValueNull.INSTANCE ? null : new JdbcClob(session, conn, v, id);
3461:             } catch (Throwable e) {
3462:             throw logAndConvert(e);
3463:             }
3464:             }
3465:             */
3466:            //#endif
3467:            /**
3468:             * [Not supported] Returns the value of the specified column as a SQLXML object.
3469:             */
3470:            //#ifdef JDK16
3471:            /*
3472:             public SQLXML getSQLXML(int columnIndex) throws SQLException {
3473:             throw Message.getUnsupportedException();
3474:             }
3475:             */
3476:            //#endif
3477:            /**
3478:             * [Not supported] Returns the value of the specified column as a SQLXML object.
3479:             */
3480:            //#ifdef JDK16
3481:            /*
3482:             public SQLXML getSQLXML(String columnName) throws SQLException {
3483:             throw Message.getUnsupportedException();
3484:             }
3485:             */
3486:            //#endif
3487:            /**
3488:             * [Not supported] Updates a column in the current or insert row.
3489:             */
3490:            //#ifdef JDK16
3491:            /*
3492:             public void updateSQLXML(int columnIndex, SQLXML xmlObject) 
3493:             throws SQLException {
3494:             throw Message.getUnsupportedException();
3495:             }
3496:             */
3497:            //#endif
3498:            /**
3499:             * [Not supported] Updates a column in the current or insert row.
3500:             */
3501:            //#ifdef JDK16
3502:            /*
3503:             public void updateSQLXML(String columnName, SQLXML xmlObject) 
3504:             throws SQLException {
3505:             throw Message.getUnsupportedException();
3506:             }
3507:             */
3508:            //#endif
3509:            /**
3510:             * Returns the value of the specified column as a String.
3511:             * 
3512:             * @param columnIndex (1,2,...)
3513:             * @return the value
3514:             * @throws SQLException if the column is not found or if the result set is
3515:             *             closed
3516:             */
3517:            public String getNString(int columnIndex) throws SQLException {
3518:                try {
3519:                    debugCodeCall("getNString", columnIndex);
3520:                    return get(columnIndex).getString();
3521:                } catch (Throwable e) {
3522:                    throw logAndConvert(e);
3523:                }
3524:            }
3525:
3526:            /**
3527:             * Returns the value of the specified column as a String.
3528:             * 
3529:             * @param columnName
3530:             * @return the value
3531:             * @throws SQLException if the column is not found or if the result set is
3532:             *             closed
3533:             */
3534:            public String getNString(String columnName) throws SQLException {
3535:                try {
3536:                    debugCodeCall("getNString", columnName);
3537:                    return get(columnName).getString();
3538:                } catch (Throwable e) {
3539:                    throw logAndConvert(e);
3540:                }
3541:            }
3542:
3543:            /**
3544:             * Returns the value of the specified column as input stream.
3545:             * 
3546:             * @param columnIndex (1,2,...)
3547:             * @return the value
3548:             * @throws SQLException if the column is not found or if the result set is
3549:             *             closed
3550:             */
3551:            public Reader getNCharacterStream(int columnIndex)
3552:                    throws SQLException {
3553:                try {
3554:                    debugCodeCall("getNCharacterStream", columnIndex);
3555:                    return get(columnIndex).getReader();
3556:                } catch (Throwable e) {
3557:                    throw logAndConvert(e);
3558:                }
3559:            }
3560:
3561:            /**
3562:             * Returns the value of the specified column as input stream.
3563:             * 
3564:             * @param columnName the name of the column label
3565:             * @return the value
3566:             * @throws SQLException if the column is not found or if the result set is
3567:             *             closed
3568:             */
3569:            public Reader getNCharacterStream(String columnName)
3570:                    throws SQLException {
3571:                try {
3572:                    debugCodeCall("getNCharacterStream", columnName);
3573:                    return get(columnName).getReader();
3574:                } catch (Throwable e) {
3575:                    throw logAndConvert(e);
3576:                }
3577:            }
3578:
3579:            /**
3580:             * Updates a column in the current or insert row.
3581:             *
3582:             * @param columnIndex (1,2,...)
3583:             * @param x the value
3584:             * @param length the number of characters
3585:             * @throws SQLException if the result set is closed
3586:             */
3587:            public void updateNCharacterStream(int columnIndex, Reader x,
3588:                    int length) throws SQLException {
3589:                updateNCharacterStream(columnIndex, x, (long) length);
3590:            }
3591:
3592:            /**
3593:             * Updates a column in the current or insert row.
3594:             *
3595:             * @param columnIndex (1,2,...)
3596:             * @param x the value
3597:             * @throws SQLException if the result set is closed
3598:             */
3599:            public void updateNCharacterStream(int columnIndex, Reader x)
3600:                    throws SQLException {
3601:                updateNCharacterStream(columnIndex, x, -1);
3602:            }
3603:
3604:            /**
3605:             * Updates a column in the current or insert row.
3606:             *
3607:             * @param columnIndex (1,2,...)
3608:             * @param x the value
3609:             * @param length the number of characters
3610:             * @throws SQLException if the result set is closed
3611:             */
3612:            public void updateNCharacterStream(int columnIndex, Reader x,
3613:                    long length) throws SQLException {
3614:                try {
3615:                    if (debug()) {
3616:                        debugCode("updateNCharacterStream(" + columnIndex
3617:                                + ", x, " + length + "L);");
3618:                    }
3619:                    checkClosed();
3620:                    Value v = conn.createClob(x, length);
3621:                    update(columnIndex, v);
3622:                } catch (Throwable e) {
3623:                    throw logAndConvert(e);
3624:                }
3625:            }
3626:
3627:            /**
3628:             * Updates a column in the current or insert row.
3629:             *
3630:             * @param columnName the name of the column label
3631:             * @param x the value
3632:             * @param length the number of characters
3633:             * @throws SQLException if the result set is closed
3634:             */
3635:            public void updateNCharacterStream(String columnName, Reader x,
3636:                    int length) throws SQLException {
3637:                updateNCharacterStream(columnName, x, (long) length);
3638:            }
3639:
3640:            /**
3641:             * Updates a column in the current or insert row.
3642:             *
3643:             * @param columnName the name of the column label
3644:             * @param x the value
3645:             * @throws SQLException if the result set is closed
3646:             */
3647:            public void updateNCharacterStream(String columnName, Reader x)
3648:                    throws SQLException {
3649:                updateNCharacterStream(columnName, x, -1);
3650:            }
3651:
3652:            /**
3653:             * Updates a column in the current or insert row.
3654:             *
3655:             * @param columnName the name of the column label
3656:             * @param x the value
3657:             * @param length the number of characters
3658:             * @throws SQLException if the result set is closed
3659:             */
3660:            public void updateNCharacterStream(String columnName, Reader x,
3661:                    long length) throws SQLException {
3662:                try {
3663:                    if (debug()) {
3664:                        debugCode("updateNCharacterStream(" + quote(columnName)
3665:                                + ", x, " + length + "L);");
3666:                    }
3667:                    checkClosed();
3668:                    Value v = conn.createClob(x, length);
3669:                    update(columnName, v);
3670:                } catch (Throwable e) {
3671:                    throw logAndConvert(e);
3672:                }
3673:            }
3674:
3675:            /**
3676:             * [Not supported] Return an object of this class if possible.
3677:             */
3678:            //#ifdef JDK16
3679:            /*
3680:             public <T> T unwrap(Class<T> iface) throws SQLException {
3681:             debugCode("unwrap");
3682:             throw Message.getUnsupportedException();
3683:             }
3684:             */
3685:            //#endif
3686:            /**
3687:             * [Not supported] Checks if unwrap can return an object of this class.
3688:             */
3689:            //#ifdef JDK16
3690:            /*
3691:             public boolean isWrapperFor(Class< ? > iface) throws SQLException {
3692:             debugCode("isWrapperFor");
3693:             throw Message.getUnsupportedException();
3694:             }
3695:             */
3696:            //#endif
3697:            /**
3698:             * INTERNAL
3699:             */
3700:            public String toString() {
3701:                return getTraceObjectName() + ": " + result;
3702:            }
3703:
3704:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.