@@ -371,6 +371,11 @@ public void initializeWithMetadata() throws SQLException {
371
371
@ Override
372
372
public boolean absolute (int row ) throws SQLException {
373
373
synchronized (checkClosed ().getConnectionMutex ()) {
374
+ if (!hasRows ()) {
375
+ throw SQLError .createSQLException (Messages .getString ("ResultSet.ResultSet_is_from_UPDATE._No_Data_115" ),
376
+ MysqlErrorNumbers .SQL_STATE_GENERAL_ERROR , getExceptionInterceptor ());
377
+ }
378
+
374
379
if (isStrictlyForwardOnly ()) {
375
380
throw ExceptionFactory .createException (Messages .getString ("ResultSet.ForwardOnly" ));
376
381
}
@@ -419,6 +424,11 @@ public boolean absolute(int row) throws SQLException {
419
424
@ Override
420
425
public void afterLast () throws SQLException {
421
426
synchronized (checkClosed ().getConnectionMutex ()) {
427
+ if (!hasRows ()) {
428
+ throw SQLError .createSQLException (Messages .getString ("ResultSet.ResultSet_is_from_UPDATE._No_Data_115" ),
429
+ MysqlErrorNumbers .SQL_STATE_GENERAL_ERROR , getExceptionInterceptor ());
430
+ }
431
+
422
432
if (isStrictlyForwardOnly ()) {
423
433
throw ExceptionFactory .createException (Messages .getString ("ResultSet.ForwardOnly" ));
424
434
}
@@ -435,6 +445,11 @@ public void afterLast() throws SQLException {
435
445
@ Override
436
446
public void beforeFirst () throws SQLException {
437
447
synchronized (checkClosed ().getConnectionMutex ()) {
448
+ if (!hasRows ()) {
449
+ throw SQLError .createSQLException (Messages .getString ("ResultSet.ResultSet_is_from_UPDATE._No_Data_115" ),
450
+ MysqlErrorNumbers .SQL_STATE_GENERAL_ERROR , getExceptionInterceptor ());
451
+ }
452
+
438
453
if (isStrictlyForwardOnly ()) {
439
454
throw ExceptionFactory .createException (Messages .getString ("ResultSet.ForwardOnly" ));
440
455
}
@@ -560,18 +575,6 @@ public void deleteRow() throws SQLException {
560
575
throw new NotUpdatable (Messages .getString ("NotUpdatable.0" ));
561
576
}
562
577
563
- /*
564
- * /**
565
- * TODO: Required by JDBC spec
566
- */
567
- /*
568
- * protected void finalize() throws Throwable {
569
- * if (!this.isClosed) {
570
- * realClose(false);
571
- * }
572
- * }
573
- */
574
-
575
578
@ Override
576
579
public int findColumn (String columnName ) throws SQLException {
577
580
synchronized (checkClosed ().getConnectionMutex ()) {
@@ -590,6 +593,11 @@ public int findColumn(String columnName) throws SQLException {
590
593
@ Override
591
594
public boolean first () throws SQLException {
592
595
synchronized (checkClosed ().getConnectionMutex ()) {
596
+ if (!hasRows ()) {
597
+ throw SQLError .createSQLException (Messages .getString ("ResultSet.ResultSet_is_from_UPDATE._No_Data_115" ),
598
+ MysqlErrorNumbers .SQL_STATE_GENERAL_ERROR , getExceptionInterceptor ());
599
+ }
600
+
593
601
if (isStrictlyForwardOnly ()) {
594
602
throw ExceptionFactory .createException (Messages .getString ("ResultSet.ForwardOnly" ));
595
603
}
@@ -1590,6 +1598,11 @@ public java.sql.Ref getRef(String colName) throws SQLException {
1590
1598
public int getRow () throws SQLException {
1591
1599
checkClosed ();
1592
1600
1601
+ if (!hasRows ()) {
1602
+ throw SQLError .createSQLException (Messages .getString ("ResultSet.ResultSet_is_from_UPDATE._No_Data_115" ), MysqlErrorNumbers .SQL_STATE_GENERAL_ERROR ,
1603
+ getExceptionInterceptor ());
1604
+ }
1605
+
1593
1606
int currentRowNumber = this .rowData .getPosition ();
1594
1607
int row = 0 ;
1595
1608
@@ -1692,29 +1705,46 @@ public void insertRow() throws SQLException {
1692
1705
@ Override
1693
1706
public boolean isAfterLast () throws SQLException {
1694
1707
synchronized (checkClosed ().getConnectionMutex ()) {
1695
- boolean b = this .rowData .isAfterLast ();
1696
-
1697
- return b ;
1708
+ if (!hasRows ()) {
1709
+ throw SQLError .createSQLException (Messages .getString ("ResultSet.ResultSet_is_from_UPDATE._No_Data_115" ),
1710
+ MysqlErrorNumbers .SQL_STATE_GENERAL_ERROR , getExceptionInterceptor ());
1711
+ }
1712
+ return this .rowData .isAfterLast ();
1698
1713
}
1699
1714
}
1700
1715
1701
1716
@ Override
1702
1717
public boolean isBeforeFirst () throws SQLException {
1703
1718
synchronized (checkClosed ().getConnectionMutex ()) {
1719
+ if (!hasRows ()) {
1720
+ throw SQLError .createSQLException (Messages .getString ("ResultSet.ResultSet_is_from_UPDATE._No_Data_115" ),
1721
+ MysqlErrorNumbers .SQL_STATE_GENERAL_ERROR , getExceptionInterceptor ());
1722
+ }
1723
+
1704
1724
return this .rowData .isBeforeFirst ();
1705
1725
}
1706
1726
}
1707
1727
1708
1728
@ Override
1709
1729
public boolean isFirst () throws SQLException {
1710
1730
synchronized (checkClosed ().getConnectionMutex ()) {
1731
+ if (!hasRows ()) {
1732
+ throw SQLError .createSQLException (Messages .getString ("ResultSet.ResultSet_is_from_UPDATE._No_Data_115" ),
1733
+ MysqlErrorNumbers .SQL_STATE_GENERAL_ERROR , getExceptionInterceptor ());
1734
+ }
1735
+
1711
1736
return this .rowData .isFirst ();
1712
1737
}
1713
1738
}
1714
1739
1715
1740
@ Override
1716
1741
public boolean isLast () throws SQLException {
1717
1742
synchronized (checkClosed ().getConnectionMutex ()) {
1743
+ if (!hasRows ()) {
1744
+ throw SQLError .createSQLException (Messages .getString ("ResultSet.ResultSet_is_from_UPDATE._No_Data_115" ),
1745
+ MysqlErrorNumbers .SQL_STATE_GENERAL_ERROR , getExceptionInterceptor ());
1746
+ }
1747
+
1718
1748
return this .rowData .isLast ();
1719
1749
}
1720
1750
}
@@ -1733,6 +1763,11 @@ protected boolean isStrictlyForwardOnly() {
1733
1763
@ Override
1734
1764
public boolean last () throws SQLException {
1735
1765
synchronized (checkClosed ().getConnectionMutex ()) {
1766
+ if (!hasRows ()) {
1767
+ throw SQLError .createSQLException (Messages .getString ("ResultSet.ResultSet_is_from_UPDATE._No_Data_115" ),
1768
+ MysqlErrorNumbers .SQL_STATE_GENERAL_ERROR , getExceptionInterceptor ());
1769
+ }
1770
+
1736
1771
if (isStrictlyForwardOnly ()) {
1737
1772
throw ExceptionFactory .createException (Messages .getString ("ResultSet.ForwardOnly" ));
1738
1773
}
@@ -1765,14 +1800,13 @@ public void moveToInsertRow() throws SQLException {
1765
1800
@ Override
1766
1801
public boolean next () throws SQLException {
1767
1802
synchronized (checkClosed ().getConnectionMutex ()) {
1768
-
1769
- boolean b ;
1770
-
1771
1803
if (!hasRows ()) {
1772
1804
throw SQLError .createSQLException (Messages .getString ("ResultSet.ResultSet_is_from_UPDATE._No_Data_115" ),
1773
1805
MysqlErrorNumbers .SQL_STATE_GENERAL_ERROR , getExceptionInterceptor ());
1774
1806
}
1775
1807
1808
+ boolean b ;
1809
+
1776
1810
if (this .rowData .size () == 0 ) {
1777
1811
b = false ;
1778
1812
} else {
@@ -1839,6 +1873,11 @@ public boolean prev() throws java.sql.SQLException {
1839
1873
@ Override
1840
1874
public boolean previous () throws SQLException {
1841
1875
synchronized (checkClosed ().getConnectionMutex ()) {
1876
+ if (!hasRows ()) {
1877
+ throw SQLError .createSQLException (Messages .getString ("ResultSet.ResultSet_is_from_UPDATE._No_Data_115" ),
1878
+ MysqlErrorNumbers .SQL_STATE_GENERAL_ERROR , getExceptionInterceptor ());
1879
+ }
1880
+
1842
1881
if (isStrictlyForwardOnly ()) {
1843
1882
throw ExceptionFactory .createException (Messages .getString ("ResultSet.ForwardOnly" ));
1844
1883
}
@@ -1961,6 +2000,11 @@ public void refreshRow() throws SQLException {
1961
2000
@ Override
1962
2001
public boolean relative (int rows ) throws SQLException {
1963
2002
synchronized (checkClosed ().getConnectionMutex ()) {
2003
+ if (!hasRows ()) {
2004
+ throw SQLError .createSQLException (Messages .getString ("ResultSet.ResultSet_is_from_UPDATE._No_Data_115" ),
2005
+ MysqlErrorNumbers .SQL_STATE_GENERAL_ERROR , getExceptionInterceptor ());
2006
+ }
2007
+
1964
2008
if (isStrictlyForwardOnly ()) {
1965
2009
throw ExceptionFactory .createException (Messages .getString ("ResultSet.ForwardOnly" ));
1966
2010
}
0 commit comments