~ubuntu-branches/ubuntu/trusty/mysql-connector-java/trusty

« back to all changes in this revision

Viewing changes to .pc/0002-java6-compilation-compat.patch/src/com/mysql/jdbc/jdbc2/optional/StatementWrapper.java

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg, Miguel Landaeta
  • Date: 2013-07-02 17:07:51 UTC
  • mfrom: (1.1.8) (3.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20130702170751-f4rszjabxg0391fr
Tags: 5.1.25-1
* New upstream release
* Refreshed the patches
* Added a patch to build with one JDK and removed the build
  dependency on java-gcj-compat-dev
* Updated Standards-Version to 3.9.4 (no changes)
* Use canonical URLs for the Vcs-* fields
* debian/rules: Improved the clean target to allow rebuilds
* Updated the watch file
* Renamed debian/README.Debian-source to README.source

[ Miguel Landaeta ] 
* Fix FTBFS with OpenJDK 7 (Closes: #706668)
* Remove Michael Koch from Uploaders list.
  Thanks for your work on this package. (Closes: #654122).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
 
3
 
 
4
 
 
5
  The MySQL Connector/J is licensed under the terms of the GPLv2
 
6
  <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most MySQL Connectors.
 
7
  There are special exceptions to the terms and conditions of the GPLv2 as it is applied to
 
8
  this software, see the FLOSS License Exception
 
9
  <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
 
10
 
 
11
  This program is free software; you can redistribute it and/or modify it under the terms
 
12
  of the GNU General Public License as published by the Free Software Foundation; version 2
 
13
  of the License.
 
14
 
 
15
  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 
16
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
17
  See the GNU General Public License for more details.
 
18
 
 
19
  You should have received a copy of the GNU General Public License along with this
 
20
  program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
 
21
  Floor, Boston, MA 02110-1301  USA
 
22
 
 
23
 
 
24
 
 
25
 */
 
26
package com.mysql.jdbc.jdbc2.optional;
 
27
 
 
28
import java.lang.reflect.Constructor;
 
29
import java.sql.Connection;
 
30
import java.sql.ResultSet;
 
31
import java.sql.SQLException;
 
32
import java.sql.SQLWarning;
 
33
import java.sql.Statement;
 
34
 
 
35
import com.mysql.jdbc.SQLError;
 
36
import com.mysql.jdbc.Util;
 
37
 
 
38
/**
 
39
 * Wraps statements so that errors can be reported correctly to
 
40
 * ConnectionEventListeners.
 
41
 * 
 
42
 * @author Mark Matthews
 
43
 * 
 
44
 * @version $Id: StatementWrapper.java,v 1.1.2.1 2005/05/13 18:58:38 mmatthews
 
45
 *          Exp $
 
46
 */
 
47
public class StatementWrapper extends WrapperBase implements Statement {
 
48
        private static final Constructor<?> JDBC_4_STATEMENT_WRAPPER_CTOR;
 
49
        
 
50
        static {
 
51
                if (Util.isJdbc4()) {
 
52
                        try {
 
53
                                JDBC_4_STATEMENT_WRAPPER_CTOR = Class.forName(
 
54
                                                "com.mysql.jdbc.jdbc2.optional.JDBC4StatementWrapper").getConstructor(
 
55
                                                new Class[] { ConnectionWrapper.class, 
 
56
                                                                MysqlPooledConnection.class, 
 
57
                                                                Statement.class });
 
58
                        } catch (SecurityException e) {
 
59
                                throw new RuntimeException(e);
 
60
                        } catch (NoSuchMethodException e) {
 
61
                                throw new RuntimeException(e);
 
62
                        } catch (ClassNotFoundException e) {
 
63
                                throw new RuntimeException(e);
 
64
                        }
 
65
                } else {
 
66
                        JDBC_4_STATEMENT_WRAPPER_CTOR = null;
 
67
                }
 
68
        }
 
69
        
 
70
        protected static StatementWrapper getInstance(ConnectionWrapper c, 
 
71
                        MysqlPooledConnection conn,
 
72
                        Statement toWrap) throws SQLException {
 
73
                if (!Util.isJdbc4()) {
 
74
                        return new StatementWrapper(c, 
 
75
                                        conn, toWrap);
 
76
                }
 
77
 
 
78
                return (StatementWrapper) Util.handleNewInstance(
 
79
                                JDBC_4_STATEMENT_WRAPPER_CTOR,
 
80
                                new Object[] {c, 
 
81
                                                conn, toWrap }, conn.getExceptionInterceptor());
 
82
        }
 
83
        
 
84
        protected Statement wrappedStmt;
 
85
 
 
86
        protected ConnectionWrapper wrappedConn;
 
87
 
 
88
        public StatementWrapper(ConnectionWrapper c, MysqlPooledConnection conn,
 
89
                        Statement toWrap) {
 
90
                super(conn);
 
91
                this.wrappedStmt = toWrap;
 
92
                this.wrappedConn = c;
 
93
        }
 
94
 
 
95
        /*
 
96
         * (non-Javadoc)
 
97
         * 
 
98
         * @see java.sql.Statement#getConnection()
 
99
         */
 
100
        public Connection getConnection() throws SQLException {
 
101
                try {
 
102
                        if (this.wrappedStmt != null) {
 
103
                                return this.wrappedConn;
 
104
                        }
 
105
 
 
106
                        throw SQLError.createSQLException("Statement already closed",
 
107
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
108
                } catch (SQLException sqlEx) {
 
109
                        checkAndFireConnectionError(sqlEx);
 
110
                }
 
111
 
 
112
                return null; // we actually never get here, but the compiler can't
 
113
                                                // figure
 
114
 
 
115
                // that out
 
116
        }
 
117
 
 
118
        /*
 
119
         * (non-Javadoc)
 
120
         * 
 
121
         * @see java.sql.Statement#setCursorName(java.lang.String)
 
122
         */
 
123
        public void setCursorName(String name) throws SQLException {
 
124
                try {
 
125
                        if (this.wrappedStmt != null) {
 
126
                                this.wrappedStmt.setCursorName(name);
 
127
                        } else {
 
128
                                throw SQLError.createSQLException("Statement already closed",
 
129
                                                SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
130
                        }
 
131
                } catch (SQLException sqlEx) {
 
132
                        checkAndFireConnectionError(sqlEx);
 
133
                }
 
134
        }
 
135
 
 
136
        /*
 
137
         * (non-Javadoc)
 
138
         * 
 
139
         * @see java.sql.Statement#setEscapeProcessing(boolean)
 
140
         */
 
141
        public void setEscapeProcessing(boolean enable) throws SQLException {
 
142
                try {
 
143
                        if (this.wrappedStmt != null) {
 
144
                                this.wrappedStmt.setEscapeProcessing(enable);
 
145
                        } else {
 
146
                                throw SQLError.createSQLException("Statement already closed",
 
147
                                                SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
148
                        }
 
149
                } catch (SQLException sqlEx) {
 
150
                        checkAndFireConnectionError(sqlEx);
 
151
                }
 
152
        }
 
153
 
 
154
        /*
 
155
         * (non-Javadoc)
 
156
         * 
 
157
         * @see java.sql.Statement#setFetchDirection(int)
 
158
         */
 
159
        public void setFetchDirection(int direction) throws SQLException {
 
160
                try {
 
161
                        if (this.wrappedStmt != null) {
 
162
                                this.wrappedStmt.setFetchDirection(direction);
 
163
                        } else {
 
164
                                throw SQLError.createSQLException("Statement already closed",
 
165
                                                SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
166
                        }
 
167
                } catch (SQLException sqlEx) {
 
168
                        checkAndFireConnectionError(sqlEx);
 
169
                }
 
170
        }
 
171
 
 
172
        /*
 
173
         * (non-Javadoc)
 
174
         * 
 
175
         * @see java.sql.Statement#getFetchDirection()
 
176
         */
 
177
        public int getFetchDirection() throws SQLException {
 
178
                try {
 
179
                        if (this.wrappedStmt != null) {
 
180
                                return this.wrappedStmt.getFetchDirection();
 
181
                        }
 
182
 
 
183
                        throw SQLError.createSQLException("Statement already closed",
 
184
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
185
                } catch (SQLException sqlEx) {
 
186
                        checkAndFireConnectionError(sqlEx);
 
187
                }
 
188
 
 
189
                return ResultSet.FETCH_FORWARD; // we actually never get here, but the
 
190
                                                                                // compiler can't figure
 
191
 
 
192
                // that out
 
193
        }
 
194
 
 
195
        /*
 
196
         * (non-Javadoc)
 
197
         * 
 
198
         * @see java.sql.Statement#setFetchSize(int)
 
199
         */
 
200
        public void setFetchSize(int rows) throws SQLException {
 
201
                try {
 
202
                        if (this.wrappedStmt != null) {
 
203
                                this.wrappedStmt.setFetchSize(rows);
 
204
                        } else {
 
205
                                throw SQLError.createSQLException("Statement already closed",
 
206
                                                SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
207
                        }
 
208
                } catch (SQLException sqlEx) {
 
209
                        checkAndFireConnectionError(sqlEx);
 
210
                }
 
211
        }
 
212
 
 
213
        /*
 
214
         * (non-Javadoc)
 
215
         * 
 
216
         * @see java.sql.Statement#getFetchSize()
 
217
         */
 
218
        public int getFetchSize() throws SQLException {
 
219
                try {
 
220
                        if (this.wrappedStmt != null) {
 
221
                                return this.wrappedStmt.getFetchSize();
 
222
                        }
 
223
 
 
224
                        throw SQLError.createSQLException("Statement already closed",
 
225
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
226
                } catch (SQLException sqlEx) {
 
227
                        checkAndFireConnectionError(sqlEx);
 
228
                }
 
229
 
 
230
                return 0; // we actually never get here, but the compiler can't figure
 
231
 
 
232
                // that out
 
233
        }
 
234
 
 
235
        /*
 
236
         * (non-Javadoc)
 
237
         * 
 
238
         * @see java.sql.Statement#getGeneratedKeys()
 
239
         */
 
240
        public ResultSet getGeneratedKeys() throws SQLException {
 
241
                try {
 
242
                        if (this.wrappedStmt != null) {
 
243
                                return this.wrappedStmt.getGeneratedKeys();
 
244
                        }
 
245
 
 
246
                        throw SQLError.createSQLException("Statement already closed",
 
247
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
248
                } catch (SQLException sqlEx) {
 
249
                        checkAndFireConnectionError(sqlEx);
 
250
                }
 
251
 
 
252
                return null; // we actually never get here, but the compiler can't
 
253
                                                // figure
 
254
 
 
255
                // that out
 
256
        }
 
257
 
 
258
        /*
 
259
         * (non-Javadoc)
 
260
         * 
 
261
         * @see java.sql.Statement#setMaxFieldSize(int)
 
262
         */
 
263
        public void setMaxFieldSize(int max) throws SQLException {
 
264
                try {
 
265
                        if (this.wrappedStmt != null) {
 
266
                                this.wrappedStmt.setMaxFieldSize(max);
 
267
                        } else {
 
268
                                throw SQLError.createSQLException("Statement already closed",
 
269
                                                SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
270
                        }
 
271
                } catch (SQLException sqlEx) {
 
272
                        checkAndFireConnectionError(sqlEx);
 
273
                }
 
274
        }
 
275
 
 
276
        /*
 
277
         * (non-Javadoc)
 
278
         * 
 
279
         * @see java.sql.Statement#getMaxFieldSize()
 
280
         */
 
281
        public int getMaxFieldSize() throws SQLException {
 
282
                try {
 
283
                        if (this.wrappedStmt != null) {
 
284
                                return this.wrappedStmt.getMaxFieldSize();
 
285
                        }
 
286
 
 
287
                        throw SQLError.createSQLException("Statement already closed",
 
288
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
289
                } catch (SQLException sqlEx) {
 
290
                        checkAndFireConnectionError(sqlEx);
 
291
                }
 
292
 
 
293
                return 0; // we actually never get here, but the compiler can't figure
 
294
 
 
295
                // that out
 
296
        }
 
297
 
 
298
        /*
 
299
         * (non-Javadoc)
 
300
         * 
 
301
         * @see java.sql.Statement#setMaxRows(int)
 
302
         */
 
303
        public void setMaxRows(int max) throws SQLException {
 
304
                try {
 
305
                        if (this.wrappedStmt != null) {
 
306
                                this.wrappedStmt.setMaxRows(max);
 
307
                        } else {
 
308
                                throw SQLError.createSQLException("Statement already closed",
 
309
                                                SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
310
                        }
 
311
                } catch (SQLException sqlEx) {
 
312
                        checkAndFireConnectionError(sqlEx);
 
313
                }
 
314
        }
 
315
 
 
316
        /*
 
317
         * (non-Javadoc)
 
318
         * 
 
319
         * @see java.sql.Statement#getMaxRows()
 
320
         */
 
321
        public int getMaxRows() throws SQLException {
 
322
                try {
 
323
                        if (this.wrappedStmt != null) {
 
324
                                return this.wrappedStmt.getMaxRows();
 
325
                        }
 
326
 
 
327
                        throw SQLError.createSQLException("Statement already closed",
 
328
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
329
                } catch (SQLException sqlEx) {
 
330
                        checkAndFireConnectionError(sqlEx);
 
331
                }
 
332
 
 
333
                return 0; // we actually never get here, but the compiler can't figure
 
334
 
 
335
                // that out
 
336
        }
 
337
 
 
338
        /*
 
339
         * (non-Javadoc)
 
340
         * 
 
341
         * @see java.sql.Statement#getMoreResults()
 
342
         */
 
343
        public boolean getMoreResults() throws SQLException {
 
344
                try {
 
345
                        if (this.wrappedStmt != null) {
 
346
                                return this.wrappedStmt.getMoreResults();
 
347
                        }
 
348
 
 
349
                        throw SQLError.createSQLException("Statement already closed",
 
350
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
351
                } catch (SQLException sqlEx) {
 
352
                        checkAndFireConnectionError(sqlEx);
 
353
                }
 
354
 
 
355
                return false;
 
356
        }
 
357
 
 
358
        /*
 
359
         * (non-Javadoc)
 
360
         * 
 
361
         * @see java.sql.Statement#getMoreResults(int)
 
362
         */
 
363
        public boolean getMoreResults(int current) throws SQLException {
 
364
                try {
 
365
                        if (this.wrappedStmt != null) {
 
366
                                return this.wrappedStmt.getMoreResults(current);
 
367
                        }
 
368
 
 
369
                        throw SQLError.createSQLException("Statement already closed",
 
370
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
371
                } catch (SQLException sqlEx) {
 
372
                        checkAndFireConnectionError(sqlEx);
 
373
                }
 
374
 
 
375
                return false;
 
376
        }
 
377
 
 
378
        /*
 
379
         * (non-Javadoc)
 
380
         * 
 
381
         * @see java.sql.Statement#setQueryTimeout(int)
 
382
         */
 
383
        public void setQueryTimeout(int seconds) throws SQLException {
 
384
                try {
 
385
                        if (this.wrappedStmt != null) {
 
386
                                this.wrappedStmt.setQueryTimeout(seconds);
 
387
                        } else {
 
388
                                throw SQLError.createSQLException("Statement already closed",
 
389
                                                SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
390
                        }
 
391
                } catch (SQLException sqlEx) {
 
392
                        checkAndFireConnectionError(sqlEx);
 
393
                }
 
394
        }
 
395
 
 
396
        /*
 
397
         * (non-Javadoc)
 
398
         * 
 
399
         * @see java.sql.Statement#getQueryTimeout()
 
400
         */
 
401
        public int getQueryTimeout() throws SQLException {
 
402
                try {
 
403
                        if (this.wrappedStmt != null) {
 
404
                                return this.wrappedStmt.getQueryTimeout();
 
405
                        }
 
406
 
 
407
                        throw SQLError.createSQLException("Statement already closed",
 
408
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
409
                } catch (SQLException sqlEx) {
 
410
                        checkAndFireConnectionError(sqlEx);
 
411
                }
 
412
 
 
413
                return 0;
 
414
        }
 
415
 
 
416
        /*
 
417
         * (non-Javadoc)
 
418
         * 
 
419
         * @see java.sql.Statement#getResultSet()
 
420
         */
 
421
        public ResultSet getResultSet() throws SQLException {
 
422
                try {
 
423
                        if (this.wrappedStmt != null) {
 
424
                                ResultSet rs = this.wrappedStmt.getResultSet();
 
425
                                
 
426
                                if (rs != null) {
 
427
                                        ((com.mysql.jdbc.ResultSetInternalMethods) rs).setWrapperStatement(this);
 
428
                                }
 
429
                                return rs;
 
430
                        }
 
431
 
 
432
                        throw SQLError.createSQLException("Statement already closed",
 
433
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
434
                } catch (SQLException sqlEx) {
 
435
                        checkAndFireConnectionError(sqlEx);
 
436
                }
 
437
 
 
438
                return null;
 
439
        }
 
440
 
 
441
        /*
 
442
         * (non-Javadoc)
 
443
         * 
 
444
         * @see java.sql.Statement#getResultSetConcurrency()
 
445
         */
 
446
        public int getResultSetConcurrency() throws SQLException {
 
447
                try {
 
448
                        if (this.wrappedStmt != null) {
 
449
                                return this.wrappedStmt.getResultSetConcurrency();
 
450
                        }
 
451
 
 
452
                        throw SQLError.createSQLException("Statement already closed",
 
453
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
454
                } catch (SQLException sqlEx) {
 
455
                        checkAndFireConnectionError(sqlEx);
 
456
                }
 
457
 
 
458
                return 0;
 
459
        }
 
460
 
 
461
        /*
 
462
         * (non-Javadoc)
 
463
         * 
 
464
         * @see java.sql.Statement#getResultSetHoldability()
 
465
         */
 
466
        public int getResultSetHoldability() throws SQLException {
 
467
                try {
 
468
                        if (this.wrappedStmt != null) {
 
469
                                return this.wrappedStmt.getResultSetHoldability();
 
470
                        }
 
471
 
 
472
                        throw SQLError.createSQLException("Statement already closed",
 
473
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
474
                } catch (SQLException sqlEx) {
 
475
                        checkAndFireConnectionError(sqlEx);
 
476
                }
 
477
 
 
478
                return Statement.CLOSE_CURRENT_RESULT;
 
479
        }
 
480
 
 
481
        /*
 
482
         * (non-Javadoc)
 
483
         * 
 
484
         * @see java.sql.Statement#getResultSetType()
 
485
         */
 
486
        public int getResultSetType() throws SQLException {
 
487
                try {
 
488
                        if (this.wrappedStmt != null) {
 
489
                                return this.wrappedStmt.getResultSetType();
 
490
                        }
 
491
 
 
492
                        throw SQLError.createSQLException("Statement already closed",
 
493
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
494
                } catch (SQLException sqlEx) {
 
495
                        checkAndFireConnectionError(sqlEx);
 
496
                }
 
497
 
 
498
                return ResultSet.TYPE_FORWARD_ONLY;
 
499
        }
 
500
 
 
501
        /*
 
502
         * (non-Javadoc)
 
503
         * 
 
504
         * @see java.sql.Statement#getUpdateCount()
 
505
         */
 
506
        public int getUpdateCount() throws SQLException {
 
507
                try {
 
508
                        if (this.wrappedStmt != null) {
 
509
                                return this.wrappedStmt.getUpdateCount();
 
510
                        }
 
511
 
 
512
                        throw SQLError.createSQLException("Statement already closed",
 
513
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
514
                } catch (SQLException sqlEx) {
 
515
                        checkAndFireConnectionError(sqlEx);
 
516
                }
 
517
 
 
518
                return -1;
 
519
        }
 
520
 
 
521
        /*
 
522
         * (non-Javadoc)
 
523
         * 
 
524
         * @see java.sql.Statement#getWarnings()
 
525
         */
 
526
        public SQLWarning getWarnings() throws SQLException {
 
527
                try {
 
528
                        if (this.wrappedStmt != null) {
 
529
                                return this.wrappedStmt.getWarnings();
 
530
                        }
 
531
 
 
532
                        throw SQLError.createSQLException("Statement already closed",
 
533
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
534
                } catch (SQLException sqlEx) {
 
535
                        checkAndFireConnectionError(sqlEx);
 
536
                }
 
537
 
 
538
                return null;
 
539
        }
 
540
 
 
541
        /*
 
542
         * (non-Javadoc)
 
543
         * 
 
544
         * @see java.sql.Statement#addBatch(java.lang.String)
 
545
         */
 
546
        public void addBatch(String sql) throws SQLException {
 
547
                try {
 
548
                        if (this.wrappedStmt != null) {
 
549
                                this.wrappedStmt.addBatch(sql);
 
550
                        }
 
551
                } catch (SQLException sqlEx) {
 
552
                        checkAndFireConnectionError(sqlEx);
 
553
                }
 
554
        }
 
555
 
 
556
        /*
 
557
         * (non-Javadoc)
 
558
         * 
 
559
         * @see java.sql.Statement#cancel()
 
560
         */
 
561
        public void cancel() throws SQLException {
 
562
                try {
 
563
                        if (this.wrappedStmt != null) {
 
564
                                this.wrappedStmt.cancel();
 
565
                        }
 
566
                } catch (SQLException sqlEx) {
 
567
                        checkAndFireConnectionError(sqlEx);
 
568
                }
 
569
        }
 
570
 
 
571
        /*
 
572
         * (non-Javadoc)
 
573
         * 
 
574
         * @see java.sql.Statement#clearBatch()
 
575
         */
 
576
        public void clearBatch() throws SQLException {
 
577
                try {
 
578
                        if (this.wrappedStmt != null) {
 
579
                                this.wrappedStmt.clearBatch();
 
580
                        }
 
581
                } catch (SQLException sqlEx) {
 
582
                        checkAndFireConnectionError(sqlEx);
 
583
                }
 
584
        }
 
585
 
 
586
        /*
 
587
         * (non-Javadoc)
 
588
         * 
 
589
         * @see java.sql.Statement#clearWarnings()
 
590
         */
 
591
        public void clearWarnings() throws SQLException {
 
592
                try {
 
593
                        if (this.wrappedStmt != null) {
 
594
                                this.wrappedStmt.clearWarnings();
 
595
                        }
 
596
                } catch (SQLException sqlEx) {
 
597
                        checkAndFireConnectionError(sqlEx);
 
598
                }
 
599
        }
 
600
 
 
601
        /*
 
602
         * (non-Javadoc)
 
603
         * 
 
604
         * @see java.sql.Statement#close()
 
605
         */
 
606
        public void close() throws SQLException {
 
607
                try {
 
608
                        if (this.wrappedStmt != null) {
 
609
                                this.wrappedStmt.close();
 
610
                        }
 
611
                } catch (SQLException sqlEx) {
 
612
                        checkAndFireConnectionError(sqlEx);
 
613
                } finally {
 
614
                        this.wrappedStmt = null;
 
615
                        this.pooledConnection = null;
 
616
                }
 
617
        }
 
618
 
 
619
        /*
 
620
         * (non-Javadoc)
 
621
         * 
 
622
         * @see java.sql.Statement#execute(java.lang.String, int)
 
623
         */
 
624
        public boolean execute(String sql, int autoGeneratedKeys)
 
625
                        throws SQLException {
 
626
                try {
 
627
                        if (this.wrappedStmt != null) {
 
628
                                return this.wrappedStmt.execute(sql, autoGeneratedKeys);
 
629
                        }
 
630
 
 
631
                        throw SQLError.createSQLException("Statement already closed",
 
632
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
633
                } catch (SQLException sqlEx) {
 
634
                        checkAndFireConnectionError(sqlEx);
 
635
                }
 
636
 
 
637
                return false; // we actually never get here, but the compiler can't
 
638
                                                // figure
 
639
 
 
640
                // that out
 
641
        }
 
642
 
 
643
        /*
 
644
         * (non-Javadoc)
 
645
         * 
 
646
         * @see java.sql.Statement#execute(java.lang.String, int[])
 
647
         */
 
648
        public boolean execute(String sql, int[] columnIndexes) throws SQLException {
 
649
                try {
 
650
                        if (this.wrappedStmt != null) {
 
651
                                return this.wrappedStmt.execute(sql, columnIndexes);
 
652
                        }
 
653
 
 
654
                        throw SQLError.createSQLException("Statement already closed",
 
655
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
656
                } catch (SQLException sqlEx) {
 
657
                        checkAndFireConnectionError(sqlEx);
 
658
                }
 
659
 
 
660
                return false; // we actually never get here, but the compiler can't
 
661
                                                // figure
 
662
 
 
663
                // that out
 
664
        }
 
665
 
 
666
        /*
 
667
         * (non-Javadoc)
 
668
         * 
 
669
         * @see java.sql.Statement#execute(java.lang.String, java.lang.String[])
 
670
         */
 
671
        public boolean execute(String sql, String[] columnNames)
 
672
                        throws SQLException {
 
673
                try {
 
674
                        if (this.wrappedStmt != null) {
 
675
                                return this.wrappedStmt.execute(sql, columnNames);
 
676
                        }
 
677
 
 
678
                        throw SQLError.createSQLException("Statement already closed",
 
679
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
680
                } catch (SQLException sqlEx) {
 
681
                        checkAndFireConnectionError(sqlEx);
 
682
                }
 
683
 
 
684
                return false; // we actually never get here, but the compiler can't
 
685
                                                // figure
 
686
 
 
687
                // that out
 
688
        }
 
689
 
 
690
        /*
 
691
         * (non-Javadoc)
 
692
         * 
 
693
         * @see java.sql.Statement#execute(java.lang.String)
 
694
         */
 
695
        public boolean execute(String sql) throws SQLException {
 
696
                try {
 
697
                        if (this.wrappedStmt != null) {
 
698
                                return this.wrappedStmt.execute(sql);
 
699
                        }
 
700
 
 
701
                        throw SQLError.createSQLException("Statement already closed",
 
702
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
703
                } catch (SQLException sqlEx) {
 
704
                        checkAndFireConnectionError(sqlEx);
 
705
                }
 
706
 
 
707
                return false; // we actually never get here, but the compiler can't
 
708
                                                // figure
 
709
 
 
710
                // that out
 
711
        }
 
712
 
 
713
        /*
 
714
         * (non-Javadoc)
 
715
         * 
 
716
         * @see java.sql.Statement#executeBatch()
 
717
         */
 
718
        public int[] executeBatch() throws SQLException {
 
719
                try {
 
720
                        if (this.wrappedStmt != null) {
 
721
                                return this.wrappedStmt.executeBatch();
 
722
                        }
 
723
 
 
724
                        throw SQLError.createSQLException("Statement already closed",
 
725
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
726
                } catch (SQLException sqlEx) {
 
727
                        checkAndFireConnectionError(sqlEx);
 
728
                }
 
729
 
 
730
                return null; // we actually never get here, but the compiler can't
 
731
                                                // figure
 
732
 
 
733
                // that out
 
734
        }
 
735
 
 
736
        /*
 
737
         * (non-Javadoc)
 
738
         * 
 
739
         * @see java.sql.Statement#executeQuery(java.lang.String)
 
740
         */
 
741
        public ResultSet executeQuery(String sql) throws SQLException {
 
742
                try {
 
743
                        if (this.wrappedStmt != null) {
 
744
 
 
745
                                ResultSet rs = this.wrappedStmt.executeQuery(sql);
 
746
                                ((com.mysql.jdbc.ResultSetInternalMethods) rs).setWrapperStatement(this);
 
747
 
 
748
                                return rs;
 
749
                        }
 
750
 
 
751
                        throw SQLError.createSQLException("Statement already closed",
 
752
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
753
                } catch (SQLException sqlEx) {
 
754
                        checkAndFireConnectionError(sqlEx);
 
755
                }
 
756
 
 
757
                return null; // we actually never get here, but the compiler can't
 
758
                                                // figure
 
759
 
 
760
                // that out
 
761
        }
 
762
 
 
763
        /*
 
764
         * (non-Javadoc)
 
765
         * 
 
766
         * @see java.sql.Statement#executeUpdate(java.lang.String, int)
 
767
         */
 
768
        public int executeUpdate(String sql, int autoGeneratedKeys)
 
769
                        throws SQLException {
 
770
                try {
 
771
                        if (this.wrappedStmt != null) {
 
772
                                return this.wrappedStmt.executeUpdate(sql, autoGeneratedKeys);
 
773
                        }
 
774
 
 
775
                        throw SQLError.createSQLException("Statement already closed",
 
776
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
777
                } catch (SQLException sqlEx) {
 
778
                        checkAndFireConnectionError(sqlEx);
 
779
                }
 
780
 
 
781
                return -1; // we actually never get here, but the compiler can't figure
 
782
 
 
783
                // that out
 
784
        }
 
785
 
 
786
        /*
 
787
         * (non-Javadoc)
 
788
         * 
 
789
         * @see java.sql.Statement#executeUpdate(java.lang.String, int[])
 
790
         */
 
791
        public int executeUpdate(String sql, int[] columnIndexes)
 
792
                        throws SQLException {
 
793
                try {
 
794
                        if (this.wrappedStmt != null) {
 
795
                                return this.wrappedStmt.executeUpdate(sql, columnIndexes);
 
796
                        }
 
797
 
 
798
                        throw SQLError.createSQLException("Statement already closed",
 
799
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
800
                } catch (SQLException sqlEx) {
 
801
                        checkAndFireConnectionError(sqlEx);
 
802
                }
 
803
 
 
804
                return -1; // we actually never get here, but the compiler can't figure
 
805
 
 
806
                // that out
 
807
        }
 
808
 
 
809
        /*
 
810
         * (non-Javadoc)
 
811
         * 
 
812
         * @see java.sql.Statement#executeUpdate(java.lang.String,
 
813
         *      java.lang.String[])
 
814
         */
 
815
        public int executeUpdate(String sql, String[] columnNames)
 
816
                        throws SQLException {
 
817
                try {
 
818
                        if (this.wrappedStmt != null) {
 
819
                                return this.wrappedStmt.executeUpdate(sql, columnNames);
 
820
                        }
 
821
 
 
822
                        throw SQLError.createSQLException("Statement already closed",
 
823
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
824
                } catch (SQLException sqlEx) {
 
825
                        checkAndFireConnectionError(sqlEx);
 
826
                }
 
827
 
 
828
                return -1; // we actually never get here, but the compiler can't figure
 
829
 
 
830
                // that out
 
831
        }
 
832
 
 
833
        /*
 
834
         * (non-Javadoc)
 
835
         * 
 
836
         * @see java.sql.Statement#executeUpdate(java.lang.String)
 
837
         */
 
838
        public int executeUpdate(String sql) throws SQLException {
 
839
                try {
 
840
                        if (this.wrappedStmt != null) {
 
841
                                return this.wrappedStmt.executeUpdate(sql);
 
842
                        }
 
843
 
 
844
                        throw SQLError.createSQLException("Statement already closed",
 
845
                                        SQLError.SQL_STATE_ILLEGAL_ARGUMENT, this.exceptionInterceptor);
 
846
                } catch (SQLException sqlEx) {
 
847
                        checkAndFireConnectionError(sqlEx);
 
848
                }
 
849
 
 
850
                return -1; // we actually never get here, but the compiler can't figure
 
851
 
 
852
                // that out
 
853
        }
 
854
 
 
855
        public void enableStreamingResults() throws SQLException {
 
856
                try {
 
857
                        if (this.wrappedStmt != null) {
 
858
                                ((com.mysql.jdbc.Statement) this.wrappedStmt)
 
859
                                                .enableStreamingResults();
 
860
                        } else {
 
861
                                throw SQLError.createSQLException(
 
862
                                                "No operations allowed after statement closed",
 
863
                                                SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
 
864
                        }
 
865
                } catch (SQLException sqlEx) {
 
866
                        checkAndFireConnectionError(sqlEx);
 
867
                }
 
868
        }
 
869
}