Source Code Cross Referenced for AbstractResultSet.java in  » EJB-Server-resin-3.1.5 » resin » com » caucho » db » 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 » EJB Server resin 3.1.5 » resin » com.caucho.db.jdbc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003:         *
004:         * This file is part of Resin(R) Open Source
005:         *
006:         * Each copy or derived work must preserve the copyright notice and this
007:         * notice unmodified.
008:         *
009:         * Resin Open Source is free software; you can redistribute it and/or modify
010:         * it under the terms of the GNU General Public License as published by
011:         * the Free Software Foundation; either version 2 of the License, or
012:         * (at your option) any later version.
013:         *
014:         * Resin Open Source is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017:         * of NON-INFRINGEMENT.  See the GNU General Public License for more
018:         * details.
019:         *
020:         * You should have received a copy of the GNU General Public License
021:         * along with Resin Open Source; if not, write to the
022:         *
023:         *   Free Software Foundation, Inc.
024:         *   59 Temple Place, Suite 330
025:         *   Boston, MA 02111-1307  USA
026:         *
027:         * @author Scott Ferguson
028:         */
029:        package com.caucho.db.jdbc;
030:
031:        import com.caucho.sql.SQLExceptionWrapper;
032:        import com.caucho.util.L10N;
033:
034:        import java.io.IOException;
035:        import java.io.InputStream;
036:        import java.io.Reader;
037:        import java.math.BigDecimal;
038:        import java.sql.*;
039:        import java.util.Calendar;
040:        import java.util.Map;
041:
042:        /**
043:         * The JDBC statement implementation.
044:         */
045:        abstract public class AbstractResultSet implements  java.sql.ResultSet {
046:            protected final static L10N L = new L10N(AbstractResultSet.class);
047:            private int _rowNumber;
048:
049:            public boolean absolute(int row) throws SQLException {
050:                if (row < getRow())
051:                    return false;
052:
053:                while (getRow() < row) {
054:                    if (!next())
055:                        return false;
056:                }
057:
058:                return true;
059:            }
060:
061:            public void afterLast() {
062:            }
063:
064:            public void beforeFirst() {
065:            }
066:
067:            public void cancelRowUpdates() {
068:            }
069:
070:            public void clearWarnings() {
071:            }
072:
073:            public void deleteRow() {
074:            }
075:
076:            public int getRow() throws SQLException {
077:                if (_rowNumber < 0)
078:                    throw new SQLException("can't call getRow() after close()");
079:
080:                return _rowNumber;
081:            }
082:
083:            public boolean isBeforeFirst() throws SQLException {
084:                return getRow() == 0;
085:            }
086:
087:            public boolean isAfterLast() {
088:                return false;
089:            }
090:
091:            public boolean isFirst() throws SQLException {
092:                return _rowNumber == 1;
093:            }
094:
095:            public boolean first() throws SQLException {
096:                return isFirst();
097:            }
098:
099:            public boolean isLast() throws SQLException {
100:                return false;
101:            }
102:
103:            public boolean last() throws SQLException {
104:                return isLast();
105:            }
106:
107:            public int getConcurrency() {
108:                return 0;
109:            }
110:
111:            public String getCursorName() {
112:                return null;
113:            }
114:
115:            abstract public java.sql.Statement getStatement()
116:                    throws SQLException;
117:
118:            abstract public java.sql.ResultSetMetaData getMetaData()
119:                    throws SQLException;
120:
121:            abstract public boolean next() throws SQLException;
122:
123:            abstract public boolean wasNull() throws SQLException;
124:
125:            abstract public int findColumn(String columnName)
126:                    throws SQLException;
127:
128:            public int getType() {
129:                return 0;
130:            }
131:
132:            public BigDecimal getBigDecimal(int columnIndex)
133:                    throws SQLException {
134:                return null;
135:            }
136:
137:            public BigDecimal getBigDecimal(int columnIndex, int scale)
138:                    throws SQLException {
139:                return getBigDecimal(columnIndex).setScale(scale);
140:            }
141:
142:            public BigDecimal getBigDecimal(String columnName)
143:                    throws SQLException {
144:                return getBigDecimal(findColumn(columnName));
145:            }
146:
147:            public BigDecimal getBigDecimal(String columnName, int scale)
148:                    throws SQLException {
149:                return getBigDecimal(findColumn(columnName), scale);
150:            }
151:
152:            /**
153:             * Returns the boolean value for the column.
154:             */
155:            public boolean getBoolean(int columnIndex) throws SQLException {
156:                String v = getString(columnIndex);
157:
158:                return (v != null && !v.equals("") && !v.equals("0") && !v
159:                        .equals("n"));
160:            }
161:
162:            /**
163:             * Returns the boolean value for the named column.
164:             */
165:            public boolean getBoolean(String columnName) throws SQLException {
166:                return getBoolean(findColumn(columnName));
167:            }
168:
169:            public byte getByte(int columnIndex) throws SQLException {
170:                return (byte) getInt(columnIndex);
171:            }
172:
173:            public byte getByte(String columnName) throws SQLException {
174:                return getByte(findColumn(columnName));
175:            }
176:
177:            /**
178:             * Returns the byte value for the column.
179:             */
180:            public byte[] getBytes(int columnIndex) throws SQLException {
181:                try {
182:                    Blob blob = getBlob(columnIndex);
183:
184:                    if (blob == null)
185:                        return null;
186:
187:                    int length = (int) blob.length();
188:
189:                    byte[] bytes = new byte[length];
190:
191:                    InputStream is = blob.getBinaryStream();
192:
193:                    try {
194:                        int offset = 0;
195:                        int sublen;
196:
197:                        while (length > 0
198:                                && (sublen = is.read(bytes, offset, length)) > 0) {
199:                            offset += sublen;
200:                            length -= sublen;
201:                        }
202:                    } finally {
203:                        is.close();
204:                    }
205:
206:                    return bytes;
207:                } catch (IOException e) {
208:                    throw new SQLExceptionWrapper(e);
209:                }
210:            }
211:
212:            public byte[] getBytes(String columnName) throws SQLException {
213:                return getBytes(findColumn(columnName));
214:            }
215:
216:            public Reader getCharacterStream(int columnIndex)
217:                    throws SQLException {
218:                throw new UnsupportedOperationException();
219:            }
220:
221:            public Reader getCharacterStream(String columnName)
222:                    throws SQLException {
223:                return getCharacterStream(findColumn(columnName));
224:            }
225:
226:            public java.sql.Date getDate(int columnIndex) throws SQLException {
227:                throw new UnsupportedOperationException();
228:            }
229:
230:            public java.sql.Date getDate(String columnName) throws SQLException {
231:                return getDate(findColumn(columnName));
232:            }
233:
234:            public java.sql.Date getDate(int columnIndex, Calendar cal)
235:                    throws SQLException {
236:                return getDate(columnIndex);
237:            }
238:
239:            public java.sql.Date getDate(String columnName, Calendar cal)
240:                    throws SQLException {
241:                return getDate(findColumn(columnName), cal);
242:            }
243:
244:            /**
245:             * Returns the double value for the column.
246:             */
247:            public double getDouble(int columnIndex) throws SQLException {
248:                String v = getString(columnIndex);
249:
250:                if (v == null)
251:                    return 0;
252:                else
253:                    return Double.parseDouble(v);
254:            }
255:
256:            /**
257:             * Returns the double value for the named column.
258:             */
259:            public double getDouble(String columnName) throws SQLException {
260:                return getDouble(findColumn(columnName));
261:            }
262:
263:            public int getFetchDirection() {
264:                return 0;
265:            }
266:
267:            public int getFetchSize() {
268:                return 0;
269:            }
270:
271:            /**
272:             * Returns the float value for the column.
273:             */
274:            public float getFloat(int columnIndex) throws SQLException {
275:                return (float) getDouble(columnIndex);
276:            }
277:
278:            /**
279:             * Returns the float value for the named column.
280:             */
281:            public float getFloat(String columnName) throws SQLException {
282:                return (float) getDouble(findColumn(columnName));
283:            }
284:
285:            /**
286:             * Returns the integer value for the column.
287:             */
288:            public int getInt(int columnIndex) throws SQLException {
289:                String v = getString(columnIndex);
290:
291:                if (v == null)
292:                    return 0;
293:                else
294:                    return Integer.parseInt(v);
295:            }
296:
297:            /**
298:             * Returns the integer value for the named column.
299:             */
300:            public int getInt(String columnName) throws SQLException {
301:                return getInt(findColumn(columnName));
302:            }
303:
304:            /**
305:             * Returns the long value for the column.
306:             */
307:            public long getLong(int columnIndex) throws SQLException {
308:                String v = getString(columnIndex);
309:
310:                if (v == null)
311:                    return 0;
312:                else
313:                    return Long.parseLong(v);
314:            }
315:
316:            /**
317:             * Returns the long value for the named column.
318:             */
319:            public long getLong(String columnName) throws SQLException {
320:                return getLong(findColumn(columnName));
321:            }
322:
323:            public Object getObject(int columnIndex) throws SQLException {
324:                return getString(columnIndex);
325:            }
326:
327:            public Object getObject(String columnName) throws SQLException {
328:                return getObject(findColumn(columnName));
329:            }
330:
331:            public Object getObject(int columnIndex, Map<String, Class<?>> map)
332:                    throws SQLException {
333:                return getObject(columnIndex);
334:            }
335:
336:            public Object getObject(String columnName, Map<String, Class<?>> map)
337:                    throws SQLException {
338:                return getObject(findColumn(columnName), map);
339:            }
340:
341:            public short getShort(int columnIndex) throws SQLException {
342:                return (short) getInt(columnIndex);
343:            }
344:
345:            public short getShort(String columnName) throws SQLException {
346:                return getShort(findColumn(columnName));
347:            }
348:
349:            abstract public String getString(int columnIndex)
350:                    throws SQLException;
351:
352:            public String getString(String columnName) throws SQLException {
353:                return getString(findColumn(columnName));
354:            }
355:
356:            public Time getTime(int columnIndex) throws SQLException {
357:                throw new UnsupportedOperationException();
358:            }
359:
360:            public Time getTime(String columnName) throws SQLException {
361:                return getTime(findColumn(columnName));
362:            }
363:
364:            public Time getTime(int columnIndex, Calendar calendar)
365:                    throws SQLException {
366:                return getTime(columnIndex);
367:            }
368:
369:            public Time getTime(String columnName, Calendar calendar)
370:                    throws SQLException {
371:                return getTime(findColumn(columnName), calendar);
372:            }
373:
374:            public Timestamp getTimestamp(int columnIndex) throws SQLException {
375:                throw new UnsupportedOperationException();
376:            }
377:
378:            public Timestamp getTimestamp(String columnName)
379:                    throws SQLException {
380:                return getTimestamp(findColumn(columnName));
381:            }
382:
383:            public Timestamp getTimestamp(int columnIndex, Calendar calendar)
384:                    throws SQLException {
385:                return getTimestamp(columnIndex);
386:            }
387:
388:            public Timestamp getTimestamp(String columnName, Calendar calendar)
389:                    throws SQLException {
390:                return getTimestamp(findColumn(columnName), calendar);
391:            }
392:
393:            public InputStream getBinaryStream(int columnIndex)
394:                    throws SQLException {
395:                Blob blob = getBlob(columnIndex);
396:
397:                if (blob != null)
398:                    return blob.getBinaryStream();
399:                else
400:                    return null;
401:            }
402:
403:            public InputStream getBinaryStream(String columnName)
404:                    throws SQLException {
405:                return getBinaryStream(findColumn(columnName));
406:            }
407:
408:            public InputStream getAsciiStream(int columnIndex)
409:                    throws SQLException {
410:                return getBinaryStream(columnIndex);
411:            }
412:
413:            public InputStream getAsciiStream(String columnName)
414:                    throws SQLException {
415:                return getAsciiStream(findColumn(columnName));
416:            }
417:
418:            public InputStream getUnicodeStream(int columnIndex)
419:                    throws SQLException {
420:                throw new UnsupportedOperationException();
421:            }
422:
423:            public InputStream getUnicodeStream(String columnName)
424:                    throws SQLException {
425:                return getUnicodeStream(findColumn(columnName));
426:            }
427:
428:            public Array getArray(int columnIndex) throws SQLException {
429:                throw new UnsupportedOperationException();
430:            }
431:
432:            public Array getArray(String columnName) throws SQLException {
433:                return getArray(findColumn(columnName));
434:            }
435:
436:            public Blob getBlob(int columnIndex) throws SQLException {
437:                throw new UnsupportedOperationException();
438:            }
439:
440:            public Blob getBlob(String columnName) throws SQLException {
441:                return getBlob(findColumn(columnName));
442:            }
443:
444:            public Clob getClob(int columnIndex) throws SQLException {
445:                throw new UnsupportedOperationException();
446:            }
447:
448:            public Clob getClob(String columnName) throws SQLException {
449:                return getClob(findColumn(columnName));
450:            }
451:
452:            public Ref getRef(int columnIndex) throws SQLException {
453:                throw new UnsupportedOperationException();
454:            }
455:
456:            public Ref getRef(String columnName) throws SQLException {
457:                return getRef(findColumn(columnName));
458:            }
459:
460:            public SQLWarning getWarnings() {
461:                return null;
462:            }
463:
464:            public void insertRow() {
465:            }
466:
467:            public void moveToCurrentRow() {
468:            }
469:
470:            public void moveToInsertRow() {
471:            }
472:
473:            public boolean previous() {
474:                return false;
475:            }
476:
477:            public void refreshRow() {
478:            }
479:
480:            public boolean relative(int rows) {
481:                return false;
482:            }
483:
484:            public boolean rowDeleted() {
485:                return false;
486:            }
487:
488:            public boolean rowInserted() {
489:                return false;
490:            }
491:
492:            public boolean rowUpdated() {
493:                return false;
494:            }
495:
496:            public void setFetchDirection(int direction) {
497:            }
498:
499:            public void setFetchSize(int rows) {
500:            }
501:
502:            public void updateRow() {
503:            }
504:
505:            public void updateObject(int columnIndex, Object o) {
506:            }
507:
508:            public void updateObject(String columnName, Object o)
509:                    throws SQLException {
510:                updateObject(findColumn(columnName), o);
511:            }
512:
513:            public void updateObject(int columnIndex, Object o, int scale) {
514:            }
515:
516:            public void updateObject(String columnName, Object o, int scale)
517:                    throws SQLException {
518:                updateObject(findColumn(columnName), o, scale);
519:            }
520:
521:            public void updateNull(int columnIndex) {
522:            }
523:
524:            public void updateNull(String columnName) throws SQLException {
525:                updateNull(findColumn(columnName));
526:            }
527:
528:            public void updateAsciiStream(int columnIndex, InputStream x,
529:                    int length) {
530:            }
531:
532:            public void updateAsciiStream(String columnName, InputStream x,
533:                    int length) throws SQLException {
534:                updateAsciiStream(findColumn(columnName), x, length);
535:            }
536:
537:            public void updateBigDecimal(int columnIndex, BigDecimal x) {
538:            }
539:
540:            public void updateBigDecimal(String columnName, BigDecimal x)
541:                    throws SQLException {
542:                updateBigDecimal(findColumn(columnName), x);
543:            }
544:
545:            public void updateBinaryStream(int columnIndex, InputStream x,
546:                    int length) {
547:            }
548:
549:            public void updateBinaryStream(String columnName, InputStream x,
550:                    int length) throws SQLException {
551:                updateBinaryStream(findColumn(columnName), x, length);
552:            }
553:
554:            public void updateBoolean(int columnIndex, boolean x) {
555:            }
556:
557:            public void updateBoolean(String columnName, boolean x)
558:                    throws SQLException {
559:                updateBoolean(findColumn(columnName), x);
560:            }
561:
562:            public void updateByte(int columnIndex, byte x) {
563:            }
564:
565:            public void updateByte(String columnName, byte x)
566:                    throws SQLException {
567:                updateByte(findColumn(columnName), x);
568:            }
569:
570:            public void updateShort(int columnIndex, short x) {
571:            }
572:
573:            public void updateShort(String columnName, short x)
574:                    throws SQLException {
575:                updateShort(findColumn(columnName), x);
576:            }
577:
578:            public void updateInt(int columnIndex, int x) {
579:            }
580:
581:            public void updateInt(String columnName, int x) throws SQLException {
582:                updateInt(findColumn(columnName), x);
583:            }
584:
585:            public void updateLong(int columnIndex, long x) {
586:            }
587:
588:            public void updateLong(String columnName, long x)
589:                    throws SQLException {
590:                updateLong(findColumn(columnName), x);
591:            }
592:
593:            public void updateFloat(int columnIndex, float x) {
594:            }
595:
596:            public void updateFloat(String columnName, float x)
597:                    throws SQLException {
598:                updateFloat(findColumn(columnName), x);
599:            }
600:
601:            public void updateDouble(int columnIndex, double x) {
602:            }
603:
604:            public void updateDouble(String columnName, double x)
605:                    throws SQLException {
606:                updateDouble(findColumn(columnName), x);
607:            }
608:
609:            public void updateString(int columnIndex, String x) {
610:            }
611:
612:            public void updateString(String columnName, String x)
613:                    throws SQLException {
614:                updateString(findColumn(columnName), x);
615:            }
616:
617:            public void updateBytes(int columnIndex, byte[] x) {
618:            }
619:
620:            public void updateBytes(String columnName, byte[] x)
621:                    throws SQLException {
622:                updateBytes(findColumn(columnName), x);
623:            }
624:
625:            public void updateCharacterStream(int columnIndex, Reader x,
626:                    int length) {
627:            }
628:
629:            public void updateCharacterStream(String columnName, Reader x,
630:                    int length) throws SQLException {
631:                updateCharacterStream(findColumn(columnName), x, length);
632:            }
633:
634:            public void updateTime(int columnIndex, Time time)
635:                    throws SQLException {
636:            }
637:
638:            public void updateTime(String columnName, Time time)
639:                    throws SQLException {
640:                updateTime(findColumn(columnName), time);
641:            }
642:
643:            public void updateDate(int columnIndex, java.sql.Date date)
644:                    throws SQLException {
645:            }
646:
647:            public void updateDate(String columnName, java.sql.Date date)
648:                    throws SQLException {
649:                updateDate(findColumn(columnName), date);
650:            }
651:
652:            public void updateTimestamp(int columnIndex, Timestamp time)
653:                    throws SQLException {
654:            }
655:
656:            public void updateTimestamp(String columnName, Timestamp time)
657:                    throws SQLException {
658:                updateTimestamp(findColumn(columnName), time);
659:            }
660:
661:            public void updateArray(int columnIndex, Array value)
662:                    throws SQLException {
663:                throw new UnsupportedOperationException();
664:            }
665:
666:            public void updateArray(String columnName, Array value)
667:                    throws SQLException {
668:                updateArray(findColumn(columnName), value);
669:            }
670:
671:            public void updateBlob(int columnIndex, Blob value)
672:                    throws SQLException {
673:                throw new UnsupportedOperationException();
674:            }
675:
676:            public void updateBlob(String columnName, Blob value)
677:                    throws SQLException {
678:                updateBlob(findColumn(columnName), value);
679:            }
680:
681:            public void updateClob(int columnIndex, Clob value)
682:                    throws SQLException {
683:                throw new UnsupportedOperationException();
684:            }
685:
686:            public void updateClob(String columnName, Clob value)
687:                    throws SQLException {
688:                updateClob(findColumn(columnName), value);
689:            }
690:
691:            public void updateRef(int columnIndex, Ref value)
692:                    throws SQLException {
693:                throw new UnsupportedOperationException();
694:            }
695:
696:            public void updateRef(String columnName, Ref value)
697:                    throws SQLException {
698:                updateRef(findColumn(columnName), value);
699:            }
700:
701:            public java.net.URL getURL(int column) throws SQLException {
702:                throw new UnsupportedOperationException();
703:            }
704:
705:            public java.net.URL getURL(String column) throws SQLException {
706:                return getURL(findColumn(column));
707:            }
708:
709:            public void close() throws SQLException {
710:            }
711:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.