~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/ikvm/openjdk/sun/jdbc/odbc/JdbcOdbcResultSet.java

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Copyright (C) 2009, 2011 Volker Berlin (i-net software)
 
3
 
 
4
  This software is provided 'as-is', without any express or implied
 
5
  warranty.  In no event will the authors be held liable for any damages
 
6
  arising from the use of this software.
 
7
 
 
8
  Permission is granted to anyone to use this software for any purpose,
 
9
  including commercial applications, and to alter it and redistribute it
 
10
  freely, subject to the following restrictions:
 
11
 
 
12
  1. The origin of this software must not be misrepresented; you must not
 
13
     claim that you wrote the original software. If you use this software
 
14
     in a product, an acknowledgment in the product documentation would be
 
15
     appreciated but is not required.
 
16
  2. Altered source versions must be plainly marked as such, and must not be
 
17
     misrepresented as being the original software.
 
18
  3. This notice may not be removed or altered from any source distribution.
 
19
 
 
20
  Jeroen Frijters
 
21
  jeroen@frijters.net
 
22
  
 
23
 */
 
24
package sun.jdbc.odbc;
 
25
 
 
26
import java.io.InputStream;
 
27
import java.io.Reader;
 
28
import java.math.BigDecimal;
 
29
import java.sql.*;
 
30
 
 
31
import cli.System.Data.Common.*;
 
32
 
 
33
/**
 
34
 * This JDBC Driver is a wrapper to the ODBC.NET Data Provider. This ResultSet based on a DataReader.
 
35
 */
 
36
public class JdbcOdbcResultSet extends JdbcOdbcObject implements ResultSet{
 
37
 
 
38
    private DbDataReader reader;
 
39
 
 
40
    private final JdbcOdbcStatement statement;
 
41
 
 
42
    private final int holdability;
 
43
 
 
44
    private final int concurrency;
 
45
 
 
46
    private int fetchSize;
 
47
 
 
48
    private int row;
 
49
 
 
50
    private final int resultSetType;
 
51
 
 
52
    private ResultSetMetaData metaData;
 
53
 
 
54
 
 
55
    /**
 
56
     * Create a ResultSet that based on a DbDataReader
 
57
     * 
 
58
     * @param statement
 
59
     *            the statement for getStatement(), can be null
 
60
     * @param reader
 
61
     *            the reader for the data access, if it null then the resultset is closed.
 
62
     */
 
63
    public JdbcOdbcResultSet(JdbcOdbcStatement statement, DbDataReader reader){
 
64
        this.statement = statement;
 
65
        this.reader = reader;
 
66
        this.resultSetType = TYPE_FORWARD_ONLY;
 
67
        this.concurrency = CONCUR_READ_ONLY;
 
68
        this.holdability = HOLD_CURSORS_OVER_COMMIT;
 
69
    }
 
70
 
 
71
 
 
72
    /**
 
73
     * A constructor for extended classes. All methods that use the reader must be overridden if you use this
 
74
     * constructor.
 
75
     * 
 
76
     * @param statement
 
77
     *            the statement for getStatement(), can be null
 
78
     * @param resultSetType
 
79
     *            a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or
 
80
     *            ResultSet.TYPE_SCROLL_SENSITIVE
 
81
     * @param concurrency
 
82
     *            a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
 
83
     */
 
84
    protected JdbcOdbcResultSet(JdbcOdbcStatement statement, int resultSetType, int concurrency){
 
85
        this.statement = statement;
 
86
        this.reader = null;
 
87
        this.resultSetType = resultSetType;
 
88
        this.concurrency = concurrency;
 
89
        this.holdability = HOLD_CURSORS_OVER_COMMIT;
 
90
    }
 
91
 
 
92
 
 
93
    public boolean absolute(int rowPosition) throws SQLException{
 
94
        throwForwardOnly();
 
95
        return false; // for Compiler
 
96
    }
 
97
 
 
98
 
 
99
    public void afterLast() throws SQLException{
 
100
        throwForwardOnly();
 
101
    }
 
102
 
 
103
 
 
104
    public void beforeFirst() throws SQLException{
 
105
        throwForwardOnly();
 
106
    }
 
107
 
 
108
 
 
109
    public void cancelRowUpdates() throws SQLException{
 
110
        throwReadOnly();
 
111
    }
 
112
 
 
113
 
 
114
    public void clearWarnings() throws SQLException{
 
115
        // TODO Auto-generated method stub
 
116
 
 
117
    }
 
118
 
 
119
 
 
120
    public void close(){
 
121
        reader = null;
 
122
        statement.closeReaderIfPossible();
 
123
    }
 
124
 
 
125
 
 
126
    public void deleteRow() throws SQLException{
 
127
        throwReadOnly();
 
128
    }
 
129
 
 
130
 
 
131
    @Override
 
132
    public int findColumn(String columnLabel) throws SQLException{
 
133
        try{
 
134
            return getReader().GetOrdinal(columnLabel) + 1;
 
135
        }catch(ArrayIndexOutOfBoundsException ex){
 
136
            throw new SQLException("Column '" + columnLabel + "' not found.", "S0022", ex);
 
137
        }
 
138
    }
 
139
 
 
140
 
 
141
    public boolean first() throws SQLException{
 
142
        throwForwardOnly();
 
143
        return false; // for compiler
 
144
    }
 
145
 
 
146
 
 
147
    public int getConcurrency(){
 
148
        return concurrency;
 
149
    }
 
150
 
 
151
 
 
152
    public String getCursorName() throws SQLException{
 
153
        // TODO Auto-generated method stub
 
154
        return null;
 
155
    }
 
156
 
 
157
 
 
158
    public int getFetchDirection(){
 
159
        return FETCH_UNKNOWN;
 
160
    }
 
161
 
 
162
 
 
163
    public int getFetchSize(){
 
164
        return fetchSize;
 
165
    }
 
166
 
 
167
 
 
168
    public int getHoldability(){
 
169
        return holdability;
 
170
    }
 
171
 
 
172
 
 
173
    public ResultSetMetaData getMetaData() throws SQLException{
 
174
        if(metaData == null){
 
175
            metaData = new JdbcOdbcResultSetMetaData(getReader());
 
176
        }
 
177
        return metaData;
 
178
    }
 
179
 
 
180
 
 
181
    public int getRow() throws SQLException{
 
182
        getReader(); // checking for is closed
 
183
        return row;
 
184
    }
 
185
 
 
186
 
 
187
    public Statement getStatement(){
 
188
        return statement;
 
189
    }
 
190
 
 
191
 
 
192
    public int getType(){
 
193
        return resultSetType;
 
194
    }
 
195
 
 
196
 
 
197
    public SQLWarning getWarnings() throws SQLException{
 
198
        // TODO Auto-generated method stub
 
199
        return null;
 
200
    }
 
201
 
 
202
 
 
203
    public void insertRow() throws SQLException{
 
204
        throwReadOnly();
 
205
    }
 
206
 
 
207
 
 
208
    public boolean isAfterLast() throws SQLException{
 
209
        throwForwardOnly();
 
210
        return false; // only for compiler
 
211
    }
 
212
 
 
213
 
 
214
    public boolean isBeforeFirst() throws SQLException{
 
215
        throwForwardOnly();
 
216
        return false; // only for compiler
 
217
    }
 
218
 
 
219
 
 
220
    public boolean isClosed(){
 
221
        return reader == null;
 
222
    }
 
223
 
 
224
 
 
225
    public boolean isFirst() throws SQLException{
 
226
        throwForwardOnly();
 
227
        return false; // only for compiler
 
228
    }
 
229
 
 
230
 
 
231
    public boolean isLast() throws SQLException{
 
232
        throwForwardOnly();
 
233
        return false; // only for compiler
 
234
    }
 
235
 
 
236
 
 
237
    public boolean last() throws SQLException{
 
238
        throwForwardOnly();
 
239
        return false; // only for compiler
 
240
    }
 
241
 
 
242
 
 
243
    public void moveToCurrentRow() throws SQLException{
 
244
        throwReadOnly();
 
245
    }
 
246
 
 
247
 
 
248
    public void moveToInsertRow() throws SQLException{
 
249
        throwReadOnly();
 
250
    }
 
251
 
 
252
 
 
253
    public boolean next() throws SQLException{
 
254
        DbDataReader dataReader = getReader();
 
255
        //if we after the last row then we close the reader
 
256
        //to prevent an error on repeating call of next() after the end
 
257
        //that we check also get_IsClosed()
 
258
        if(!dataReader.get_IsClosed() && dataReader.Read()){
 
259
            row++;
 
260
            return true;
 
261
        }
 
262
        row = 0;
 
263
        statement.closeReaderIfPossible();
 
264
        return false;
 
265
    }
 
266
 
 
267
 
 
268
    public boolean previous() throws SQLException{
 
269
        throwForwardOnly();
 
270
        return false; // only for compiler
 
271
    }
 
272
 
 
273
 
 
274
    public void refreshRow() throws SQLException{
 
275
        throwForwardOnly();
 
276
    }
 
277
 
 
278
 
 
279
    public boolean relative(int rowPositions) throws SQLException{
 
280
        throwForwardOnly();
 
281
        return false; // only for compiler
 
282
    }
 
283
 
 
284
 
 
285
    public boolean rowDeleted() throws SQLException{
 
286
        throwReadOnly();
 
287
        return false; // only for compiler
 
288
    }
 
289
 
 
290
 
 
291
    public boolean rowInserted() throws SQLException{
 
292
        throwReadOnly();
 
293
        return false; // only for compiler
 
294
    }
 
295
 
 
296
 
 
297
    public boolean rowUpdated() throws SQLException{
 
298
        throwReadOnly();
 
299
        return false; // only for compiler
 
300
    }
 
301
 
 
302
 
 
303
    public void setFetchDirection(int direction){
 
304
        // ignore it
 
305
    }
 
306
 
 
307
 
 
308
    public void setFetchSize(int rows){
 
309
        // ignore it
 
310
    }
 
311
 
 
312
 
 
313
    public void updateArray(int columnIndex, Array x) throws SQLException{
 
314
        updateObject(columnIndex, x);
 
315
    }
 
316
 
 
317
 
 
318
    public void updateArray(String columnLabel, Array x) throws SQLException{
 
319
        updateArray(findColumn(columnLabel), x);
 
320
    }
 
321
 
 
322
 
 
323
    public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException{
 
324
        updateObject(columnIndex, x, length);
 
325
    }
 
326
 
 
327
 
 
328
    public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException{
 
329
        updateObject(findColumn(columnLabel), x, length);
 
330
    }
 
331
 
 
332
 
 
333
    public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException{
 
334
        updateObject(columnIndex, x, (int)length);
 
335
    }
 
336
 
 
337
 
 
338
    public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException{
 
339
        updateObject(findColumn(columnLabel), x, (int)length);
 
340
    }
 
341
 
 
342
 
 
343
    public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException{
 
344
        updateObject(columnIndex, x);
 
345
    }
 
346
 
 
347
 
 
348
    public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException{
 
349
        updateObject(findColumn(columnLabel), x);
 
350
    }
 
351
 
 
352
 
 
353
    public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException{
 
354
        updateObject(columnIndex, x);
 
355
    }
 
356
 
 
357
 
 
358
    public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException{
 
359
        updateObject(findColumn(columnLabel), x);
 
360
    }
 
361
 
 
362
 
 
363
    public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException{
 
364
        updateObject(columnIndex, x, length);
 
365
    }
 
366
 
 
367
 
 
368
    public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException{
 
369
        updateObject(findColumn(columnLabel), x, length);
 
370
    }
 
371
 
 
372
 
 
373
    public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException{
 
374
        updateObject(columnIndex, x, (int)length);
 
375
    }
 
376
 
 
377
 
 
378
    public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException{
 
379
        updateObject(findColumn(columnLabel), x, (int)length);
 
380
    }
 
381
 
 
382
 
 
383
    public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException{
 
384
        updateObject(columnIndex, x);
 
385
    }
 
386
 
 
387
 
 
388
    public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException{
 
389
        updateObject(findColumn(columnLabel), x);
 
390
    }
 
391
 
 
392
 
 
393
    public void updateBlob(int columnIndex, Blob x) throws SQLException{
 
394
        updateObject(columnIndex, x);
 
395
    }
 
396
 
 
397
 
 
398
    public void updateBlob(String columnLabel, Blob x) throws SQLException{
 
399
        updateObject(findColumn(columnLabel), x);
 
400
    }
 
401
 
 
402
 
 
403
    public void updateBlob(int columnIndex, InputStream x, long length) throws SQLException{
 
404
        updateObject(columnIndex, x, (int)length);
 
405
    }
 
406
 
 
407
 
 
408
    public void updateBlob(String columnLabel, InputStream x, long length) throws SQLException{
 
409
        updateObject(findColumn(columnLabel), x, (int)length);
 
410
    }
 
411
 
 
412
 
 
413
    public void updateBlob(int columnIndex, InputStream x) throws SQLException{
 
414
        updateObject(columnIndex, x);
 
415
    }
 
416
 
 
417
 
 
418
    public void updateBlob(String columnLabel, InputStream x) throws SQLException{
 
419
        updateObject(findColumn(columnLabel), x);
 
420
    }
 
421
 
 
422
 
 
423
    public void updateBoolean(int columnIndex, boolean x) throws SQLException{
 
424
        updateObject(columnIndex, Boolean.valueOf(x));
 
425
    }
 
426
 
 
427
 
 
428
    public void updateBoolean(String columnLabel, boolean x) throws SQLException{
 
429
        updateObject(findColumn(columnLabel), Boolean.valueOf(x));
 
430
    }
 
431
 
 
432
 
 
433
    public void updateByte(int columnIndex, byte x) throws SQLException{
 
434
        updateObject(columnIndex, Byte.valueOf(x));
 
435
    }
 
436
 
 
437
 
 
438
    public void updateByte(String columnLabel, byte x) throws SQLException{
 
439
        updateObject(findColumn(columnLabel), Byte.valueOf(x));
 
440
    }
 
441
 
 
442
 
 
443
    public void updateBytes(int columnIndex, byte[] x) throws SQLException{
 
444
        updateObject(columnIndex, x);
 
445
    }
 
446
 
 
447
 
 
448
    public void updateBytes(String columnLabel, byte[] x) throws SQLException{
 
449
        updateObject(findColumn(columnLabel), x);
 
450
    }
 
451
 
 
452
 
 
453
    public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException{
 
454
        updateObject(columnIndex, x, length);
 
455
    }
 
456
 
 
457
 
 
458
    public void updateCharacterStream(String columnLabel, Reader x, int length) throws SQLException{
 
459
        updateObject(findColumn(columnLabel), x, length);
 
460
    }
 
461
 
 
462
 
 
463
    public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException{
 
464
        updateObject(columnIndex, x, (int)length);
 
465
    }
 
466
 
 
467
 
 
468
    public void updateCharacterStream(String columnLabel, Reader x, long length) throws SQLException{
 
469
        updateObject(findColumn(columnLabel), x, (int)length);
 
470
    }
 
471
 
 
472
 
 
473
    public void updateCharacterStream(int columnIndex, Reader x) throws SQLException{
 
474
        updateObject(columnIndex, x);
 
475
    }
 
476
 
 
477
 
 
478
    public void updateCharacterStream(String columnLabel, Reader x) throws SQLException{
 
479
        updateObject(findColumn(columnLabel), x);
 
480
    }
 
481
 
 
482
 
 
483
    public void updateClob(int columnIndex, Clob x) throws SQLException{
 
484
        updateObject(columnIndex, x);
 
485
    }
 
486
 
 
487
 
 
488
    public void updateClob(String columnLabel, Clob x) throws SQLException{
 
489
        updateObject(findColumn(columnLabel), x);
 
490
    }
 
491
 
 
492
 
 
493
    public void updateClob(int columnIndex, Reader x, long length) throws SQLException{
 
494
        updateObject(columnIndex, x, (int)length);
 
495
    }
 
496
 
 
497
 
 
498
    public void updateClob(String columnLabel, Reader x, long length) throws SQLException{
 
499
        updateObject(findColumn(columnLabel), x, (int)length);
 
500
    }
 
501
 
 
502
 
 
503
    public void updateClob(int columnIndex, Reader x) throws SQLException{
 
504
        updateObject(columnIndex, x);
 
505
    }
 
506
 
 
507
 
 
508
    public void updateClob(String columnLabel, Reader x) throws SQLException{
 
509
        updateObject(findColumn(columnLabel), x);
 
510
    }
 
511
 
 
512
 
 
513
    public void updateDate(int columnIndex, Date x) throws SQLException{
 
514
        updateObject(columnIndex, x);
 
515
    }
 
516
 
 
517
 
 
518
    public void updateDate(String columnLabel, Date x) throws SQLException{
 
519
        updateObject(findColumn(columnLabel), x);
 
520
    }
 
521
 
 
522
 
 
523
    public void updateDouble(int columnIndex, double x) throws SQLException{
 
524
        updateObject(columnIndex, Double.valueOf(x));
 
525
    }
 
526
 
 
527
 
 
528
    public void updateDouble(String columnLabel, double x) throws SQLException{
 
529
        updateObject(findColumn(columnLabel), Double.valueOf(x));
 
530
    }
 
531
 
 
532
 
 
533
    public void updateFloat(int columnIndex, float x) throws SQLException{
 
534
        updateObject(columnIndex, Float.valueOf(x));
 
535
    }
 
536
 
 
537
 
 
538
    public void updateFloat(String columnLabel, float x) throws SQLException{
 
539
        updateObject(findColumn(columnLabel), Float.valueOf(x));
 
540
    }
 
541
 
 
542
 
 
543
    public void updateInt(int columnIndex, int x) throws SQLException{
 
544
        updateObject(columnIndex, Integer.valueOf(x));
 
545
    }
 
546
 
 
547
 
 
548
    public void updateInt(String columnLabel, int x) throws SQLException{
 
549
        updateObject(findColumn(columnLabel), Integer.valueOf(x));
 
550
    }
 
551
 
 
552
 
 
553
    public void updateLong(int columnIndex, long x) throws SQLException{
 
554
        updateObject(columnIndex, Long.valueOf(x));
 
555
    }
 
556
 
 
557
 
 
558
    public void updateLong(String columnLabel, long x) throws SQLException{
 
559
        updateObject(findColumn(columnLabel), Long.valueOf(x));
 
560
    }
 
561
 
 
562
 
 
563
    public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException{
 
564
        updateObject(columnIndex, x, (int)length);
 
565
    }
 
566
 
 
567
 
 
568
    public void updateNCharacterStream(String columnLabel, Reader x, long length) throws SQLException{
 
569
        updateObject(findColumn(columnLabel), x, (int)length);
 
570
    }
 
571
 
 
572
 
 
573
    public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException{
 
574
        updateObject(columnIndex, x);
 
575
    }
 
576
 
 
577
 
 
578
    public void updateNCharacterStream(String columnLabel, Reader x) throws SQLException{
 
579
        updateObject(findColumn(columnLabel), x);
 
580
    }
 
581
 
 
582
 
 
583
    public void updateNClob(int columnIndex, NClob x) throws SQLException{
 
584
        updateObject(columnIndex, x);
 
585
    }
 
586
 
 
587
 
 
588
    public void updateNClob(String columnLabel, NClob x) throws SQLException{
 
589
        updateObject(findColumn(columnLabel), x);
 
590
    }
 
591
 
 
592
 
 
593
    public void updateNClob(int columnIndex, Reader x, long length) throws SQLException{
 
594
        updateObject(columnIndex, x, (int)length);
 
595
    }
 
596
 
 
597
 
 
598
    public void updateNClob(String columnLabel, Reader x, long length) throws SQLException{
 
599
        updateObject(findColumn(columnLabel), x, (int)length);
 
600
    }
 
601
 
 
602
 
 
603
    public void updateNClob(int columnIndex, Reader x) throws SQLException{
 
604
        updateObject(columnIndex, x);
 
605
    }
 
606
 
 
607
 
 
608
    public void updateNClob(String columnLabel, Reader x) throws SQLException{
 
609
        updateObject(findColumn(columnLabel), x);
 
610
    }
 
611
 
 
612
 
 
613
    public void updateNString(int columnIndex, String x) throws SQLException{
 
614
        updateObject(columnIndex, x);
 
615
    }
 
616
 
 
617
 
 
618
    public void updateNString(String columnLabel, String x) throws SQLException{
 
619
        updateObject(findColumn(columnLabel), x);
 
620
    }
 
621
 
 
622
 
 
623
    public void updateNull(int columnIndex) throws SQLException{
 
624
        updateObject(columnIndex, null);
 
625
    }
 
626
 
 
627
 
 
628
    public void updateNull(String columnLabel) throws SQLException{
 
629
        updateObject(findColumn(columnLabel), null);
 
630
    }
 
631
 
 
632
 
 
633
    public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException{
 
634
        throwReadOnly();
 
635
    }
 
636
 
 
637
 
 
638
    public void updateObject(int columnIndex, Object x) throws SQLException{
 
639
        updateObject(columnIndex, x, -1);
 
640
    }
 
641
 
 
642
 
 
643
    public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException{
 
644
        updateObject(findColumn(columnLabel), x, scaleOrLength);
 
645
    }
 
646
 
 
647
 
 
648
    public void updateObject(String columnLabel, Object x) throws SQLException{
 
649
        updateObject(findColumn(columnLabel), x);
 
650
    }
 
651
 
 
652
 
 
653
    public void updateRef(int columnIndex, Ref x) throws SQLException{
 
654
        updateObject(columnIndex, x);
 
655
    }
 
656
 
 
657
 
 
658
    public void updateRef(String columnLabel, Ref x) throws SQLException{
 
659
        updateObject(findColumn(columnLabel), x);
 
660
    }
 
661
 
 
662
 
 
663
    public void updateRow() throws SQLException{
 
664
        throwReadOnly();
 
665
    }
 
666
 
 
667
 
 
668
    public void updateRowId(int columnIndex, RowId x) throws SQLException{
 
669
        updateObject(columnIndex, x);
 
670
    }
 
671
 
 
672
 
 
673
    public void updateRowId(String columnLabel, RowId x) throws SQLException{
 
674
        updateObject(findColumn(columnLabel), x);
 
675
    }
 
676
 
 
677
 
 
678
    public void updateSQLXML(int columnIndex, SQLXML x) throws SQLException{
 
679
        updateObject(columnIndex, x);
 
680
    }
 
681
 
 
682
 
 
683
    public void updateSQLXML(String columnLabel, SQLXML x) throws SQLException{
 
684
        updateObject(findColumn(columnLabel), x);
 
685
    }
 
686
 
 
687
 
 
688
    public void updateShort(int columnIndex, short x) throws SQLException{
 
689
        updateObject(columnIndex, Short.valueOf(x));
 
690
    }
 
691
 
 
692
 
 
693
    public void updateShort(String columnLabel, short x) throws SQLException{
 
694
        updateObject(findColumn(columnLabel), Short.valueOf(x));
 
695
    }
 
696
 
 
697
 
 
698
    public void updateString(int columnIndex, String x) throws SQLException{
 
699
        updateObject(columnIndex, x);
 
700
    }
 
701
 
 
702
 
 
703
    public void updateString(String columnLabel, String x) throws SQLException{
 
704
        updateObject(findColumn(columnLabel), x);
 
705
    }
 
706
 
 
707
 
 
708
    public void updateTime(int columnIndex, Time x) throws SQLException{
 
709
        updateObject(columnIndex, x);
 
710
    }
 
711
 
 
712
 
 
713
    public void updateTime(String columnLabel, Time x) throws SQLException{
 
714
        updateObject(findColumn(columnLabel), x);
 
715
    }
 
716
 
 
717
 
 
718
    public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException{
 
719
        updateObject(columnIndex, x);
 
720
    }
 
721
 
 
722
 
 
723
    public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException{
 
724
        updateObject(findColumn(columnLabel), x);
 
725
    }
 
726
 
 
727
 
 
728
    public boolean isWrapperFor(Class<?> iface){
 
729
        return iface.isAssignableFrom(this.getClass());
 
730
    }
 
731
 
 
732
 
 
733
    public <T>T unwrap(Class<T> iface) throws SQLException{
 
734
        if(isWrapperFor(iface)){
 
735
            return (T)this;
 
736
        }
 
737
        throw new SQLException(this.getClass().getName() + " does not implements " + iface.getName() + ".", "01000");
 
738
    }
 
739
 
 
740
 
 
741
    private void throwForwardOnly() throws SQLException{
 
742
        throw new SQLException("ResultSet is forward only.", "24000");
 
743
    }
 
744
 
 
745
 
 
746
    private void throwReadOnly() throws SQLException{
 
747
        throw new SQLException("ResultSet is read only.", "24000");
 
748
    }
 
749
 
 
750
 
 
751
    /**
 
752
     * Check if this ResultSet is closed before access to the DbDataReader
 
753
     * 
 
754
     * @return
 
755
     * @throws SQLException
 
756
     */
 
757
    private DbDataReader getReader() throws SQLException{
 
758
        if(reader == null){
 
759
            throw new SQLException("ResultSet is closed.", "24000");
 
760
        }
 
761
        return reader;
 
762
    }
 
763
 
 
764
 
 
765
    /**
 
766
     * {@inheritDoc}
 
767
     */
 
768
    @Override
 
769
    protected Object getObjectImpl(int columnIndex) throws SQLException{
 
770
        try{
 
771
            DbDataReader datareader = getReader();
 
772
            try{
 
773
                return datareader.get_Item(columnIndex-1);
 
774
            }catch(ArrayIndexOutOfBoundsException aioobe){
 
775
                throw new SQLException( "Invalid column number ("+columnIndex+"). A number between 1 and "+datareader.get_FieldCount()+" is valid.", "S1002", aioobe);
 
776
            }
 
777
        }catch(Throwable ex){
 
778
            throw JdbcOdbcUtils.createSQLException(ex);
 
779
        }
 
780
    }
 
781
 
 
782
 
 
783
        /**
 
784
         * {@inheritDoc}
 
785
         */
 
786
        public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
 
787
                throw new SQLFeatureNotSupportedException();
 
788
        }
 
789
 
 
790
 
 
791
        /**
 
792
         * {@inheritDoc}
 
793
         */
 
794
        public <T> T getObject(String columnLabel, Class<T> type)
 
795
                        throws SQLException {
 
796
                throw new SQLFeatureNotSupportedException();
 
797
        }
 
798
 
 
799
}