Source Code Cross Referenced for StatementWrapper.java in  » Database-JDBC-Connection-Pool » mysql-connector-java-5.1.3 » com » mysql » jdbc » jdbc2 » optional » 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 JDBC Connection Pool » mysql connector java 5.1.3 » com.mysql.jdbc.jdbc2.optional 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         Copyright (C) 2002-2007 MySQL AB
003:
004:         This program is free software; you can redistribute it and/or modify
005:         it under the terms of version 2 of the GNU General Public License as 
006:         published by the Free Software Foundation.
007:
008:         There are special exceptions to the terms and conditions of the GPL 
009:         as it is applied to this software. View the full text of the 
010:         exception in file EXCEPTIONS-CONNECTOR-J in the directory of this 
011:         software distribution.
012:
013:         This program is distributed in the hope that it will be useful,
014:         but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016:         GNU General Public License for more details.
017:
018:         You should have received a copy of the GNU General Public License
019:         along with this program; if not, write to the Free Software
020:         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
021:
022:
023:
024:         */
025:        package com.mysql.jdbc.jdbc2.optional;
026:
027:        import com.mysql.jdbc.SQLError;
028:
029:        import java.sql.Connection;
030:        import java.sql.ResultSet;
031:        import java.sql.SQLException;
032:        import java.sql.SQLWarning;
033:        import java.sql.Statement;
034:
035:        /**
036:         * Wraps statements so that errors can be reported correctly to
037:         * ConnectionEventListeners.
038:         * 
039:         * @author Mark Matthews
040:         * 
041:         * @version $Id: StatementWrapper.java,v 1.1.2.1 2005/05/13 18:58:38 mmatthews
042:         *          Exp $
043:         */
044:        public class StatementWrapper extends WrapperBase implements  Statement {
045:            protected Statement wrappedStmt;
046:
047:            protected ConnectionWrapper wrappedConn;
048:
049:            protected StatementWrapper(ConnectionWrapper c,
050:                    MysqlPooledConnection conn, Statement toWrap) {
051:                this .pooledConnection = conn;
052:                this .wrappedStmt = toWrap;
053:                this .wrappedConn = c;
054:            }
055:
056:            /*
057:             * (non-Javadoc)
058:             * 
059:             * @see java.sql.Statement#getConnection()
060:             */
061:            public Connection getConnection() throws SQLException {
062:                try {
063:                    if (this .wrappedStmt != null) {
064:                        return this .wrappedConn;
065:                    }
066:
067:                    throw SQLError.createSQLException(
068:                            "Statement already closed",
069:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
070:                } catch (SQLException sqlEx) {
071:                    checkAndFireConnectionError(sqlEx);
072:                }
073:
074:                return null; // we actually never get here, but the compiler can't
075:                // figure
076:
077:                // that out
078:            }
079:
080:            /*
081:             * (non-Javadoc)
082:             * 
083:             * @see java.sql.Statement#setCursorName(java.lang.String)
084:             */
085:            public void setCursorName(String name) throws SQLException {
086:                try {
087:                    if (this .wrappedStmt != null) {
088:                        this .wrappedStmt.setCursorName(name);
089:                    } else {
090:                        throw SQLError.createSQLException(
091:                                "Statement already closed",
092:                                SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
093:                    }
094:                } catch (SQLException sqlEx) {
095:                    checkAndFireConnectionError(sqlEx);
096:                }
097:            }
098:
099:            /*
100:             * (non-Javadoc)
101:             * 
102:             * @see java.sql.Statement#setEscapeProcessing(boolean)
103:             */
104:            public void setEscapeProcessing(boolean enable) throws SQLException {
105:                try {
106:                    if (this .wrappedStmt != null) {
107:                        this .wrappedStmt.setEscapeProcessing(enable);
108:                    } else {
109:                        throw SQLError.createSQLException(
110:                                "Statement already closed",
111:                                SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
112:                    }
113:                } catch (SQLException sqlEx) {
114:                    checkAndFireConnectionError(sqlEx);
115:                }
116:            }
117:
118:            /*
119:             * (non-Javadoc)
120:             * 
121:             * @see java.sql.Statement#setFetchDirection(int)
122:             */
123:            public void setFetchDirection(int direction) throws SQLException {
124:                try {
125:                    if (this .wrappedStmt != null) {
126:                        this .wrappedStmt.setFetchDirection(direction);
127:                    } else {
128:                        throw SQLError.createSQLException(
129:                                "Statement already closed",
130:                                SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
131:                    }
132:                } catch (SQLException sqlEx) {
133:                    checkAndFireConnectionError(sqlEx);
134:                }
135:            }
136:
137:            /*
138:             * (non-Javadoc)
139:             * 
140:             * @see java.sql.Statement#getFetchDirection()
141:             */
142:            public int getFetchDirection() throws SQLException {
143:                try {
144:                    if (this .wrappedStmt != null) {
145:                        return this .wrappedStmt.getFetchDirection();
146:                    }
147:
148:                    throw SQLError.createSQLException(
149:                            "Statement already closed",
150:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
151:                } catch (SQLException sqlEx) {
152:                    checkAndFireConnectionError(sqlEx);
153:                }
154:
155:                return ResultSet.FETCH_FORWARD; // we actually never get here, but the
156:                // compiler can't figure
157:
158:                // that out
159:            }
160:
161:            /*
162:             * (non-Javadoc)
163:             * 
164:             * @see java.sql.Statement#setFetchSize(int)
165:             */
166:            public void setFetchSize(int rows) throws SQLException {
167:                try {
168:                    if (this .wrappedStmt != null) {
169:                        this .wrappedStmt.setFetchSize(rows);
170:                    } else {
171:                        throw SQLError.createSQLException(
172:                                "Statement already closed",
173:                                SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
174:                    }
175:                } catch (SQLException sqlEx) {
176:                    checkAndFireConnectionError(sqlEx);
177:                }
178:            }
179:
180:            /*
181:             * (non-Javadoc)
182:             * 
183:             * @see java.sql.Statement#getFetchSize()
184:             */
185:            public int getFetchSize() throws SQLException {
186:                try {
187:                    if (this .wrappedStmt != null) {
188:                        return this .wrappedStmt.getFetchSize();
189:                    }
190:
191:                    throw SQLError.createSQLException(
192:                            "Statement already closed",
193:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
194:                } catch (SQLException sqlEx) {
195:                    checkAndFireConnectionError(sqlEx);
196:                }
197:
198:                return 0; // we actually never get here, but the compiler can't figure
199:
200:                // that out
201:            }
202:
203:            /*
204:             * (non-Javadoc)
205:             * 
206:             * @see java.sql.Statement#getGeneratedKeys()
207:             */
208:            public ResultSet getGeneratedKeys() throws SQLException {
209:                try {
210:                    if (this .wrappedStmt != null) {
211:                        return this .wrappedStmt.getGeneratedKeys();
212:                    }
213:
214:                    throw SQLError.createSQLException(
215:                            "Statement already closed",
216:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
217:                } catch (SQLException sqlEx) {
218:                    checkAndFireConnectionError(sqlEx);
219:                }
220:
221:                return null; // we actually never get here, but the compiler can't
222:                // figure
223:
224:                // that out
225:            }
226:
227:            /*
228:             * (non-Javadoc)
229:             * 
230:             * @see java.sql.Statement#setMaxFieldSize(int)
231:             */
232:            public void setMaxFieldSize(int max) throws SQLException {
233:                try {
234:                    if (this .wrappedStmt != null) {
235:                        this .wrappedStmt.setMaxFieldSize(max);
236:                    } else {
237:                        throw SQLError.createSQLException(
238:                                "Statement already closed",
239:                                SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
240:                    }
241:                } catch (SQLException sqlEx) {
242:                    checkAndFireConnectionError(sqlEx);
243:                }
244:            }
245:
246:            /*
247:             * (non-Javadoc)
248:             * 
249:             * @see java.sql.Statement#getMaxFieldSize()
250:             */
251:            public int getMaxFieldSize() throws SQLException {
252:                try {
253:                    if (this .wrappedStmt != null) {
254:                        return this .wrappedStmt.getMaxFieldSize();
255:                    }
256:
257:                    throw SQLError.createSQLException(
258:                            "Statement already closed",
259:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
260:                } catch (SQLException sqlEx) {
261:                    checkAndFireConnectionError(sqlEx);
262:                }
263:
264:                return 0; // we actually never get here, but the compiler can't figure
265:
266:                // that out
267:            }
268:
269:            /*
270:             * (non-Javadoc)
271:             * 
272:             * @see java.sql.Statement#setMaxRows(int)
273:             */
274:            public void setMaxRows(int max) throws SQLException {
275:                try {
276:                    if (this .wrappedStmt != null) {
277:                        this .wrappedStmt.setMaxRows(max);
278:                    } else {
279:                        throw SQLError.createSQLException(
280:                                "Statement already closed",
281:                                SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
282:                    }
283:                } catch (SQLException sqlEx) {
284:                    checkAndFireConnectionError(sqlEx);
285:                }
286:            }
287:
288:            /*
289:             * (non-Javadoc)
290:             * 
291:             * @see java.sql.Statement#getMaxRows()
292:             */
293:            public int getMaxRows() throws SQLException {
294:                try {
295:                    if (this .wrappedStmt != null) {
296:                        return this .wrappedStmt.getMaxRows();
297:                    }
298:
299:                    throw SQLError.createSQLException(
300:                            "Statement already closed",
301:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
302:                } catch (SQLException sqlEx) {
303:                    checkAndFireConnectionError(sqlEx);
304:                }
305:
306:                return 0; // we actually never get here, but the compiler can't figure
307:
308:                // that out
309:            }
310:
311:            /*
312:             * (non-Javadoc)
313:             * 
314:             * @see java.sql.Statement#getMoreResults()
315:             */
316:            public boolean getMoreResults() throws SQLException {
317:                try {
318:                    if (this .wrappedStmt != null) {
319:                        return this .wrappedStmt.getMoreResults();
320:                    }
321:
322:                    throw SQLError.createSQLException(
323:                            "Statement already closed",
324:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
325:                } catch (SQLException sqlEx) {
326:                    checkAndFireConnectionError(sqlEx);
327:                }
328:
329:                return false;
330:            }
331:
332:            /*
333:             * (non-Javadoc)
334:             * 
335:             * @see java.sql.Statement#getMoreResults(int)
336:             */
337:            public boolean getMoreResults(int current) throws SQLException {
338:                try {
339:                    if (this .wrappedStmt != null) {
340:                        return this .wrappedStmt.getMoreResults(current);
341:                    }
342:
343:                    throw SQLError.createSQLException(
344:                            "Statement already closed",
345:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
346:                } catch (SQLException sqlEx) {
347:                    checkAndFireConnectionError(sqlEx);
348:                }
349:
350:                return false;
351:            }
352:
353:            /*
354:             * (non-Javadoc)
355:             * 
356:             * @see java.sql.Statement#setQueryTimeout(int)
357:             */
358:            public void setQueryTimeout(int seconds) throws SQLException {
359:                try {
360:                    if (this .wrappedStmt != null) {
361:                        this .wrappedStmt.setQueryTimeout(seconds);
362:                    } else {
363:                        throw SQLError.createSQLException(
364:                                "Statement already closed",
365:                                SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
366:                    }
367:                } catch (SQLException sqlEx) {
368:                    checkAndFireConnectionError(sqlEx);
369:                }
370:            }
371:
372:            /*
373:             * (non-Javadoc)
374:             * 
375:             * @see java.sql.Statement#getQueryTimeout()
376:             */
377:            public int getQueryTimeout() throws SQLException {
378:                try {
379:                    if (this .wrappedStmt != null) {
380:                        return this .wrappedStmt.getQueryTimeout();
381:                    }
382:
383:                    throw SQLError.createSQLException(
384:                            "Statement already closed",
385:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
386:                } catch (SQLException sqlEx) {
387:                    checkAndFireConnectionError(sqlEx);
388:                }
389:
390:                return 0;
391:            }
392:
393:            /*
394:             * (non-Javadoc)
395:             * 
396:             * @see java.sql.Statement#getResultSet()
397:             */
398:            public ResultSet getResultSet() throws SQLException {
399:                try {
400:                    if (this .wrappedStmt != null) {
401:                        ResultSet rs = this .wrappedStmt.getResultSet();
402:
403:                        ((com.mysql.jdbc.ResultSetInternalMethods) rs)
404:                                .setWrapperStatement(this );
405:
406:                        return rs;
407:                    }
408:
409:                    throw SQLError.createSQLException(
410:                            "Statement already closed",
411:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
412:                } catch (SQLException sqlEx) {
413:                    checkAndFireConnectionError(sqlEx);
414:                }
415:
416:                return null;
417:            }
418:
419:            /*
420:             * (non-Javadoc)
421:             * 
422:             * @see java.sql.Statement#getResultSetConcurrency()
423:             */
424:            public int getResultSetConcurrency() throws SQLException {
425:                try {
426:                    if (this .wrappedStmt != null) {
427:                        return this .wrappedStmt.getResultSetConcurrency();
428:                    }
429:
430:                    throw SQLError.createSQLException(
431:                            "Statement already closed",
432:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
433:                } catch (SQLException sqlEx) {
434:                    checkAndFireConnectionError(sqlEx);
435:                }
436:
437:                return 0;
438:            }
439:
440:            /*
441:             * (non-Javadoc)
442:             * 
443:             * @see java.sql.Statement#getResultSetHoldability()
444:             */
445:            public int getResultSetHoldability() throws SQLException {
446:                try {
447:                    if (this .wrappedStmt != null) {
448:                        return this .wrappedStmt.getResultSetHoldability();
449:                    }
450:
451:                    throw SQLError.createSQLException(
452:                            "Statement already closed",
453:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
454:                } catch (SQLException sqlEx) {
455:                    checkAndFireConnectionError(sqlEx);
456:                }
457:
458:                return Statement.CLOSE_CURRENT_RESULT;
459:            }
460:
461:            /*
462:             * (non-Javadoc)
463:             * 
464:             * @see java.sql.Statement#getResultSetType()
465:             */
466:            public int getResultSetType() throws SQLException {
467:                try {
468:                    if (this .wrappedStmt != null) {
469:                        return this .wrappedStmt.getResultSetType();
470:                    }
471:
472:                    throw SQLError.createSQLException(
473:                            "Statement already closed",
474:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
475:                } catch (SQLException sqlEx) {
476:                    checkAndFireConnectionError(sqlEx);
477:                }
478:
479:                return ResultSet.TYPE_FORWARD_ONLY;
480:            }
481:
482:            /*
483:             * (non-Javadoc)
484:             * 
485:             * @see java.sql.Statement#getUpdateCount()
486:             */
487:            public int getUpdateCount() throws SQLException {
488:                try {
489:                    if (this .wrappedStmt != null) {
490:                        return this .wrappedStmt.getUpdateCount();
491:                    }
492:
493:                    throw SQLError.createSQLException(
494:                            "Statement already closed",
495:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
496:                } catch (SQLException sqlEx) {
497:                    checkAndFireConnectionError(sqlEx);
498:                }
499:
500:                return -1;
501:            }
502:
503:            /*
504:             * (non-Javadoc)
505:             * 
506:             * @see java.sql.Statement#getWarnings()
507:             */
508:            public SQLWarning getWarnings() throws SQLException {
509:                try {
510:                    if (this .wrappedStmt != null) {
511:                        return this .wrappedStmt.getWarnings();
512:                    }
513:
514:                    throw SQLError.createSQLException(
515:                            "Statement already closed",
516:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
517:                } catch (SQLException sqlEx) {
518:                    checkAndFireConnectionError(sqlEx);
519:                }
520:
521:                return null;
522:            }
523:
524:            /*
525:             * (non-Javadoc)
526:             * 
527:             * @see java.sql.Statement#addBatch(java.lang.String)
528:             */
529:            public void addBatch(String sql) throws SQLException {
530:                try {
531:                    if (this .wrappedStmt != null) {
532:                        this .wrappedStmt.addBatch(sql);
533:                    }
534:                } catch (SQLException sqlEx) {
535:                    checkAndFireConnectionError(sqlEx);
536:                }
537:            }
538:
539:            /*
540:             * (non-Javadoc)
541:             * 
542:             * @see java.sql.Statement#cancel()
543:             */
544:            public void cancel() throws SQLException {
545:                try {
546:                    if (this .wrappedStmt != null) {
547:                        this .wrappedStmt.cancel();
548:                    }
549:                } catch (SQLException sqlEx) {
550:                    checkAndFireConnectionError(sqlEx);
551:                }
552:            }
553:
554:            /*
555:             * (non-Javadoc)
556:             * 
557:             * @see java.sql.Statement#clearBatch()
558:             */
559:            public void clearBatch() throws SQLException {
560:                try {
561:                    if (this .wrappedStmt != null) {
562:                        this .wrappedStmt.clearBatch();
563:                    }
564:                } catch (SQLException sqlEx) {
565:                    checkAndFireConnectionError(sqlEx);
566:                }
567:            }
568:
569:            /*
570:             * (non-Javadoc)
571:             * 
572:             * @see java.sql.Statement#clearWarnings()
573:             */
574:            public void clearWarnings() throws SQLException {
575:                try {
576:                    if (this .wrappedStmt != null) {
577:                        this .wrappedStmt.clearWarnings();
578:                    }
579:                } catch (SQLException sqlEx) {
580:                    checkAndFireConnectionError(sqlEx);
581:                }
582:            }
583:
584:            /*
585:             * (non-Javadoc)
586:             * 
587:             * @see java.sql.Statement#close()
588:             */
589:            public void close() throws SQLException {
590:                try {
591:                    if (this .wrappedStmt != null) {
592:                        this .wrappedStmt.close();
593:                    }
594:                } catch (SQLException sqlEx) {
595:                    checkAndFireConnectionError(sqlEx);
596:                } finally {
597:                    this .wrappedStmt = null;
598:                    this .pooledConnection = null;
599:                }
600:            }
601:
602:            /*
603:             * (non-Javadoc)
604:             * 
605:             * @see java.sql.Statement#execute(java.lang.String, int)
606:             */
607:            public boolean execute(String sql, int autoGeneratedKeys)
608:                    throws SQLException {
609:                try {
610:                    if (this .wrappedStmt != null) {
611:                        return this .wrappedStmt.execute(sql, autoGeneratedKeys);
612:                    }
613:
614:                    throw SQLError.createSQLException(
615:                            "Statement already closed",
616:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
617:                } catch (SQLException sqlEx) {
618:                    checkAndFireConnectionError(sqlEx);
619:                }
620:
621:                return false; // we actually never get here, but the compiler can't
622:                // figure
623:
624:                // that out
625:            }
626:
627:            /*
628:             * (non-Javadoc)
629:             * 
630:             * @see java.sql.Statement#execute(java.lang.String, int[])
631:             */
632:            public boolean execute(String sql, int[] columnIndexes)
633:                    throws SQLException {
634:                try {
635:                    if (this .wrappedStmt != null) {
636:                        return this .wrappedStmt.execute(sql, columnIndexes);
637:                    }
638:
639:                    throw SQLError.createSQLException(
640:                            "Statement already closed",
641:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
642:                } catch (SQLException sqlEx) {
643:                    checkAndFireConnectionError(sqlEx);
644:                }
645:
646:                return false; // we actually never get here, but the compiler can't
647:                // figure
648:
649:                // that out
650:            }
651:
652:            /*
653:             * (non-Javadoc)
654:             * 
655:             * @see java.sql.Statement#execute(java.lang.String, java.lang.String[])
656:             */
657:            public boolean execute(String sql, String[] columnNames)
658:                    throws SQLException {
659:                try {
660:                    if (this .wrappedStmt != null) {
661:                        return this .wrappedStmt.execute(sql, columnNames);
662:                    }
663:
664:                    throw SQLError.createSQLException(
665:                            "Statement already closed",
666:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
667:                } catch (SQLException sqlEx) {
668:                    checkAndFireConnectionError(sqlEx);
669:                }
670:
671:                return false; // we actually never get here, but the compiler can't
672:                // figure
673:
674:                // that out
675:            }
676:
677:            /*
678:             * (non-Javadoc)
679:             * 
680:             * @see java.sql.Statement#execute(java.lang.String)
681:             */
682:            public boolean execute(String sql) throws SQLException {
683:                try {
684:                    if (this .wrappedStmt != null) {
685:                        return this .wrappedStmt.execute(sql);
686:                    }
687:
688:                    throw SQLError.createSQLException(
689:                            "Statement already closed",
690:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
691:                } catch (SQLException sqlEx) {
692:                    checkAndFireConnectionError(sqlEx);
693:                }
694:
695:                return false; // we actually never get here, but the compiler can't
696:                // figure
697:
698:                // that out
699:            }
700:
701:            /*
702:             * (non-Javadoc)
703:             * 
704:             * @see java.sql.Statement#executeBatch()
705:             */
706:            public int[] executeBatch() throws SQLException {
707:                try {
708:                    if (this .wrappedStmt != null) {
709:                        return this .wrappedStmt.executeBatch();
710:                    }
711:
712:                    throw SQLError.createSQLException(
713:                            "Statement already closed",
714:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
715:                } catch (SQLException sqlEx) {
716:                    checkAndFireConnectionError(sqlEx);
717:                }
718:
719:                return null; // we actually never get here, but the compiler can't
720:                // figure
721:
722:                // that out
723:            }
724:
725:            /*
726:             * (non-Javadoc)
727:             * 
728:             * @see java.sql.Statement#executeQuery(java.lang.String)
729:             */
730:            public ResultSet executeQuery(String sql) throws SQLException {
731:                try {
732:                    if (this .wrappedStmt != null) {
733:
734:                        ResultSet rs = this .wrappedStmt.executeQuery(sql);
735:                        ((com.mysql.jdbc.ResultSetInternalMethods) rs)
736:                                .setWrapperStatement(this );
737:
738:                        return rs;
739:                    }
740:
741:                    throw SQLError.createSQLException(
742:                            "Statement already closed",
743:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
744:                } catch (SQLException sqlEx) {
745:                    checkAndFireConnectionError(sqlEx);
746:                }
747:
748:                return null; // we actually never get here, but the compiler can't
749:                // figure
750:
751:                // that out
752:            }
753:
754:            /*
755:             * (non-Javadoc)
756:             * 
757:             * @see java.sql.Statement#executeUpdate(java.lang.String, int)
758:             */
759:            public int executeUpdate(String sql, int autoGeneratedKeys)
760:                    throws SQLException {
761:                try {
762:                    if (this .wrappedStmt != null) {
763:                        return this .wrappedStmt.executeUpdate(sql,
764:                                autoGeneratedKeys);
765:                    }
766:
767:                    throw SQLError.createSQLException(
768:                            "Statement already closed",
769:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
770:                } catch (SQLException sqlEx) {
771:                    checkAndFireConnectionError(sqlEx);
772:                }
773:
774:                return -1; // we actually never get here, but the compiler can't figure
775:
776:                // that out
777:            }
778:
779:            /*
780:             * (non-Javadoc)
781:             * 
782:             * @see java.sql.Statement#executeUpdate(java.lang.String, int[])
783:             */
784:            public int executeUpdate(String sql, int[] columnIndexes)
785:                    throws SQLException {
786:                try {
787:                    if (this .wrappedStmt != null) {
788:                        return this .wrappedStmt.executeUpdate(sql,
789:                                columnIndexes);
790:                    }
791:
792:                    throw SQLError.createSQLException(
793:                            "Statement already closed",
794:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
795:                } catch (SQLException sqlEx) {
796:                    checkAndFireConnectionError(sqlEx);
797:                }
798:
799:                return -1; // we actually never get here, but the compiler can't figure
800:
801:                // that out
802:            }
803:
804:            /*
805:             * (non-Javadoc)
806:             * 
807:             * @see java.sql.Statement#executeUpdate(java.lang.String,
808:             *      java.lang.String[])
809:             */
810:            public int executeUpdate(String sql, String[] columnNames)
811:                    throws SQLException {
812:                try {
813:                    if (this .wrappedStmt != null) {
814:                        return this .wrappedStmt.executeUpdate(sql, columnNames);
815:                    }
816:
817:                    throw SQLError.createSQLException(
818:                            "Statement already closed",
819:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
820:                } catch (SQLException sqlEx) {
821:                    checkAndFireConnectionError(sqlEx);
822:                }
823:
824:                return -1; // we actually never get here, but the compiler can't figure
825:
826:                // that out
827:            }
828:
829:            /*
830:             * (non-Javadoc)
831:             * 
832:             * @see java.sql.Statement#executeUpdate(java.lang.String)
833:             */
834:            public int executeUpdate(String sql) throws SQLException {
835:                try {
836:                    if (this .wrappedStmt != null) {
837:                        return this .wrappedStmt.executeUpdate(sql);
838:                    }
839:
840:                    throw SQLError.createSQLException(
841:                            "Statement already closed",
842:                            SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
843:                } catch (SQLException sqlEx) {
844:                    checkAndFireConnectionError(sqlEx);
845:                }
846:
847:                return -1; // we actually never get here, but the compiler can't figure
848:
849:                // that out
850:            }
851:
852:            public void enableStreamingResults() throws SQLException {
853:                try {
854:                    if (this .wrappedStmt != null) {
855:                        ((com.mysql.jdbc.Statement) this .wrappedStmt)
856:                                .enableStreamingResults();
857:                    } else {
858:                        throw SQLError.createSQLException(
859:                                "No operations allowed after statement closed",
860:                                SQLError.SQL_STATE_GENERAL_ERROR);
861:                    }
862:                } catch (SQLException sqlEx) {
863:                    checkAndFireConnectionError(sqlEx);
864:                }
865:            }
866:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.