ResultSetWrappingSqlRowSet.java 18.7 KB
Newer Older
A
Arjen Poutsma 已提交
1
/*
2
 * Copyright 2002-2019 the original author or authors.
A
Arjen Poutsma 已提交
3 4 5 6 7
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
S
Spring Operator 已提交
8
 *      https://www.apache.org/licenses/LICENSE-2.0
A
Arjen Poutsma 已提交
9 10 11 12 13 14 15 16 17 18 19 20 21
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.jdbc.support.rowset;

import java.math.BigDecimal;
import java.sql.Date;
import java.sql.ResultSet;
22
import java.sql.ResultSetMetaData;
A
Arjen Poutsma 已提交
23 24 25 26
import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
J
Juergen Hoeller 已提交
27
import java.util.Collections;
28
import java.util.HashMap;
A
Arjen Poutsma 已提交
29 30 31
import java.util.Map;

import org.springframework.jdbc.InvalidResultSetAccessException;
32
import org.springframework.lang.Nullable;
A
Arjen Poutsma 已提交
33 34

/**
J
Juergen Hoeller 已提交
35 36 37
 * The default implementation of Spring's {@link SqlRowSet} interface, wrapping a
 * {@link java.sql.ResultSet}, catching any {@link SQLException}s and translating
 * them to a corresponding Spring {@link InvalidResultSetAccessException}.
A
Arjen Poutsma 已提交
38
 *
J
Juergen Hoeller 已提交
39
 * <p>The passed-in ResultSet should already be disconnected if the SqlRowSet is supposed
J
Juergen Hoeller 已提交
40
 * to be usable in a disconnected fashion. This means that you will usually pass in a
41
 * {@code javax.sql.rowset.CachedRowSet}, which implements the ResultSet interface.
A
Arjen Poutsma 已提交
42
 *
J
Juergen Hoeller 已提交
43 44 45 46
 * <p>Note: Since JDBC 4.0, it has been clarified that any methods using a String to identify
 * the column should be using the column label. The column label is assigned using the ALIAS
 * keyword in the SQL query string. When the query doesn't use an ALIAS, the default label is
 * the column name. Most JDBC ResultSet implementations follow this new pattern but there are
47
 * exceptions such as the {@code com.sun.rowset.CachedRowSetImpl} class which only uses
J
Juergen Hoeller 已提交
48 49
 * the column name, ignoring any column labels. As of Spring 3.0.5, ResultSetWrappingSqlRowSet
 * will translate column labels to the correct column index to provide better support for the
50
 * {@code com.sun.rowset.CachedRowSetImpl} which is the default implementation used by
J
Juergen Hoeller 已提交
51 52
 * {@link org.springframework.jdbc.core.JdbcTemplate} when working with RowSets.
 *
53
 * <p>Note: This class implements the {@code java.io.Serializable} marker interface
J
Juergen Hoeller 已提交
54 55 56
 * through the SqlRowSet interface, but is only actually serializable if the disconnected
 * ResultSet/RowSet contained in it is serializable. Most CachedRowSet implementations
 * are actually serializable, so this should usually work out.
A
Arjen Poutsma 已提交
57 58 59 60 61 62
 *
 * @author Thomas Risberg
 * @author Juergen Hoeller
 * @since 1.2
 * @see java.sql.ResultSet
 * @see javax.sql.rowset.CachedRowSet
J
Juergen Hoeller 已提交
63
 * @see org.springframework.jdbc.core.JdbcTemplate#queryForRowSet
A
Arjen Poutsma 已提交
64 65 66 67 68 69 70 71 72 73
 */
public class ResultSetWrappingSqlRowSet implements SqlRowSet {

	/** use serialVersionUID from Spring 1.2 for interoperability */
	private static final long serialVersionUID = -4688694393146734764L;


	private final ResultSet resultSet;

	private final SqlRowSetMetaData rowSetMetaData;
74

75
	private final Map<String, Integer> columnLabelMap;
A
Arjen Poutsma 已提交
76 77 78 79 80


	/**
	 * Create a new ResultSetWrappingSqlRowSet for the given ResultSet.
	 * @param resultSet a disconnected ResultSet to wrap
81
	 * (usually a {@code javax.sql.rowset.CachedRowSet})
A
Arjen Poutsma 已提交
82 83 84 85 86 87 88 89 90 91 92 93 94 95
	 * @throws InvalidResultSetAccessException if extracting
	 * the ResultSetMetaData failed
	 * @see javax.sql.rowset.CachedRowSet
	 * @see java.sql.ResultSet#getMetaData
	 * @see ResultSetWrappingSqlRowSetMetaData
	 */
	public ResultSetWrappingSqlRowSet(ResultSet resultSet) throws InvalidResultSetAccessException {
		this.resultSet = resultSet;
		try {
			this.rowSetMetaData = new ResultSetWrappingSqlRowSetMetaData(resultSet.getMetaData());
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
96 97 98 99
		try {
			ResultSetMetaData rsmd = resultSet.getMetaData();
			if (rsmd != null) {
				int columnCount = rsmd.getColumnCount();
100
				this.columnLabelMap = new HashMap<>(columnCount);
101
				for (int i = 1; i <= columnCount; i++) {
102 103 104 105 106 107
					String key = rsmd.getColumnLabel(i);
					// Make sure to preserve first matching column for any given name,
					// as defined in ResultSet's type-level javadoc (lines 81 to 83).
					if (!this.columnLabelMap.containsKey(key)) {
						this.columnLabelMap.put(key, i);
					}
108 109 110
				}
			}
			else {
J
Juergen Hoeller 已提交
111
				this.columnLabelMap = Collections.emptyMap();
112
			}
J
Juergen Hoeller 已提交
113 114
		}
		catch (SQLException se) {
115 116
			throw new InvalidResultSetAccessException(se);
		}
117

A
Arjen Poutsma 已提交
118 119 120 121 122
	}


	/**
	 * Return the underlying ResultSet
123
	 * (usually a {@code javax.sql.rowset.CachedRowSet}).
A
Arjen Poutsma 已提交
124 125 126 127 128 129 130 131 132
	 * @see javax.sql.rowset.CachedRowSet
	 */
	public final ResultSet getResultSet() {
		return this.resultSet;
	}

	/**
	 * @see java.sql.ResultSetMetaData#getCatalogName(int)
	 */
133
	@Override
A
Arjen Poutsma 已提交
134 135 136
	public final SqlRowSetMetaData getMetaData() {
		return this.rowSetMetaData;
	}
137

A
Arjen Poutsma 已提交
138 139 140
	/**
	 * @see java.sql.ResultSet#findColumn(String)
	 */
141
	@Override
142
	public int findColumn(String columnLabel) throws InvalidResultSetAccessException {
J
Juergen Hoeller 已提交
143 144 145 146 147
		Integer columnIndex = this.columnLabelMap.get(columnLabel);
		if (columnIndex != null) {
			return columnIndex;
		}
		else {
148
			try {
J
Juergen Hoeller 已提交
149
				return this.resultSet.findColumn(columnLabel);
150
			}
151 152 153
			catch (SQLException se) {
				throw new InvalidResultSetAccessException(se);
			}
A
Arjen Poutsma 已提交
154 155 156 157 158 159 160 161 162
		}
	}


	// RowSet methods for extracting data values

	/**
	 * @see java.sql.ResultSet#getBigDecimal(int)
	 */
163
	@Override
164
	@Nullable
A
Arjen Poutsma 已提交
165 166 167 168 169 170 171 172
	public BigDecimal getBigDecimal(int columnIndex) throws InvalidResultSetAccessException {
		try {
			return this.resultSet.getBigDecimal(columnIndex);
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
173

A
Arjen Poutsma 已提交
174 175 176
	/**
	 * @see java.sql.ResultSet#getBigDecimal(String)
	 */
177
	@Override
178
	@Nullable
179 180
	public BigDecimal getBigDecimal(String columnLabel) throws InvalidResultSetAccessException {
		return getBigDecimal(findColumn(columnLabel));
A
Arjen Poutsma 已提交
181 182 183 184 185
	}

	/**
	 * @see java.sql.ResultSet#getBoolean(int)
	 */
186
	@Override
A
Arjen Poutsma 已提交
187 188 189 190 191 192 193 194 195 196 197 198
	public boolean getBoolean(int columnIndex) throws InvalidResultSetAccessException {
		try {
			return this.resultSet.getBoolean(columnIndex);
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}

	/**
	 * @see java.sql.ResultSet#getBoolean(String)
	 */
199
	@Override
200 201
	public boolean getBoolean(String columnLabel) throws InvalidResultSetAccessException {
		return getBoolean(findColumn(columnLabel));
A
Arjen Poutsma 已提交
202
	}
203

A
Arjen Poutsma 已提交
204 205 206
	/**
	 * @see java.sql.ResultSet#getByte(int)
	 */
207
	@Override
A
Arjen Poutsma 已提交
208 209 210 211 212 213 214 215
	public byte getByte(int columnIndex) throws InvalidResultSetAccessException {
		try {
			return this.resultSet.getByte(columnIndex);
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
216

A
Arjen Poutsma 已提交
217 218 219
	/**
	 * @see java.sql.ResultSet#getByte(String)
	 */
220
	@Override
221 222
	public byte getByte(String columnLabel) throws InvalidResultSetAccessException {
		return getByte(findColumn(columnLabel));
A
Arjen Poutsma 已提交
223
	}
224

A
Arjen Poutsma 已提交
225
	/**
226
	 * @see java.sql.ResultSet#getDate(int)
A
Arjen Poutsma 已提交
227
	 */
228
	@Override
229
	@Nullable
230
	public Date getDate(int columnIndex) throws InvalidResultSetAccessException {
A
Arjen Poutsma 已提交
231
		try {
232
			return this.resultSet.getDate(columnIndex);
A
Arjen Poutsma 已提交
233 234 235 236 237
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
238

A
Arjen Poutsma 已提交
239
	/**
240
	 * @see java.sql.ResultSet#getDate(String)
A
Arjen Poutsma 已提交
241
	 */
242
	@Override
243
	@Nullable
244 245 246 247 248 249 250 251
	public Date getDate(String columnLabel) throws InvalidResultSetAccessException {
		return getDate(findColumn(columnLabel));
	}

	/**
	 * @see java.sql.ResultSet#getDate(int, Calendar)
	 */
	@Override
252
	@Nullable
253
	public Date getDate(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
A
Arjen Poutsma 已提交
254
		try {
255
			return this.resultSet.getDate(columnIndex, cal);
A
Arjen Poutsma 已提交
256 257 258 259 260
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
261

A
Arjen Poutsma 已提交
262
	/**
263
	 * @see java.sql.ResultSet#getDate(String, Calendar)
A
Arjen Poutsma 已提交
264
	 */
265
	@Override
266
	@Nullable
267 268
	public Date getDate(String columnLabel, Calendar cal) throws InvalidResultSetAccessException {
		return getDate(findColumn(columnLabel), cal);
A
Arjen Poutsma 已提交
269
	}
270

A
Arjen Poutsma 已提交
271 272 273
	/**
	 * @see java.sql.ResultSet#getDouble(int)
	 */
274
	@Override
A
Arjen Poutsma 已提交
275 276 277 278 279 280 281 282
	public double getDouble(int columnIndex) throws InvalidResultSetAccessException {
		try {
			return this.resultSet.getDouble(columnIndex);
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
283

A
Arjen Poutsma 已提交
284 285 286
	/**
	 * @see java.sql.ResultSet#getDouble(String)
	 */
287
	@Override
288 289
	public double getDouble(String columnLabel) throws InvalidResultSetAccessException {
		return getDouble(findColumn(columnLabel));
A
Arjen Poutsma 已提交
290
	}
291

A
Arjen Poutsma 已提交
292 293 294
	/**
	 * @see java.sql.ResultSet#getFloat(int)
	 */
295
	@Override
A
Arjen Poutsma 已提交
296 297 298 299 300 301 302 303 304 305 306 307
	public float getFloat(int columnIndex) throws InvalidResultSetAccessException {
		try {
			return this.resultSet.getFloat(columnIndex);
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}

	/**
	 * @see java.sql.ResultSet#getFloat(String)
	 */
308
	@Override
309 310
	public float getFloat(String columnLabel) throws InvalidResultSetAccessException {
		return getFloat(findColumn(columnLabel));
A
Arjen Poutsma 已提交
311
	}
312

A
Arjen Poutsma 已提交
313 314 315
	/**
	 * @see java.sql.ResultSet#getInt(int)
	 */
316
	@Override
A
Arjen Poutsma 已提交
317 318 319 320 321 322 323 324 325 326 327 328
	public int getInt(int columnIndex) throws InvalidResultSetAccessException {
		try {
			return this.resultSet.getInt(columnIndex);
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}

	/**
	 * @see java.sql.ResultSet#getInt(String)
	 */
329
	@Override
330 331
	public int getInt(String columnLabel) throws InvalidResultSetAccessException {
		return getInt(findColumn(columnLabel));
A
Arjen Poutsma 已提交
332
	}
333

A
Arjen Poutsma 已提交
334 335 336
	/**
	 * @see java.sql.ResultSet#getLong(int)
	 */
337
	@Override
A
Arjen Poutsma 已提交
338 339 340 341 342 343 344 345
	public long getLong(int columnIndex) throws InvalidResultSetAccessException {
		try {
			return this.resultSet.getLong(columnIndex);
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
346

A
Arjen Poutsma 已提交
347 348 349
	/**
	 * @see java.sql.ResultSet#getLong(String)
	 */
350
	@Override
351 352
	public long getLong(String columnLabel) throws InvalidResultSetAccessException {
		return getLong(findColumn(columnLabel));
A
Arjen Poutsma 已提交
353
	}
354

A
Arjen Poutsma 已提交
355
	/**
356
	 * @see java.sql.ResultSet#getNString(int)
A
Arjen Poutsma 已提交
357
	 */
358
	@Override
359
	@Nullable
360
	public String getNString(int columnIndex) throws InvalidResultSetAccessException {
A
Arjen Poutsma 已提交
361
		try {
362
			return this.resultSet.getNString(columnIndex);
A
Arjen Poutsma 已提交
363 364 365 366 367
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
368

369 370 371 372
	/**
	 * @see java.sql.ResultSet#getNString(String)
	 */
	@Override
373
	@Nullable
374 375 376 377
	public String getNString(String columnLabel) throws InvalidResultSetAccessException {
		return getNString(findColumn(columnLabel));
	}

A
Arjen Poutsma 已提交
378 379 380
	/**
	 * @see java.sql.ResultSet#getObject(int)
	 */
381
	@Override
382
	@Nullable
A
Arjen Poutsma 已提交
383 384 385 386 387 388 389 390
	public Object getObject(int columnIndex) throws InvalidResultSetAccessException {
		try {
			return this.resultSet.getObject(columnIndex);
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
391

A
Arjen Poutsma 已提交
392
	/**
393
	 * @see java.sql.ResultSet#getObject(String)
A
Arjen Poutsma 已提交
394
	 */
395
	@Override
396
	@Nullable
397 398 399 400 401 402 403 404
	public Object getObject(String columnLabel) throws InvalidResultSetAccessException {
		return getObject(findColumn(columnLabel));
	}

	/**
	 * @see java.sql.ResultSet#getObject(int, Map)
	 */
	@Override
405
	@Nullable
406 407 408 409 410 411 412 413 414 415 416 417 418
	public Object getObject(int columnIndex, Map<String, Class<?>> map) throws InvalidResultSetAccessException {
		try {
			return this.resultSet.getObject(columnIndex, map);
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}

	/**
	 * @see java.sql.ResultSet#getObject(String, Map)
	 */
	@Override
419
	@Nullable
420
	public Object getObject(String columnLabel, Map<String, Class<?>> map) throws InvalidResultSetAccessException {
421
		return getObject(findColumn(columnLabel), map);
A
Arjen Poutsma 已提交
422
	}
423

A
Arjen Poutsma 已提交
424
	/**
425
	 * @see java.sql.ResultSet#getObject(int, Class)
A
Arjen Poutsma 已提交
426
	 */
427
	@Override
428
	@Nullable
429 430 431 432 433 434 435 436 437 438 439 440 441
	public <T> T getObject(int columnIndex, Class<T> type) throws InvalidResultSetAccessException {
		try {
			return this.resultSet.getObject(columnIndex, type);
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}

	/**
	 * @see java.sql.ResultSet#getObject(String, Class)
	 */
	@Override
442
	@Nullable
443 444
	public <T> T getObject(String columnLabel, Class<T> type) throws InvalidResultSetAccessException {
		return getObject(findColumn(columnLabel), type);
A
Arjen Poutsma 已提交
445
	}
446

A
Arjen Poutsma 已提交
447 448 449
	/**
	 * @see java.sql.ResultSet#getShort(int)
	 */
450
	@Override
A
Arjen Poutsma 已提交
451 452 453 454 455 456 457 458
	public short getShort(int columnIndex) throws InvalidResultSetAccessException {
		try {
			return this.resultSet.getShort(columnIndex);
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
459

A
Arjen Poutsma 已提交
460 461 462
	/**
	 * @see java.sql.ResultSet#getShort(String)
	 */
463
	@Override
464 465
	public short getShort(String columnLabel) throws InvalidResultSetAccessException {
		return getShort(findColumn(columnLabel));
A
Arjen Poutsma 已提交
466
	}
467

A
Arjen Poutsma 已提交
468 469 470
	/**
	 * @see java.sql.ResultSet#getString(int)
	 */
471
	@Override
472
	@Nullable
A
Arjen Poutsma 已提交
473 474 475 476 477 478 479 480
	public String getString(int columnIndex) throws InvalidResultSetAccessException {
		try {
			return this.resultSet.getString(columnIndex);
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
481

A
Arjen Poutsma 已提交
482 483 484
	/**
	 * @see java.sql.ResultSet#getString(String)
	 */
485
	@Override
486
	@Nullable
487 488
	public String getString(String columnLabel) throws InvalidResultSetAccessException {
		return getString(findColumn(columnLabel));
A
Arjen Poutsma 已提交
489
	}
490

A
Arjen Poutsma 已提交
491 492 493
	/**
	 * @see java.sql.ResultSet#getTime(int)
	 */
494
	@Override
495
	@Nullable
A
Arjen Poutsma 已提交
496 497 498 499 500 501 502 503 504 505 506 507
	public Time getTime(int columnIndex) throws InvalidResultSetAccessException {
		try {
			return this.resultSet.getTime(columnIndex);
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}

	/**
	 * @see java.sql.ResultSet#getTime(String)
	 */
508
	@Override
509
	@Nullable
510 511
	public Time getTime(String columnLabel) throws InvalidResultSetAccessException {
		return getTime(findColumn(columnLabel));
A
Arjen Poutsma 已提交
512
	}
513

A
Arjen Poutsma 已提交
514
	/**
515
	 * @see java.sql.ResultSet#getTime(int, Calendar)
A
Arjen Poutsma 已提交
516
	 */
517
	@Override
518
	@Nullable
519
	public Time getTime(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
A
Arjen Poutsma 已提交
520
		try {
521
			return this.resultSet.getTime(columnIndex, cal);
A
Arjen Poutsma 已提交
522 523 524 525 526
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
527

528 529 530 531
	/**
	 * @see java.sql.ResultSet#getTime(String, Calendar)
	 */
	@Override
532
	@Nullable
533 534 535 536
	public Time getTime(String columnLabel, Calendar cal) throws InvalidResultSetAccessException {
		return getTime(findColumn(columnLabel), cal);
	}

A
Arjen Poutsma 已提交
537 538 539
	/**
	 * @see java.sql.ResultSet#getTimestamp(int)
	 */
540
	@Override
541
	@Nullable
A
Arjen Poutsma 已提交
542 543 544 545 546 547 548 549 550 551
	public Timestamp getTimestamp(int columnIndex) throws InvalidResultSetAccessException {
		try {
			return this.resultSet.getTimestamp(columnIndex);
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}

	/**
552
	 * @see java.sql.ResultSet#getTimestamp(String)
A
Arjen Poutsma 已提交
553
	 */
554
	@Override
555
	@Nullable
556 557
	public Timestamp getTimestamp(String columnLabel) throws InvalidResultSetAccessException {
		return getTimestamp(findColumn(columnLabel));
A
Arjen Poutsma 已提交
558 559 560
	}

	/**
561
	 * @see java.sql.ResultSet#getTimestamp(int, Calendar)
A
Arjen Poutsma 已提交
562
	 */
563
	@Override
564
	@Nullable
565 566 567 568 569 570 571 572 573 574 575 576 577
	public Timestamp getTimestamp(int columnIndex, Calendar cal) throws InvalidResultSetAccessException {
		try {
			return this.resultSet.getTimestamp(columnIndex, cal);
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}

	/**
	 * @see java.sql.ResultSet#getTimestamp(String, Calendar)
	 */
	@Override
578
	@Nullable
579 580
	public Timestamp getTimestamp(String columnLabel, Calendar cal) throws InvalidResultSetAccessException {
		return getTimestamp(findColumn(columnLabel), cal);
A
Arjen Poutsma 已提交
581 582 583 584
	}


	// RowSet navigation methods
585

A
Arjen Poutsma 已提交
586 587 588
	/**
	 * @see java.sql.ResultSet#absolute(int)
	 */
589
	@Override
A
Arjen Poutsma 已提交
590 591 592 593 594 595 596 597 598 599 600 601
	public boolean absolute(int row) throws InvalidResultSetAccessException {
		try {
			return this.resultSet.absolute(row);
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}

	/**
	 * @see java.sql.ResultSet#afterLast()
	 */
602
	@Override
A
Arjen Poutsma 已提交
603 604 605 606 607 608 609 610
	public void afterLast() throws InvalidResultSetAccessException {
		try {
			this.resultSet.afterLast();
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
611

A
Arjen Poutsma 已提交
612 613 614
	/**
	 * @see java.sql.ResultSet#beforeFirst()
	 */
615
	@Override
A
Arjen Poutsma 已提交
616 617 618 619 620 621 622 623
	public void beforeFirst() throws InvalidResultSetAccessException {
		try {
			this.resultSet.beforeFirst();
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
624

A
Arjen Poutsma 已提交
625 626 627
	/**
	 * @see java.sql.ResultSet#first()
	 */
628
	@Override
A
Arjen Poutsma 已提交
629 630 631 632 633 634 635 636 637 638 639 640
	public boolean first() throws InvalidResultSetAccessException {
		try {
			return this.resultSet.first();
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}

	/**
	 * @see java.sql.ResultSet#getRow()
	 */
641
	@Override
A
Arjen Poutsma 已提交
642 643 644 645 646 647 648 649 650 651 652 653
	public int getRow() throws InvalidResultSetAccessException {
		try {
			return this.resultSet.getRow();
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}

	/**
	 * @see java.sql.ResultSet#isAfterLast()
	 */
654
	@Override
A
Arjen Poutsma 已提交
655 656 657 658 659 660 661 662 663 664 665 666
	public boolean isAfterLast() throws InvalidResultSetAccessException {
		try {
			return this.resultSet.isAfterLast();
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}

	/**
	 * @see java.sql.ResultSet#isBeforeFirst()
	 */
667
	@Override
A
Arjen Poutsma 已提交
668 669 670 671 672 673 674 675
	public boolean isBeforeFirst() throws InvalidResultSetAccessException {
		try {
			return this.resultSet.isBeforeFirst();
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
676

A
Arjen Poutsma 已提交
677 678 679
	/**
	 * @see java.sql.ResultSet#isFirst()
	 */
680
	@Override
A
Arjen Poutsma 已提交
681 682 683 684 685 686 687 688
	public boolean isFirst() throws InvalidResultSetAccessException {
		try {
			return this.resultSet.isFirst();
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
689

A
Arjen Poutsma 已提交
690 691 692
	/**
	 * @see java.sql.ResultSet#isLast()
	 */
693
	@Override
A
Arjen Poutsma 已提交
694 695 696 697 698 699 700 701
	public boolean isLast() throws InvalidResultSetAccessException {
		try {
			return this.resultSet.isLast();
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
702

A
Arjen Poutsma 已提交
703 704 705
	/**
	 * @see java.sql.ResultSet#last()
	 */
706
	@Override
A
Arjen Poutsma 已提交
707 708 709 710 711 712 713 714
	public boolean last() throws InvalidResultSetAccessException {
		try {
			return this.resultSet.last();
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
715

A
Arjen Poutsma 已提交
716 717 718
	/**
	 * @see java.sql.ResultSet#next()
	 */
719
	@Override
A
Arjen Poutsma 已提交
720 721 722 723 724 725 726 727
	public boolean next() throws InvalidResultSetAccessException {
		try {
			return this.resultSet.next();
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
728

A
Arjen Poutsma 已提交
729 730 731
	/**
	 * @see java.sql.ResultSet#previous()
	 */
732
	@Override
A
Arjen Poutsma 已提交
733 734 735 736 737 738 739 740
	public boolean previous() throws InvalidResultSetAccessException {
		try {
			return this.resultSet.previous();
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
741

A
Arjen Poutsma 已提交
742 743 744
	/**
	 * @see java.sql.ResultSet#relative(int)
	 */
745
	@Override
A
Arjen Poutsma 已提交
746 747 748 749 750 751 752 753
	public boolean relative(int rows) throws InvalidResultSetAccessException {
		try {
			return this.resultSet.relative(rows);
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}
754

A
Arjen Poutsma 已提交
755 756 757
	/**
	 * @see java.sql.ResultSet#wasNull()
	 */
758
	@Override
A
Arjen Poutsma 已提交
759 760 761 762 763 764 765 766 767 768
	public boolean wasNull() throws InvalidResultSetAccessException {
		try {
			return this.resultSet.wasNull();
		}
		catch (SQLException se) {
			throw new InvalidResultSetAccessException(se);
		}
	}

}