コード例 #1
0
ファイル: JdbcConnection.java プロジェクト: projetaty/kernel
 /**
  * Closes this connection. All open statements, prepared statements and result sets that where
  * created by this connection become invalid after calling this method. If there is an uncommitted
  * transaction, it will be rolled back.
  */
 public synchronized void close() throws SQLException {
   try {
     debugCodeCall("close");
     openStackTrace = null;
     if (executingStatement != null) {
       executingStatement.cancel();
     }
     if (session == null) {
       return;
     }
     session.cancel();
     try {
       synchronized (session) {
         if (!session.isClosed()) {
           try {
             // roll back unless that would require to re-connect
             // (the transaction can't be rolled back after re-connecting)
             if (!session.isReconnectNeeded(true)) {
               rollbackInternal();
               session.afterWriting();
             }
             closePreparedCommands();
           } finally {
             session.close();
           }
         }
       }
     } finally {
       session = null;
     }
   } catch (Exception e) {
     throw logAndConvert(e);
   }
 }
コード例 #2
0
ファイル: MiscTest.java プロジェクト: golovnin/pgjdbc
 /**
  * Ensure the cancel call does not return before it has completed. Previously it did which
  * cancelled future queries.
  */
 public void testSingleThreadCancel() throws Exception {
   Connection con = TestUtil.openDB();
   Statement stmt = con.createStatement();
   for (int i = 0; i < 100; i++) {
     ResultSet rs = stmt.executeQuery("SELECT 1");
     rs.close();
     stmt.cancel();
   }
   TestUtil.closeDB(con);
 }
コード例 #3
0
 @Override
 public void cancelLastQuery() {
   try {
     if (lastQuery != null) {
       lastQuery.cancel();
     }
   } catch (SQLException e) {
     throw convert(e, "Cannot cancel query");
   } finally {
     lastQuery = null;
   }
 }
コード例 #4
0
 @Override
 public void run() {
   while (!stop) {
     try {
       Thread.sleep(wait);
       cancel.cancel();
       Thread.yield();
     } catch (SQLException e) {
       // ignore errors on closed statements
     } catch (Exception e) {
       TestBase.logError("sleep", e);
     }
   }
 }
コード例 #5
0
ファイル: JDBCEngine.java プロジェクト: josemachino/ontop
  @Override
  public void closeStatement() throws Exception {
    if (statement != null && !statement.isClosed()) {
      try {
        statement.cancel();
      } catch (Exception e) {

      }
      try {
        statement.close();
      } catch (Exception e) {

      }
    }
  }
コード例 #6
0
ファイル: StatementProxy.java プロジェクト: denuno/Lucee4
 @Override
 public void cancel() throws SQLException {
   stat.cancel();
 }
コード例 #7
0
ファイル: TraceStatement.java プロジェクト: markfussell/form
 public void cancel() throws SQLException {
   pst.cancel();
 };
コード例 #8
0
 @Override
 public void cancel() throws SQLException {
   inner.cancel();
 }
コード例 #9
0
 @Override
 public void cancel() throws SQLException {
   rawStatement.cancel();
 }