@@ -41,7 +41,7 @@ public class StatementImpl implements Statement, JdbcV2Wrapper {
41
41
private String lastStatementSql ;
42
42
private ParsedStatement parsedStatement ;
43
43
protected volatile String lastQueryId ;
44
- private int maxRows ;
44
+ private long maxRows ;
45
45
protected QuerySettings localSettings ;
46
46
47
47
public StatementImpl (ConnectionImpl connection ) throws SQLException {
@@ -240,20 +240,12 @@ public void setMaxFieldSize(int max) throws SQLException {
240
240
@ Override
241
241
public int getMaxRows () throws SQLException {
242
242
ensureOpen ();
243
- return maxRows ;
243
+ return ( int ) getLargeMaxRows (); // skip overflow check.
244
244
}
245
245
246
246
@ Override
247
247
public void setMaxRows (int max ) throws SQLException {
248
- ensureOpen ();
249
- maxRows = max ;
250
- if (max > 0 ) {
251
- localSettings .setOption (ClientConfigProperties .serverSetting (ServerSettings .MAX_RESULT_ROWS ), maxRows );
252
- localSettings .setOption (ClientConfigProperties .serverSetting (ServerSettings .RESULT_OVERFLOW_MODE ), "break" );
253
- } else {
254
- localSettings .resetOption (ClientConfigProperties .serverSetting (ServerSettings .MAX_RESULT_ROWS ));
255
- localSettings .resetOption (ClientConfigProperties .serverSetting (ServerSettings .RESULT_OVERFLOW_MODE ));
256
- }
248
+ setLargeMaxRows (max );
257
249
}
258
250
259
251
@ Override
@@ -509,13 +501,20 @@ public long getLargeUpdateCount() throws SQLException {
509
501
@ Override
510
502
public void setLargeMaxRows (long max ) throws SQLException {
511
503
ensureOpen ();
512
- Statement .super .setLargeMaxRows (max );
504
+ maxRows = max ;
505
+ if (max > 0 ) {
506
+ localSettings .setOption (ClientConfigProperties .serverSetting (ServerSettings .MAX_RESULT_ROWS ), maxRows );
507
+ localSettings .setOption (ClientConfigProperties .serverSetting (ServerSettings .RESULT_OVERFLOW_MODE ), "break" );
508
+ } else {
509
+ localSettings .resetOption (ClientConfigProperties .serverSetting (ServerSettings .MAX_RESULT_ROWS ));
510
+ localSettings .resetOption (ClientConfigProperties .serverSetting (ServerSettings .RESULT_OVERFLOW_MODE ));
511
+ }
513
512
}
514
513
515
514
@ Override
516
515
public long getLargeMaxRows () throws SQLException {
517
516
ensureOpen ();
518
- return getMaxRows () ;
517
+ return this . maxRows ;
519
518
}
520
519
521
520
@ Override
0 commit comments