Source Code Cross Referenced for DCResultSet.java in  » J2EE » panther » org » lateralnz » c3d » 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 » J2EE » panther » org.lateralnz.c3d 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /* ====================================================================
0002:         * The LateralNZ Software License, Version 1.0
0003:         *
0004:         * Copyright (c) 2003 LateralNZ.  All rights reserved.
0005:         *
0006:         * Redistribution and use in source and binary forms, with or without
0007:         * modification, are permitted provided that the following conditions
0008:         * are met:
0009:         *
0010:         * 1. Redistributions of source code must retain the above copyright
0011:         *    notice, this list of conditions and the following disclaimer.
0012:         *
0013:         * 2. Redistributions in binary form must reproduce the above copyright
0014:         *    notice, this list of conditions and the following disclaimer in
0015:         *    the documentation and/or other materials provided with the
0016:         *    distribution.
0017:         *
0018:         * 3. The end-user documentation included with the redistribution,
0019:         *    if any, must include the following acknowledgment:
0020:         *       "This product includes software developed by 
0021:         *        LateralNZ (http://www.lateralnz.org/) and other third parties."
0022:         *    Alternately, this acknowledgment may appear in the software itself,
0023:         *    if and wherever such third-party acknowledgments normally appear.
0024:         *
0025:         * 4. The names "LateralNZ" must not be used to endorse or promote 
0026:         *    products derived from this software without prior written 
0027:         *    permission. For written permission, please 
0028:         *    contact oss@lateralnz.org.
0029:         *
0030:         * 5. Products derived from this software may not be called "Panther", 
0031:         *    or "Lateral" or "LateralNZ", nor may "PANTHER" or "LATERAL" or 
0032:         *    "LATERALNZ" appear in their name, without prior written 
0033:         *    permission of LateralNZ.
0034:         *
0035:         * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
0036:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
0037:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
0038:         * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
0039:         * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0040:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0041:         * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
0042:         * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
0043:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
0044:         * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
0045:         * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0046:         * SUCH DAMAGE.
0047:         * ====================================================================
0048:         *
0049:         * This software consists of voluntary contributions made by many
0050:         * individuals on behalf of LateralNZ.  For more
0051:         * information on Lateral, please see http://www.lateralnz.com/ or
0052:         * http://www.lateralnz.org
0053:         *
0054:         */
0055:        package org.lateralnz.c3d;
0056:
0057:        import java.io.ByteArrayInputStream;
0058:        import java.io.InputStream;
0059:        import java.io.Reader;
0060:        import java.io.Serializable;
0061:        import java.io.StringReader;
0062:        import java.math.BigDecimal;
0063:        import java.net.MalformedURLException;
0064:        import java.net.URL;
0065:        import java.sql.Array;
0066:        import java.sql.Blob;
0067:        import java.sql.Clob;
0068:        import java.sql.Date;
0069:        import java.sql.Ref;
0070:        import java.sql.ResultSet;
0071:        import java.sql.ResultSetMetaData;
0072:        import java.sql.SQLException;
0073:        import java.sql.SQLWarning;
0074:        import java.sql.Statement;
0075:        import java.sql.Time;
0076:        import java.sql.Timestamp;
0077:        import java.text.ParseException;
0078:        import java.util.ArrayList;
0079:        import java.util.HashMap;
0080:
0081:        import org.lateralnz.common.util.Constants;
0082:        import org.lateralnz.common.util.DateUtils;
0083:        import org.lateralnz.common.util.IOUtils;
0084:        import org.lateralnz.common.util.StringUtils;
0085:
0086:        import org.lateralnz.c3d.util.Column;
0087:        import org.lateralnz.c3d.util.DBUtils;
0088:        import org.lateralnz.c3d.util.PositionData;
0089:
0090:        /**
0091:         * a resultset object to use in the cache.  All operations related to updating the contents
0092:         * of this resultset are unsupported.  See individual methods for details
0093:         */
0094:        public class DCResultSet implements  ResultSet, Serializable, Constants {
0095:            private static final String CLASSNAME = DCResultSet.class.getName();
0096:            private static final String DBDATEFORMAT = "dbdateformat";
0097:            private static final String T = "t";
0098:
0099:            private String cacheName;
0100:            private boolean closed = false; // is this resultset closed?
0101:            private DCResultSetMetaData metadata; // cached metadata
0102:            private transient DatabaseEngine dbengine; // link the database engine
0103:            private String cursorName = null; // link to the cursor name
0104:            private ArrayList rows = new ArrayList(); // the row data
0105:            private int size; // size of the rows list
0106:            private String[] colnames; // names of the columns
0107:            private int concurrency;
0108:            private int type;
0109:            protected long lastAccessed = System.currentTimeMillis();
0110:
0111:            private String dateformat = null;
0112:
0113:            private HashMap positions = new HashMap();
0114:
0115:            private DCResultSet(DatabaseEngine dbengine) {
0116:                this .dbengine = dbengine;
0117:                dateformat = dbengine.getProperty(DBDATEFORMAT);
0118:            }
0119:
0120:            public DCResultSet(String[] columnNames, ArrayList rows,
0121:                    DatabaseEngine dbengine) {
0122:                this (dbengine);
0123:                this .metadata = new DCResultSetMetaData(columnNames);
0124:                this .rows = rows;
0125:                this .size = rows.size();
0126:            }
0127:
0128:            public DCResultSet(String cacheName, String sql, ResultSet rs,
0129:                    DatabaseEngine dbengine, int concurrency, int type)
0130:                    throws SQLException {
0131:                this (dbengine);
0132:                this .cacheName = cacheName;
0133:                this .concurrency = concurrency;
0134:                this .type = type;
0135:
0136:                if (rs != null) {
0137:                    this .cursorName = rs.getCursorName();
0138:                    ResultSetMetaData rsmd = rs.getMetaData();
0139:                    int count = rsmd.getColumnCount();
0140:                    int i, j;
0141:
0142:                    int[] types = new int[count];
0143:                    colnames = new String[count];
0144:                    for (i = 0, j = 1; i < count; i++, j++) {
0145:                        types[i] = rsmd.getColumnType(j);
0146:                        colnames[i] = rsmd.getColumnName(j);
0147:                    }
0148:
0149:                    int[] keyColumns = null;
0150:                    if (!StringUtils.isEmpty(cacheName)) {
0151:                        keyColumns = dbengine.getPrimaryKeyColumns(cacheName,
0152:                                rsmd);
0153:                        if (keyColumns == null) {
0154:                            throw new SQLException(
0155:                                    "unable to match columns in resultset with primary keys");
0156:                        }
0157:                    }
0158:
0159:                    Column[] cols;
0160:                    while (rs.next()) {
0161:                        cols = new Column[count];
0162:                        for (i = 0, j = 1; i < count; i++, j++) {
0163:                            cols[i] = DBUtils.createColumn(rs, types, j);
0164:                        }
0165:                        if (keyColumns != null) {
0166:                            String[] keyData = DBUtils.getKeyColumnData(
0167:                                    keyColumns, rs);
0168:                            dbengine.setKeyToResultSetLink(cacheName, keyData,
0169:                                    sql);
0170:                        }
0171:
0172:                        rows.add(cols);
0173:                    }
0174:
0175:                    this .metadata = new DCResultSetMetaData(rsmd);
0176:                } else {
0177:                    metadata = new DCResultSetMetaData();
0178:                }
0179:
0180:                size = rows.size();
0181:
0182:                if (size > 0 && cacheName != null && sql != null) {
0183:                    dbengine.setCachedResultSet(cacheName, sql, this );
0184:                }
0185:            }
0186:
0187:            private PositionData getPosition() throws SQLException {
0188:                return (PositionData) DBUtils.getObjectFromMap(Integer
0189:                        .toString(System.identityHashCode(Thread
0190:                                .currentThread())), positions,
0191:                        PositionData.class);
0192:            }
0193:
0194:            private void sanityCheck() throws SQLException {
0195:                //    PositionData pd = getPosition();
0196:                //    if (pd.closed) {
0197:                //      throw new SQLException("resultset has been closed");
0198:                //    }
0199:            }
0200:
0201:            private Column getColumn(int idx) throws SQLException {
0202:                sanityCheck();
0203:                if (isBeforeFirst() || isAfterLast()) {
0204:                    throw new SQLException("resultset not correctly positioned");
0205:                } else {
0206:                    PositionData pd = getPosition();
0207:                    IOUtils.close(pd.lastInputStream);
0208:                    pd.lastInputStream = null;
0209:                    IOUtils.close(pd.lastReader);
0210:                    pd.lastReader = null;
0211:                    pd.lastColumnWasNull = pd.currentcols[idx - 1].getNull();
0212:                    return pd.currentcols[idx - 1];
0213:                }
0214:            }
0215:
0216:            private void setRow(PositionData pd) {
0217:                if (pd.rowpos >= 0 && pd.rowpos < size) {
0218:                    pd.currentcols = (Column[]) rows.get(pd.rowpos);
0219:                } else {
0220:                    pd.currentcols = null;
0221:                }
0222:            }
0223:
0224:            public boolean absolute(int param) throws SQLException {
0225:                sanityCheck();
0226:                PositionData pd = getPosition();
0227:                param--;
0228:                if (param < 0) {
0229:                    pd.rowpos = -1;
0230:                    setRow(pd);
0231:                    return false;
0232:                } else if (param >= size) {
0233:                    pd.rowpos = size;
0234:                    setRow(pd);
0235:                    return false;
0236:                } else {
0237:                    pd.rowpos = param;
0238:                    setRow(pd);
0239:                    return true;
0240:                }
0241:            }
0242:
0243:            public void afterLast() throws SQLException {
0244:                sanityCheck();
0245:                PositionData pd = getPosition();
0246:                pd.rowpos = size;
0247:                setRow(pd);
0248:            }
0249:
0250:            public void beforeFirst() throws SQLException {
0251:                sanityCheck();
0252:                PositionData pd = getPosition();
0253:                pd.rowpos = -1;
0254:                setRow(pd);
0255:            }
0256:
0257:            /**
0258:             * this operation is not supported
0259:             */
0260:            public void cancelRowUpdates() throws SQLException {
0261:                throw new SQLException("operation not supported");
0262:            }
0263:
0264:            public void clearWarnings() throws SQLException {
0265:            }
0266:
0267:            public void close() throws SQLException {
0268:                PositionData pd = getPosition();
0269:                pd.reset();
0270:                positions.remove(Integer.toString(System
0271:                        .identityHashCode(Thread.currentThread())));
0272:            }
0273:
0274:            /**
0275:             * this operation is not supported
0276:             */
0277:            public void deleteRow() throws SQLException {
0278:                throw new SQLException("operation not supported");
0279:            }
0280:
0281:            public int findColumn(String str) throws SQLException {
0282:                sanityCheck();
0283:                if (StringUtils.isEmpty(str)) {
0284:                    throw new SQLException("empty column name");
0285:                }
0286:                for (int i = 0; i < colnames.length; i++) {
0287:                    if (colnames[i].equals(str)) {
0288:                        return i + 1;
0289:                    }
0290:                }
0291:                throw new SQLException("unable to find column " + str);
0292:            }
0293:
0294:            public boolean first() throws SQLException {
0295:                sanityCheck();
0296:                if (size < 1) {
0297:                    return false;
0298:                }
0299:                PositionData pd = getPosition();
0300:                pd.rowpos = 0;
0301:                setRow(pd);
0302:                return true;
0303:            }
0304:
0305:            /**
0306:             * this operation is not supported
0307:             */
0308:            public Array getArray(int param) throws SQLException {
0309:                throw new SQLException("operation not supported");
0310:            }
0311:
0312:            public Array getArray(String str) throws SQLException {
0313:                return getArray(findColumn(str));
0314:            }
0315:
0316:            public InputStream getAsciiStream(int param) throws SQLException {
0317:                Column col = getColumn(param);
0318:                if (col.getNull()) {
0319:                    return null;
0320:                } else {
0321:                    PositionData pd = getPosition();
0322:                    pd.lastInputStream = new ByteArrayInputStream(col
0323:                            .getValue());
0324:                    return pd.lastInputStream;
0325:                }
0326:            }
0327:
0328:            public InputStream getAsciiStream(String str) throws SQLException {
0329:                return getAsciiStream(findColumn(str));
0330:            }
0331:
0332:            public BigDecimal getBigDecimal(int param) throws SQLException {
0333:                Column col = getColumn(param);
0334:                if (col.getNull()) {
0335:                    return null;
0336:                } else {
0337:                    return new BigDecimal(new String(col.getValue()));
0338:                }
0339:            }
0340:
0341:            public BigDecimal getBigDecimal(String str) throws SQLException {
0342:                return getBigDecimal(findColumn(str));
0343:            }
0344:
0345:            public BigDecimal getBigDecimal(int param, int param1)
0346:                    throws SQLException {
0347:                return getBigDecimal(param);
0348:            }
0349:
0350:            public BigDecimal getBigDecimal(String str, int param)
0351:                    throws SQLException {
0352:                return getBigDecimal(findColumn(str));
0353:            }
0354:
0355:            public InputStream getBinaryStream(int param) throws SQLException {
0356:                Column col = getColumn(param);
0357:                if (col.getNull()) {
0358:                    return null;
0359:                } else {
0360:                    PositionData pd = getPosition();
0361:                    pd.lastInputStream = new ByteArrayInputStream(col
0362:                            .getValue());
0363:                    return pd.lastInputStream;
0364:                }
0365:            }
0366:
0367:            public InputStream getBinaryStream(String str) throws SQLException {
0368:                return getBinaryStream(findColumn(str));
0369:            }
0370:
0371:            /**
0372:             * this operation is not supported
0373:             */
0374:            public Blob getBlob(int param) throws SQLException {
0375:                throw new SQLException("operation not supported");
0376:            }
0377:
0378:            public Blob getBlob(String str) throws SQLException {
0379:                return getBlob(findColumn(str));
0380:            }
0381:
0382:            public boolean getBoolean(int param) throws SQLException {
0383:                Column col = getColumn(param);
0384:                if (col.getNull()) {
0385:                    return false;
0386:                } else {
0387:                    String s = new String(getColumn(param).getValue());
0388:                    if (s.equalsIgnoreCase(Y) || s.equalsIgnoreCase(T)
0389:                            || s.equalsIgnoreCase(TRUE)) {
0390:                        return true;
0391:                    } else {
0392:                        return false;
0393:                    }
0394:                }
0395:            }
0396:
0397:            public boolean getBoolean(String str) throws SQLException {
0398:                return getBoolean(findColumn(str));
0399:            }
0400:
0401:            public byte getByte(int param) throws SQLException {
0402:                Column col = getColumn(param);
0403:                if (col.getNull() || col.getValue() == null
0404:                        || col.getValue().length < 1) {
0405:                    return 0;
0406:                } else {
0407:                    return col.getValue()[0];
0408:                }
0409:            }
0410:
0411:            public byte getByte(String str) throws SQLException {
0412:                return getByte(findColumn(str));
0413:            }
0414:
0415:            public byte[] getBytes(int param) throws SQLException {
0416:                return getColumn(param).getValue();
0417:            }
0418:
0419:            public byte[] getBytes(String str) throws SQLException {
0420:                return getBytes(findColumn(str));
0421:            }
0422:
0423:            public Reader getCharacterStream(int param) throws SQLException {
0424:                Column col = getColumn(param);
0425:                if (col.getNull()) {
0426:                    return null;
0427:                } else {
0428:                    PositionData pd = getPosition();
0429:                    pd.lastReader = new StringReader(new String(col.getValue()));
0430:                    return pd.lastReader;
0431:                }
0432:            }
0433:
0434:            public Reader getCharacterStream(String str) throws SQLException {
0435:                return getCharacterStream(findColumn(str));
0436:            }
0437:
0438:            /**
0439:             * this operation is not supported
0440:             */
0441:            public Clob getClob(int param) throws SQLException {
0442:                throw new SQLException("operation not supported");
0443:            }
0444:
0445:            public Clob getClob(String str) throws SQLException {
0446:                return getClob(findColumn(str));
0447:            }
0448:
0449:            public int getConcurrency() throws SQLException {
0450:                return concurrency;
0451:            }
0452:
0453:            public String getCursorName() throws SQLException {
0454:                return cursorName;
0455:            }
0456:
0457:            public Date getDate(int param) throws SQLException {
0458:                Column col = getColumn(param);
0459:                if (col.getNull()) {
0460:                    return null;
0461:                } else {
0462:                    try {
0463:                        String s = new String(col.getValue());
0464:                        java.util.Date d = DateUtils.parseDate(CLASSNAME, s,
0465:                                dateformat);
0466:                        return new Date(d.getTime());
0467:                    } catch (ParseException pe) {
0468:                        throw new SQLException("unexpected date format");
0469:                    }
0470:                }
0471:            }
0472:
0473:            public Date getDate(String str) throws SQLException {
0474:                return getDate(findColumn(str));
0475:            }
0476:
0477:            /**
0478:             * this operation is not supported
0479:             */
0480:            public Date getDate(int param, java.util.Calendar calendar)
0481:                    throws SQLException {
0482:                throw new SQLException("operation not supported");
0483:            }
0484:
0485:            public Date getDate(String str, java.util.Calendar calendar)
0486:                    throws SQLException {
0487:                return getDate(findColumn(str), calendar);
0488:            }
0489:
0490:            public double getDouble(int param) throws SQLException {
0491:                Column col = getColumn(param);
0492:                if (col.getNull()) {
0493:                    return 0.0d;
0494:                } else {
0495:                    return Double.parseDouble(new String(col.getValue()));
0496:                }
0497:            }
0498:
0499:            public double getDouble(String str) throws SQLException {
0500:                return getDouble(findColumn(str));
0501:            }
0502:
0503:            public int getFetchDirection() throws SQLException {
0504:                return ResultSet.FETCH_UNKNOWN;
0505:            }
0506:
0507:            /**
0508:             * this operation is not supported
0509:             */
0510:            public int getFetchSize() throws SQLException {
0511:                throw new SQLException("operation not supported");
0512:            }
0513:
0514:            public float getFloat(int param) throws SQLException {
0515:                Column col = getColumn(param);
0516:                if (col.getNull()) {
0517:                    return 0.0f;
0518:                } else {
0519:                    return Float.parseFloat(new String(col.getValue()));
0520:                }
0521:            }
0522:
0523:            public float getFloat(String str) throws SQLException {
0524:                return getFloat(findColumn(str));
0525:            }
0526:
0527:            public int getInt(int param) throws SQLException {
0528:                Column col = getColumn(param);
0529:                if (col.getNull()) {
0530:                    return 0;
0531:                } else {
0532:                    return Integer.parseInt(new String(col.getValue()));
0533:                }
0534:            }
0535:
0536:            public int getInt(String str) throws SQLException {
0537:                return getInt(findColumn(str));
0538:            }
0539:
0540:            public long getLong(int param) throws SQLException {
0541:                Column col = getColumn(param);
0542:                if (col.getNull()) {
0543:                    return 0l;
0544:                } else {
0545:                    return Long.parseLong(new String(col.getValue()));
0546:                }
0547:            }
0548:
0549:            public long getLong(String str) throws SQLException {
0550:                return getLong(findColumn(str));
0551:            }
0552:
0553:            public ResultSetMetaData getMetaData() throws SQLException {
0554:                return metadata;
0555:            }
0556:
0557:            /**
0558:             * this operation is not supported
0559:             */
0560:            public Object getObject(int param) throws SQLException {
0561:                throw new SQLException("operation not supported");
0562:            }
0563:
0564:            public Object getObject(String str) throws SQLException {
0565:                return getObject(findColumn(str));
0566:            }
0567:
0568:            /**
0569:             * this operation is not supported
0570:             */
0571:            public Object getObject(int param, java.util.Map map)
0572:                    throws SQLException {
0573:                throw new SQLException("operation not supported");
0574:            }
0575:
0576:            public Object getObject(String str, java.util.Map map)
0577:                    throws SQLException {
0578:                return getObject(findColumn(str), map);
0579:            }
0580:
0581:            /**
0582:             * this operation is not supported
0583:             */
0584:            public Ref getRef(int param) throws SQLException {
0585:                throw new SQLException("operation not supported");
0586:            }
0587:
0588:            public Ref getRef(String str) throws SQLException {
0589:                return getRef(findColumn(str));
0590:            }
0591:
0592:            public int getRow() throws SQLException {
0593:                PositionData pd = getPosition();
0594:                return pd.rowpos + 1;
0595:            }
0596:
0597:            public int getRowCount() {
0598:                return size;
0599:            }
0600:
0601:            public short getShort(int param) throws SQLException {
0602:                Column col = getColumn(param);
0603:                if (col.getNull()) {
0604:                    return 0;
0605:                } else {
0606:                    return Short.parseShort(new String(col.getValue()));
0607:                }
0608:            }
0609:
0610:            public short getShort(String str) throws SQLException {
0611:                return getShort(findColumn(str));
0612:            }
0613:
0614:            /**
0615:             * this always returns null
0616:             */
0617:            public Statement getStatement() throws SQLException {
0618:                return null;
0619:            }
0620:
0621:            public String getString(int param) throws SQLException {
0622:                Column col = getColumn(param);
0623:                if (col.getNull()) {
0624:                    return null;
0625:                } else {
0626:                    return new String(col.getValue());
0627:                }
0628:            }
0629:
0630:            public String getString(String str) throws SQLException {
0631:                return getString(findColumn(str));
0632:            }
0633:
0634:            public Time getTime(int param) throws SQLException {
0635:                Column col = getColumn(param);
0636:                if (col.getNull()) {
0637:                    return null;
0638:                } else {
0639:                    String s = new String(col.getValue());
0640:                    if (s.indexOf('.') >= 0) {
0641:                        s = s.substring(0, s.indexOf('.'));
0642:                    }
0643:                    return Time.valueOf(s);
0644:                }
0645:            }
0646:
0647:            public Time getTime(String str) throws SQLException {
0648:                return getTime(findColumn(str));
0649:            }
0650:
0651:            /**
0652:             * this operation is not supported
0653:             */
0654:            public Time getTime(int param, java.util.Calendar calendar)
0655:                    throws SQLException {
0656:                throw new SQLException("operation not supported");
0657:            }
0658:
0659:            public Time getTime(String str, java.util.Calendar calendar)
0660:                    throws SQLException {
0661:                return getTime(findColumn(str), calendar);
0662:            }
0663:
0664:            public Timestamp getTimestamp(int param) throws SQLException {
0665:                Column col = getColumn(param);
0666:                if (col.getNull()) {
0667:                    return null;
0668:                } else {
0669:                    return Timestamp.valueOf(new String(col.getValue()));
0670:                }
0671:            }
0672:
0673:            public Timestamp getTimestamp(String str) throws SQLException {
0674:                return getTimestamp(findColumn(str));
0675:            }
0676:
0677:            /**
0678:             * this operation is not supported
0679:             */
0680:            public Timestamp getTimestamp(int param, java.util.Calendar calendar)
0681:                    throws SQLException {
0682:                throw new SQLException("operation not supported");
0683:            }
0684:
0685:            public Timestamp getTimestamp(String str,
0686:                    java.util.Calendar calendar) throws SQLException {
0687:                return getTimestamp(findColumn(str), calendar);
0688:            }
0689:
0690:            public int getType() throws SQLException {
0691:                return type;
0692:            }
0693:
0694:            public URL getURL(int param) throws SQLException {
0695:                Column col = getColumn(param);
0696:                if (col.getNull()) {
0697:                    return null;
0698:                } else {
0699:                    try {
0700:                        return new URL(new String(col.getValue()));
0701:                    } catch (MalformedURLException mue) {
0702:                        throw new SQLException("not a url");
0703:                    }
0704:                }
0705:            }
0706:
0707:            public URL getURL(String str) throws SQLException {
0708:                return getURL(findColumn(str));
0709:            }
0710:
0711:            /**
0712:             * this operation is not supported
0713:             */
0714:            public InputStream getUnicodeStream(String str) throws SQLException {
0715:                throw new SQLException("operation not supported");
0716:            }
0717:
0718:            /**
0719:             * this operation is not supported
0720:             */
0721:            public InputStream getUnicodeStream(int param) throws SQLException {
0722:                throw new SQLException("operation not supported");
0723:            }
0724:
0725:            public SQLWarning getWarnings() throws SQLException {
0726:                return null;
0727:            }
0728:
0729:            /**
0730:             * this operation is not supported
0731:             */
0732:            public void insertRow() throws SQLException {
0733:                throw new SQLException("operation not supported");
0734:            }
0735:
0736:            public boolean isAfterLast() throws SQLException {
0737:                sanityCheck();
0738:                PositionData pd = getPosition();
0739:                return pd.rowpos >= size;
0740:            }
0741:
0742:            public boolean isBeforeFirst() throws SQLException {
0743:                sanityCheck();
0744:                PositionData pd = getPosition();
0745:                return pd.rowpos < 0;
0746:            }
0747:
0748:            public boolean isFirst() throws SQLException {
0749:                sanityCheck();
0750:                PositionData pd = getPosition();
0751:                return pd.rowpos == 0;
0752:            }
0753:
0754:            public boolean isLast() throws SQLException {
0755:                sanityCheck();
0756:                PositionData pd = getPosition();
0757:                return pd.rowpos == size - 1;
0758:            }
0759:
0760:            public boolean last() throws SQLException {
0761:                sanityCheck();
0762:                if (size < 1) {
0763:                    return false;
0764:                }
0765:                PositionData pd = getPosition();
0766:                pd.rowpos = size - 1;
0767:                setRow(pd);
0768:                return true;
0769:            }
0770:
0771:            /**
0772:             * this operation is not supported
0773:             */
0774:            public void moveToCurrentRow() throws SQLException {
0775:                throw new SQLException("operation not supported");
0776:            }
0777:
0778:            /**
0779:             * this operation is not supported
0780:             */
0781:            public void moveToInsertRow() throws SQLException {
0782:                throw new SQLException("operation not supported");
0783:            }
0784:
0785:            public boolean next() throws SQLException {
0786:                sanityCheck();
0787:                if (isBeforeFirst()) {
0788:                    return first();
0789:                } else {
0790:                    PositionData pd = getPosition();
0791:                    pd.rowpos++;
0792:                    if (pd.rowpos >= size) {
0793:                        return false;
0794:                    } else {
0795:                        setRow(pd);
0796:                        return true;
0797:                    }
0798:                }
0799:            }
0800:
0801:            public boolean previous() throws SQLException {
0802:                sanityCheck();
0803:                PositionData pd = getPosition();
0804:                pd.rowpos--;
0805:                if (pd.rowpos < 0) {
0806:                    return false;
0807:                } else {
0808:                    setRow(pd);
0809:                    return true;
0810:                }
0811:            }
0812:
0813:            /**
0814:             * this operation is not supported
0815:             */
0816:            public void refreshRow() throws SQLException {
0817:                throw new SQLException("operation not supported");
0818:            }
0819:
0820:            public boolean relative(int param) throws SQLException {
0821:                return false;
0822:            }
0823:
0824:            public boolean rowDeleted() throws SQLException {
0825:                return false;
0826:            }
0827:
0828:            public boolean rowInserted() throws SQLException {
0829:                return false;
0830:            }
0831:
0832:            public boolean rowUpdated() throws SQLException {
0833:                return false;
0834:            }
0835:
0836:            /**
0837:             * this operation is not supported
0838:             */
0839:            public void setFetchDirection(int param) throws SQLException {
0840:                throw new SQLException("operation not supported");
0841:            }
0842:
0843:            /**
0844:             * this operation is not supported
0845:             */
0846:            public void setFetchSize(int param) throws SQLException {
0847:                throw new SQLException("operation not supported");
0848:            }
0849:
0850:            /**   
0851:             * this operation is not supported   
0852:             */
0853:            public void updateArray(String str, Array array)
0854:                    throws SQLException {
0855:                throw new SQLException("operation not supported");
0856:            }
0857:
0858:            /**   
0859:             * this operation is not supported   
0860:             */
0861:            public void updateArray(int param, Array array) throws SQLException {
0862:                throw new SQLException("operation not supported");
0863:            }
0864:
0865:            /**   
0866:             * this operation is not supported   
0867:             */
0868:            public void updateAsciiStream(String str, InputStream inputStream,
0869:                    int param) throws SQLException {
0870:                throw new SQLException("operation not supported");
0871:            }
0872:
0873:            /**   
0874:             * this operation is not supported   
0875:             */
0876:            public void updateAsciiStream(int param, InputStream inputStream,
0877:                    int param2) throws SQLException {
0878:                throw new SQLException("operation not supported");
0879:            }
0880:
0881:            /**   
0882:             * this operation is not supported   
0883:             */
0884:            public void updateBigDecimal(String str, BigDecimal bigDecimal)
0885:                    throws SQLException {
0886:                throw new SQLException("operation not supported");
0887:            }
0888:
0889:            /**   
0890:             * this operation is not supported   
0891:             */
0892:            public void updateBigDecimal(int param, BigDecimal bigDecimal)
0893:                    throws SQLException {
0894:                throw new SQLException("operation not supported");
0895:            }
0896:
0897:            /**   
0898:             * this operation is not supported   
0899:             */
0900:            public void updateBinaryStream(int param, InputStream inputStream,
0901:                    int param2) throws SQLException {
0902:                throw new SQLException("operation not supported");
0903:            }
0904:
0905:            /**   
0906:             * this operation is not supported   
0907:             */
0908:            public void updateBinaryStream(String str, InputStream inputStream,
0909:                    int param) throws SQLException {
0910:                throw new SQLException("operation not supported");
0911:            }
0912:
0913:            /**   
0914:             * this operation is not supported   
0915:             */
0916:            public void updateBlob(int param, java.sql.Blob blob)
0917:                    throws SQLException {
0918:                throw new SQLException("operation not supported");
0919:            }
0920:
0921:            /**   
0922:             * this operation is not supported   
0923:             */
0924:            public void updateBlob(String str, java.sql.Blob blob)
0925:                    throws SQLException {
0926:                throw new SQLException("operation not supported");
0927:            }
0928:
0929:            /**   
0930:             * this operation is not supported   
0931:             */
0932:            public void updateBoolean(int param, boolean param1)
0933:                    throws SQLException {
0934:                throw new SQLException("operation not supported");
0935:            }
0936:
0937:            /**   
0938:             * this operation is not supported   
0939:             */
0940:            public void updateBoolean(String str, boolean param)
0941:                    throws SQLException {
0942:                throw new SQLException("operation not supported");
0943:            }
0944:
0945:            /**   
0946:             * this operation is not supported   
0947:             */
0948:            public void updateByte(int param, byte param1) throws SQLException {
0949:                throw new SQLException("operation not supported");
0950:            }
0951:
0952:            /**   
0953:             * this operation is not supported   
0954:             */
0955:            public void updateByte(String str, byte param) throws SQLException {
0956:                throw new SQLException("operation not supported");
0957:            }
0958:
0959:            /**   
0960:             * this operation is not supported   
0961:             */
0962:            public void updateBytes(int param, byte[] values)
0963:                    throws SQLException {
0964:                throw new SQLException("operation not supported");
0965:            }
0966:
0967:            /**   
0968:             * this operation is not supported   
0969:             */
0970:            public void updateBytes(String str, byte[] values)
0971:                    throws SQLException {
0972:                throw new SQLException("operation not supported");
0973:            }
0974:
0975:            /**   
0976:             * this operation is not supported   
0977:             */
0978:            public void updateCharacterStream(int param, java.io.Reader reader,
0979:                    int param2) throws SQLException {
0980:                throw new SQLException("operation not supported");
0981:            }
0982:
0983:            /**   
0984:             * this operation is not supported   
0985:             */
0986:            public void updateCharacterStream(String str,
0987:                    java.io.Reader reader, int param) throws SQLException {
0988:                throw new SQLException("operation not supported");
0989:            }
0990:
0991:            /**   
0992:             * this operation is not supported   
0993:             */
0994:            public void updateClob(String str, java.sql.Clob clob)
0995:                    throws SQLException {
0996:                throw new SQLException("operation not supported");
0997:            }
0998:
0999:            /**   
1000:             * this operation is not supported   
1001:             */
1002:            public void updateClob(int param, java.sql.Clob clob)
1003:                    throws SQLException {
1004:                throw new SQLException("operation not supported");
1005:            }
1006:
1007:            /**   
1008:             * this operation is not supported   
1009:             */
1010:            public void updateDate(int param, Date date) throws SQLException {
1011:                throw new SQLException("operation not supported");
1012:            }
1013:
1014:            /**   
1015:             * this operation is not supported   
1016:             */
1017:            public void updateDate(String str, Date date) throws SQLException {
1018:                throw new SQLException("operation not supported");
1019:            }
1020:
1021:            /**   
1022:             * this operation is not supported   
1023:             */
1024:            public void updateDouble(int param, double param1)
1025:                    throws SQLException {
1026:                throw new SQLException("operation not supported");
1027:            }
1028:
1029:            /**   
1030:             * this operation is not supported   
1031:             */
1032:            public void updateDouble(String str, double param)
1033:                    throws SQLException {
1034:                throw new SQLException("operation not supported");
1035:            }
1036:
1037:            /**   
1038:             * this operation is not supported   
1039:             */
1040:            public void updateFloat(String str, float param)
1041:                    throws SQLException {
1042:                throw new SQLException("operation not supported");
1043:            }
1044:
1045:            /**   
1046:             * this operation is not supported   
1047:             */
1048:            public void updateFloat(int param, float param1)
1049:                    throws SQLException {
1050:                throw new SQLException("operation not supported");
1051:            }
1052:
1053:            /**   
1054:             * this operation is not supported   
1055:             */
1056:            public void updateInt(String str, int param) throws SQLException {
1057:                throw new SQLException("operation not supported");
1058:            }
1059:
1060:            /**   
1061:             * this operation is not supported   
1062:             */
1063:            public void updateInt(int param, int param1) throws SQLException {
1064:                throw new SQLException("operation not supported");
1065:            }
1066:
1067:            /**   
1068:             * this operation is not supported   
1069:             */
1070:            public void updateLong(int param, long param1) throws SQLException {
1071:                throw new SQLException("operation not supported");
1072:            }
1073:
1074:            /**   
1075:             * this operation is not supported   
1076:             */
1077:            public void updateLong(String str, long param) throws SQLException {
1078:                throw new SQLException("operation not supported");
1079:            }
1080:
1081:            /**   
1082:             * this operation is not supported   
1083:             */
1084:            public void updateNull(String str) throws SQLException {
1085:                throw new SQLException("operation not supported");
1086:            }
1087:
1088:            /**   
1089:             * this operation is not supported   
1090:             */
1091:            public void updateNull(int param) throws SQLException {
1092:                throw new SQLException("operation not supported");
1093:            }
1094:
1095:            /**   
1096:             * this operation is not supported   
1097:             */
1098:            public void updateObject(String str, Object obj)
1099:                    throws SQLException {
1100:                throw new SQLException("operation not supported");
1101:            }
1102:
1103:            /**   
1104:             * this operation is not supported   
1105:             */
1106:            public void updateObject(int param, Object obj) throws SQLException {
1107:                throw new SQLException("operation not supported");
1108:            }
1109:
1110:            /**   
1111:             * this operation is not supported   */
1112:            public void updateObject(int param, Object obj, int param2)
1113:                    throws SQLException {
1114:                throw new SQLException("operation not supported");
1115:            }
1116:
1117:            /**   
1118:             * this operation is not supported   
1119:             */
1120:            public void updateObject(String str, Object obj, int param)
1121:                    throws SQLException {
1122:                throw new SQLException("operation not supported");
1123:            }
1124:
1125:            /**   
1126:             * this operation is not supported   
1127:             */
1128:            public void updateRef(int param, java.sql.Ref ref)
1129:                    throws SQLException {
1130:                throw new SQLException("operation not supported");
1131:            }
1132:
1133:            /**   
1134:             * this operation is not supported   
1135:             */
1136:            public void updateRef(String str, java.sql.Ref ref)
1137:                    throws SQLException {
1138:                throw new SQLException("operation not supported");
1139:            }
1140:
1141:            /**   
1142:             * this operation is not supported   
1143:             */
1144:            public void updateRow() throws SQLException {
1145:                throw new SQLException("operation not supported");
1146:            }
1147:
1148:            /**   
1149:             * this operation is not supported   
1150:             */
1151:            public void updateShort(int param, short param1)
1152:                    throws SQLException {
1153:                throw new SQLException("operation not supported");
1154:            }
1155:
1156:            /**   
1157:             * this operation is not supported   
1158:             */
1159:            public void updateShort(String str, short param)
1160:                    throws SQLException {
1161:                throw new SQLException("operation not supported");
1162:            }
1163:
1164:            /**   
1165:             * this operation is not supported   
1166:             */
1167:            public void updateString(int param, String str) throws SQLException {
1168:                throw new SQLException("operation not supported");
1169:            }
1170:
1171:            /**   
1172:             * this operation is not supported   
1173:             */
1174:            public void updateString(String str, String str1)
1175:                    throws SQLException {
1176:                throw new SQLException("operation not supported");
1177:            }
1178:
1179:            /**   
1180:             * this operation is not supported   
1181:             */
1182:            public void updateTime(String str, Time time) throws SQLException {
1183:                throw new SQLException("operation not supported");
1184:            }
1185:
1186:            /**   
1187:             * this operation is not supported   
1188:             */
1189:            public void updateTime(int param, Time time) throws SQLException {
1190:                throw new SQLException("operation not supported");
1191:            }
1192:
1193:            /**   
1194:             * this operation is not supported   
1195:             */
1196:            public void updateTimestamp(String str, Timestamp timestamp)
1197:                    throws SQLException {
1198:                throw new SQLException("operation not supported");
1199:            }
1200:
1201:            /**   
1202:             * this operation is not supported   
1203:             */
1204:            public void updateTimestamp(int param, Timestamp timestamp)
1205:                    throws SQLException {
1206:                throw new SQLException("operation not supported");
1207:            }
1208:
1209:            public boolean wasNull() throws SQLException {
1210:                sanityCheck();
1211:                PositionData pd = getPosition();
1212:                return pd.lastColumnWasNull;
1213:            }
1214:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.