1 21 22 package org.apache.derby.impl.jdbc; 23 24 import org.apache.derby.iapi.reference.JDBC20Translation; 25 import org.apache.derby.iapi.reference.JDBC30Translation; 26 import org.apache.derby.iapi.reference.SQLState; 27 28 import org.apache.derby.iapi.services.sanity.SanityManager; 29 30 import org.apache.derby.iapi.sql.Activation; 31 import org.apache.derby.iapi.sql.PreparedStatement; 32 import org.apache.derby.iapi.sql.ResultSet; 33 import org.apache.derby.iapi.sql.ParameterValueSet; 34 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext; 35 import org.apache.derby.iapi.error.StandardException; 36 import org.apache.derby.iapi.jdbc.EngineStatement; 37 38 import java.sql.SQLException ; 39 import java.sql.SQLWarning ; 40 import java.util.Vector ; 41 42 47 48 62 public class EmbedStatement extends ConnectionChild 63 implements EngineStatement { 64 65 private final java.sql.Connection applicationConnection; 66 67 77 protected EngineStatement applicationStatement; 78 79 int updateCount = -1; 80 java.sql.ResultSet results; 81 private java.sql.ResultSet autoGeneratedKeysResultSet; 84 private String cursorName; 85 86 private final boolean forMetaData; 87 final int resultSetType; 88 private final int resultSetConcurrency; 89 private final int resultSetHoldability; 90 final LanguageConnectionContext lcc; 91 92 private SQLWarning warnings; 93 String SQLText; 94 95 private int fetchSize = 1; 96 private int fetchDirection = JDBC20Translation.FETCH_FORWARD; 97 int MaxFieldSize; 98 private int timeoutSeconds; 99 100 private boolean active = true; 102 103 Vector batchStatements; 106 107 int maxRows; 110 111 private ParameterValueSet pvs; 112 113 protected boolean isPoolable = false; 116 117 public EmbedStatement (EmbedConnection connection, boolean forMetaData, 121 int resultSetType, int resultSetConcurrency, int resultSetHoldability) 122 { 123 super(connection); 124 this.forMetaData = forMetaData; 125 this.resultSetType = resultSetType; 126 this.resultSetConcurrency = resultSetConcurrency; 127 this.resultSetHoldability = resultSetHoldability; 128 129 lcc = getEmbedConnection().getLanguageConnection(); 130 applicationConnection = getEmbedConnection().getApplicationConnection(); 131 applicationStatement = this; 132 133 timeoutSeconds = 0; 136 } 137 138 143 151 public java.sql.ResultSet executeQuery(String sql) 152 throws SQLException 153 { 154 execute(sql, true, false, JDBC30Translation.NO_GENERATED_KEYS, null, null); 155 156 if (SanityManager.DEBUG) { 157 if (results == null) 158 SanityManager.THROWASSERT("no results returned on executeQuery()"); 159 } 160 161 return results; 162 } 163 164 175 public int executeUpdate(String sql) throws SQLException 176 { 177 execute(sql, false, true, JDBC30Translation.NO_GENERATED_KEYS, null, null); 178 return updateCount; 179 } 180 181 197 public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException 198 { 199 execute(sql, false, true, autoGeneratedKeys, null, null); 200 return updateCount; 201 } 202 203 219 public int executeUpdate(String sql, int[] columnIndexes) throws SQLException 220 { 221 throw Util.notImplemented("executeUpdate(String, int[])"); 222 } 223 224 240 public int executeUpdate(String sql, String [] columnNames) throws SQLException 241 { 242 throw Util.notImplemented("executeUpdate(String, String[])"); 243 } 244 245 final void checkIfInMiddleOfBatch() throws SQLException { 246 251 if (batchStatements != null) 252 throw newSQLException(SQLState.MIDDLE_OF_BATCH); 253 } 254 255 261 public boolean isClosed() throws SQLException { 262 if (active) { 264 try { 265 checkExecStatus(); 266 } catch (SQLException sqle) { 267 } 268 } 269 return !active; 270 } 271 272 283 public final void close() throws SQLException { 284 285 289 if (!active) 290 { 291 return; 292 } 293 294 synchronized (getConnectionSynchronization()) { 295 296 closeActions(); 297 298 active = false; 300 301 clearResultSets(); 303 304 cursorName = null; 306 warnings = null; 307 SQLText = null; 308 batchStatements = null; 309 } 310 } 311 312 void closeActions() throws SQLException { 315 } 316 317 319 329 public int getMaxFieldSize() throws SQLException { 330 checkStatus(); 331 332 return MaxFieldSize; 333 } 334 335 345 public void setMaxFieldSize(int max) throws SQLException { 346 checkStatus(); 347 348 if (max < 0) 349 { 350 throw newSQLException(SQLState.INVALID_MAXFIELD_SIZE, new Integer (max)); 351 } 352 this.MaxFieldSize = max; 353 } 354 355 363 public int getMaxRows() throws SQLException 364 { 365 checkStatus(); 366 return maxRows; 367 } 368 369 377 public void setMaxRows(int max) throws SQLException 378 { 379 checkStatus(); 380 if (max < 0) 381 { 382 throw newSQLException(SQLState.INVALID_MAX_ROWS_VALUE, new Integer (max)); 383 } 384 this.maxRows = max; 385 } 386 387 394 public void setEscapeProcessing(boolean enable) throws SQLException { 395 checkStatus(); 396 398 } 399 400 408 public final int getQueryTimeout() throws SQLException { 409 checkStatus(); 410 return timeoutSeconds; 411 } 412 413 421 public final void setQueryTimeout(int seconds) throws SQLException { 422 checkStatus(); 423 if (seconds < 0) { 424 throw newSQLException(SQLState.INVALID_QUERYTIMEOUT_VALUE, 425 new Integer (seconds)); 426 } 427 timeoutSeconds = seconds; 428 } 429 430 435 public void cancel() throws SQLException { 436 throw Util.notImplemented("cancel"); 437 } 438 439 455 public SQLWarning getWarnings() throws SQLException { 456 checkStatus(); 457 return warnings; 458 } 459 460 465 public void clearWarnings() throws SQLException { 466 checkStatus(); 467 warnings = null; 468 } 469 470 485 public void setCursorName(String name) throws SQLException { 486 checkStatus(); 487 cursorName = name; 488 } 489 490 492 514 public boolean execute(String sql) 515 throws SQLException 516 { 517 return execute(sql, false, false, JDBC30Translation.NO_GENERATED_KEYS, null, null); 518 } 519 520 547 private boolean execute(String sql, boolean executeQuery, boolean executeUpdate, 548 int autoGeneratedKeys, int[] columnIndexes, String [] columnNames) throws SQLException 549 { 550 synchronized (getConnectionSynchronization()) { 551 552 checkExecStatus(); 553 if (sql == null) { 554 throw newSQLException(SQLState.NULL_SQL_TEXT); 555 } 556 checkIfInMiddleOfBatch(); 557 clearResultSets(); 559 setupContextStack(); 561 562 SQLText = sql; 564 565 try { 566 Activation activation; 567 try { 568 PreparedStatement preparedStatement = lcc.prepareInternalStatement 569 (lcc.getDefaultSchema(), sql, resultSetConcurrency==JDBC20Translation.CONCUR_READ_ONLY, false); 570 activation = 571 preparedStatement.getActivation(lcc, resultSetType == JDBC20Translation.TYPE_SCROLL_INSENSITIVE); 572 checkRequiresCallableStatement(activation); 573 } catch (Throwable t) { 574 throw handleException(t); 575 } 576 577 578 activation.setSingleExecution(); 580 581 if (autoGeneratedKeys == JDBC30Translation.RETURN_GENERATED_KEYS) 584 activation.setAutoGeneratedKeysResultsetInfo(columnIndexes, columnNames); 585 return executeStatement(activation, executeQuery, executeUpdate); 586 } finally { 587 restoreContextStack(); 588 } 589 } 590 } 591 592 609 public boolean execute(String sql, int autoGeneratedKeys) throws SQLException 610 { 611 return execute(sql, false, false, autoGeneratedKeys, null, null); 612 } 613 614 633 public boolean execute(String sql, int[] columnIndexes) throws SQLException 634 { 635 throw Util.notImplemented("execute(String, int[])"); 636 } 637 638 657 public boolean execute(String sql, String [] columnNames) throws SQLException 658 { 659 throw Util.notImplemented("execute(String, String[])"); 660 } 661 662 671 public final java.sql.ResultSet getResultSet() throws SQLException { 672 checkStatus(); 673 674 return results; 675 } 676 677 691 public final int getUpdateCount() throws SQLException { 692 checkStatus(); 693 return updateCount; 694 } 695 696 709 public final boolean getMoreResults() throws SQLException { 710 return getMoreResults(JDBC30Translation.CLOSE_ALL_RESULTS); 711 } 712 713 723 730 public final int getResultSetType() 731 throws SQLException 732 { 733 checkStatus(); 734 return resultSetType; 735 } 736 737 738 751 public void setFetchDirection(int direction) throws SQLException { 752 753 checkStatus(); 754 757 if (direction == JDBC20Translation.FETCH_FORWARD || 758 direction == JDBC20Translation.FETCH_REVERSE || 759 direction == JDBC20Translation.FETCH_UNKNOWN ) 760 { 761 fetchDirection = direction; 762 }else 763 throw newSQLException(SQLState.INVALID_FETCH_DIRECTION, 764 new Integer (direction)); 765 } 766 767 775 public int getFetchDirection() throws SQLException { 776 checkStatus(); 777 return fetchDirection; 778 } 779 780 781 794 public void setFetchSize(int rows) throws SQLException { 795 checkStatus(); 796 if (rows < 0 || (this.getMaxRows() != 0 && 797 rows > this.getMaxRows())) 798 { 799 throw newSQLException(SQLState.INVALID_ST_FETCH_SIZE, new Integer (rows)); 800 }else if ( rows > 0 ) fetchSize = rows; 802 } 803 804 811 public int getFetchSize() throws SQLException { 812 checkStatus(); 813 return fetchSize; 814 } 815 816 823 public int getResultSetConcurrency() throws SQLException { 824 checkStatus(); 825 return resultSetConcurrency; 826 } 827 828 838 public final int getResultSetHoldability() throws SQLException { 839 checkStatus(); 840 return resultSetHoldability; 841 } 842 843 853 public void addBatch( String sql ) throws SQLException { 854 checkStatus(); 855 synchronized (getConnectionSynchronization()) { 856 if (batchStatements == null) 857 batchStatements = new Vector (); 858 batchStatements.addElement(sql); 859 } 860 } 861 862 871 public final void clearBatch() throws SQLException { 872 checkStatus(); 873 synchronized (getConnectionSynchronization()) { 874 batchStatements = null; 875 } 876 } 877 878 897 public int[] executeBatch() throws SQLException { 898 checkExecStatus(); 899 synchronized (getConnectionSynchronization()) 900 { 901 setupContextStack(); 902 int i = 0; 903 clearResultSets(); 909 910 Vector stmts = batchStatements; 911 batchStatements = null; 912 int size; 913 if (stmts == null) 914 size = 0; 915 else 916 size = stmts.size(); 917 918 int[] returnUpdateCountForBatch = new int[size]; 919 920 SQLException sqle; 921 try { 922 for (; i< size; i++) 923 { 924 if (executeBatchElement(stmts.elementAt(i))) 925 throw newSQLException(SQLState.RESULTSET_RETURN_NOT_ALLOWED); 926 returnUpdateCountForBatch[i] = getUpdateCount(); 927 } 928 return returnUpdateCountForBatch; 929 } 930 catch (StandardException se) { 931 932 sqle = handleException(se); 933 } 934 catch (SQLException sqle2) 935 { 936 sqle = sqle2; 937 } 938 finally 939 { 940 restoreContextStack(); 941 } 942 943 int successfulUpdateCount[] = new int[i]; 944 for (int j=0; j<i; j++) 945 { 946 successfulUpdateCount[j] = returnUpdateCountForBatch[j]; 947 } 948 949 SQLException batch = 950 new java.sql.BatchUpdateException (sqle.getMessage(), sqle.getSQLState(), 951 sqle.getErrorCode(), successfulUpdateCount); 952 953 batch.setNextException(sqle); 954 throw batch; 955 } 956 } 957 958 961 boolean executeBatchElement(Object batchElement) throws SQLException , StandardException { 962 return execute((String )batchElement, false, true, JDBC30Translation.NO_GENERATED_KEYS, null, null); 963 } 964 965 973 public final java.sql.Connection getConnection() throws SQLException { 974 checkStatus(); 975 976 java.sql.Connection appConn = getEmbedConnection().getApplicationConnection(); 977 if ((appConn != applicationConnection) || (appConn == null)) { 978 979 throw Util.noCurrentConnection(); 980 } 981 return appConn; 982 } 983 984 999 public final boolean getMoreResults(int current) throws SQLException { 1000 checkExecStatus(); 1001 1002 synchronized (getConnectionSynchronization()) { 1003 if (dynamicResults == null) { 1004 clearResultSets(); 1007 return false; 1008 } 1009 1010 int startingClose; 1011 switch (current) { 1012 default: 1013 case JDBC30Translation.CLOSE_ALL_RESULTS: 1014 startingClose = 0; 1015 break; 1016 case JDBC30Translation.CLOSE_CURRENT_RESULT: 1017 startingClose = currentDynamicResultSet; 1019 break; 1020 case JDBC30Translation.KEEP_CURRENT_RESULT: 1021 startingClose = dynamicResults.length; 1023 break; 1024 } 1025 1026 SQLException se = null; 1028 for (int i = startingClose; i <= currentDynamicResultSet && i < dynamicResults.length; i++) { 1029 EmbedResultSet lrs = dynamicResults[i]; 1030 if (lrs == null) 1031 continue; 1032 1033 1034 try { 1035 lrs.close(); 1036 } catch (SQLException sqle) { 1037 if (se == null) 1038 se = sqle; 1039 else 1040 se.setNextException(sqle); 1041 } finally { 1042 dynamicResults[i] = null; 1043 } 1044 } 1045 1046 if (se != null) { 1047 throw se; 1049 } 1050 1051 updateCount = -1; 1052 1053 while (++currentDynamicResultSet < dynamicResults.length) { 1054 1055 EmbedResultSet lrs = dynamicResults[currentDynamicResultSet]; 1056 if (lrs != null) { 1057 if (lrs.isClosed) { 1058 dynamicResults[currentDynamicResultSet] = null; 1059 continue; 1060 } 1061 1062 results = lrs; 1063 1064 return true; 1065 } 1066 } 1067 1068 results = null; 1069 return false; 1070 } 1071 } 1072 1073 1084 public final java.sql.ResultSet getGeneratedKeys() throws SQLException { 1085 checkStatus(); 1086 if (autoGeneratedKeysResultSet == null) 1087 return null; 1088 else { 1089 execute("VALUES IDENTITY_VAL_LOCAL()", true, false, JDBC30Translation.NO_GENERATED_KEYS, null, null); 1090 return results; 1091 } 1092 } 1093 1094 1100 1104 boolean executeStatement(Activation a, 1105 boolean executeQuery, boolean executeUpdate) 1106 throws SQLException { 1107 1108 1111 1117 synchronized (getConnectionSynchronization()) { 1118 setupContextStack(); boolean retval; 1120 1121 pvs = a.getParameterValueSet(); 1122 1123 try { 1124 if (results != null) { 1131 results.close(); 1132 results = null; 1133 } 1134 1135 clearWarnings(); 1136 1137 if (! forMetaData) { 1138 commitIfNeeded(); needCommit(); 1140 } else { 1141 1142 1143 if (lcc.getActivationCount() > 1) { 1144 } else { 1147 commitIfNeeded(); needCommit(); 1149 } 1150 } 1151 1152 PreparedStatement ps = a.getPreparedStatement(); 1155 ps.rePrepare(lcc); 1156 addWarning(ps.getCompileTimeWarnings()); 1157 1158 1159 1167 1168 if (cursorName != null) 1169 { 1170 a.setCursorName(cursorName); 1171 } 1172 1173 boolean executeHoldable = getExecuteHoldable(); 1174 1175 a.setResultSetHoldability(executeHoldable); 1176 1177 a.reset(); 1180 a.setMaxRows(maxRows); 1181 long timeoutMillis = (long)timeoutSeconds * 1000L; 1182 ResultSet resultsToWrap = ps.execute(a, 1183 false, 1184 timeoutMillis); 1185 addWarning(a.getWarnings()); 1186 1187 1188 if (resultsToWrap.returnsRows()) { 1189 1190 if (executeUpdate) { 1193 throw StandardException.newException( 1194 SQLState.LANG_INVALID_CALL_TO_EXECUTE_UPDATE); 1195 } 1196 1197 EmbedResultSet lresults = factory.newEmbedResultSet(getEmbedConnection(), resultsToWrap, forMetaData, this, ps.isAtomic()); 1198 results = lresults; 1199 1200 1201 if (a.isSingleExecution()) 1206 lresults.singleUseActivation = a; 1207 1208 updateCount = -1; 1209 retval = true; 1210 } 1211 else { 1212 1213 if (a.getAutoGeneratedKeysResultsetMode() && (resultsToWrap.getAutoGeneratedKeysResultset() != null)) 1216 { 1217 resultsToWrap.getAutoGeneratedKeysResultset().open(); 1218 autoGeneratedKeysResultSet = factory.newEmbedResultSet(getEmbedConnection(), 1219 resultsToWrap.getAutoGeneratedKeysResultset(), false, this, ps.isAtomic()); 1220 } 1221 1222 updateCount = resultsToWrap.modifiedRowCount(); 1223 1224 resultsToWrap.finish(); results = null; 1227 int dynamicResultCount = 0; 1228 if (a.getDynamicResults() != null) { 1229 dynamicResultCount = 1230 processDynamicResults(a.getDynamicResults(), 1231 a.getMaxDynamicResults()); 1232 } 1233 1234 if (executeQuery && dynamicResultCount != 1) { 1237 throw StandardException.newException( 1238 SQLState.LANG_INVALID_CALL_TO_EXECUTE_QUERY); 1239 } 1240 1241 if (executeUpdate && dynamicResultCount > 0) { 1244 throw StandardException.newException( 1245 SQLState.LANG_INVALID_CALL_TO_EXECUTE_UPDATE); 1246 } 1247 1248 if (dynamicResultCount == 0) { 1249 if (a.isSingleExecution()) { 1250 a.close(); 1251 } 1252 1253 if (!forMetaData) 1254 commitIfNeeded(); 1255 else { 1256 1257 if (lcc.getActivationCount() > 1) { 1258 } else { 1261 commitIfNeeded(); } 1263 } 1264 } 1265 1266 retval = (dynamicResultCount > 0); 1267 } 1268 } catch (Throwable t) { 1269 if (a.isSingleExecution()) { 1270 try { a.close(); } catch (Throwable tt) {;} 1271 } 1272 throw handleException(t); 1273 } finally { 1274 restoreContextStack(); 1275 } 1276 return retval; 1277 } 1278 } 1279 1280 1287 final void addWarning(SQLWarning sw) 1288 { 1289 if (sw != null) { 1290 if (warnings == null) 1291 warnings = sw; 1292 else 1293 warnings.setNextException(sw); 1294 } 1295 } 1296 1297 1298 1299 public String getSQLText() 1300 { 1301 return SQLText; 1304 } 1305 1306 public ParameterValueSet getParameterValueSet() 1307 { 1308 return pvs; 1309 } 1310 1311 1322 final void checkStatus() throws SQLException { 1323 if (!active) { 1324 java.sql.Connection appConn = getEmbedConnection().getApplicationConnection(); 1328 if (appConn == null || appConn.isClosed()) { 1329 throw Util.noCurrentConnection(); 1330 } 1331 1332 throw newSQLException(SQLState.ALREADY_CLOSED, "Statement"); 1333 } 1334 } 1335 1336 1366 final void checkExecStatus() throws SQLException { 1367 if (!getConnection().isClosed()) 1369 return; 1370 1371 active = false; 1374 1375 throw Util.noCurrentConnection(); 1376 } 1377 1378 1382 void clearResultSets() throws SQLException { 1383 1384 SQLException sqle = null; 1385 1386 try { 1387 if (results != null) { 1391 results.close(); 1392 results = null; 1393 } 1394 } catch (SQLException s1) { 1395 sqle = s1; 1396 } 1397 1398 try { 1399 if (autoGeneratedKeysResultSet != null) { 1400 autoGeneratedKeysResultSet.close(); 1401 autoGeneratedKeysResultSet = null; 1402 } 1403 } catch (SQLException sauto) { 1404 if (sqle == null) 1405 sqle = sauto; 1406 else 1407 sqle.setNextException(sauto); 1408 } 1409 1410 if (dynamicResults != null) { 1412 for (int i = 0; i < dynamicResults.length; i++) { 1413 EmbedResultSet lrs = dynamicResults[i]; 1414 if (lrs == null) 1415 continue; 1416 1417 try { 1418 lrs.close(); 1419 } catch (SQLException sdynamic) { 1420 if (sqle == null) 1421 sqle = sdynamic; 1422 else 1423 sqle.setNextException(sdynamic); 1424 } 1425 } 1426 dynamicResults = null; 1427 } 1428 1429 1434 1435 updateCount = -1; 1437 if (sqle != null) 1438 throw sqle; 1439 } 1440 1441 1444 void checkRequiresCallableStatement(Activation activation) throws SQLException { 1445 1446 ParameterValueSet pvs = activation.getParameterValueSet(); 1447 1448 if (pvs == null) 1449 return; 1450 1451 if (pvs.checkNoDeclaredOutputParameters()) { 1452 try { 1453 activation.close(); 1454 } catch (StandardException se) { 1455 } 1456 throw newSQLException(SQLState.REQUIRES_CALLABLE_STATEMENT, SQLText); 1457 } 1458 } 1459 1460 1463 public void transferBatch(EmbedStatement other) throws SQLException { 1464 1465 synchronized (getConnectionSynchronization()) { 1466 other.batchStatements = batchStatements; 1467 batchStatements = null; 1468 } 1469 } 1470 1471 1474 public final void setApplicationStatement(EngineStatement s) { 1475 this.applicationStatement = s; 1476 } 1477 1478 private EmbedResultSet[] dynamicResults; 1479 private int currentDynamicResultSet; 1480 1481 1492 private int processDynamicResults(java.sql.ResultSet [][] holder, 1493 int maxDynamicResultSets) 1494 throws SQLException 1495 { 1496 1497 EmbedResultSet[] sorted = new EmbedResultSet[holder.length]; 1498 1499 int actualCount = 0; 1500 for (int i = 0; i < holder.length; i++) { 1501 1502 java.sql.ResultSet [] param = holder[i]; 1503 1504 if (param[0] == null) 1505 continue; 1506 1507 java.sql.ResultSet rs = param[0]; 1508 param[0] = null; 1509 1510 if (!(rs instanceof EmbedResultSet)) 1512 continue; 1513 1514 EmbedResultSet lrs = (EmbedResultSet) rs; 1515 1516 if (lrs.getEmbedConnection().rootConnection != getEmbedConnection().rootConnection) 1517 continue; 1518 1519 if (lrs.isClosed) 1521 continue; 1522 1523 lrs.setDynamicResultSet(this); 1524 sorted[actualCount++] = lrs; 1525 } 1526 1527 if (actualCount != 0) { 1528 1529 if (actualCount != 1) { 1531 java.util.Arrays.sort(sorted, 0, actualCount); 1532 } 1533 1534 dynamicResults = sorted; 1535 1536 if (actualCount > maxDynamicResultSets) { 1537 addWarning(StandardException.newWarning(SQLState.LANG_TOO_MANY_DYNAMIC_RESULTS_RETURNED)); 1538 1539 for (int i = maxDynamicResultSets; i < actualCount; i++) { 1540 sorted[i].close(); 1541 sorted[i] = null; 1542 } 1543 1544 actualCount = maxDynamicResultSets; 1545 } 1546 1547 1548 updateCount = -1; 1549 results = sorted[0]; 1550 currentDynamicResultSet = 0; 1551 1552 } 1555 1556 1557 return actualCount; 1558 } 1559 1560 1568 void resultSetClosing(EmbedResultSet closingLRS) throws SQLException { 1569 1570 if (!getEmbedConnection().autoCommit) 1573 return; 1574 1575 if (dynamicResults != null) { 1578 for (int i = 0; i < dynamicResults.length; i++) { 1579 EmbedResultSet lrs = dynamicResults[i]; 1580 if (lrs == null) 1581 continue; 1582 if (lrs.isClosed) 1583 continue; 1584 if (lrs == closingLRS) 1585 continue; 1586 1587 return; 1589 } 1590 } 1591 1592 1594 commitIfAutoCommit(); 1598 } 1599 1600 1605 private boolean getExecuteHoldable() throws SQLException 1606 { 1607 if (resultSetHoldability == JDBC30Translation.CLOSE_CURSORS_AT_COMMIT) 1608 return false; 1609 1610 if (applicationStatement == this) 1612 return true; 1613 1614 return applicationStatement.getResultSetHoldability() == 1615 JDBC30Translation.HOLD_CURSORS_OVER_COMMIT; 1616 } 1617 1618 1625 1626 public boolean isPoolable() throws SQLException { 1627 checkStatus(); 1629 1630 return isPoolable; 1631 } 1632 1633 1640 1641 public void setPoolable(boolean poolable) throws SQLException { 1642 checkStatus(); 1644 1645 isPoolable = poolable; 1646 } 1647} 1648 1649 | Popular Tags |