Package java.sql

Examples of java.sql.Statement.cancel()


                conn.setAutoCommit(false);
                return "${text.result.autoCommitOff}";
            } else if (isBuiltIn(sql, "@cancel")) {
                stat = session.executingStatement;
                if (stat != null) {
                    stat.cancel();
                    buff.append("${text.result.statementWasCanceled}");
                } else {
                    buff.append("${text.result.noRunningStatement}");
                }
                return buff.toString();
View Full Code Here


    res.close();
    // A statement should be open even after ResultSet#close
    assertFalse(stmt.isClosed());
    // A Statement#cancel after ResultSet#close should be a no-op
    try {
      stmt.cancel();
    } catch(SQLException e) {
      failWithExceptionMsg(e);
    }
    stmt.close();
View Full Code Here

      @Override
      public void run() {
        try {
          Thread.sleep(1000);
          System.out.println("Cancelling query: ");
          stmt.cancel();
        } catch (Exception e) {
          // No-op
        }
      }
    });
View Full Code Here

      closedConn = getConnectionWithProps((String) null);
      cancelStmt = closedConn.createStatement();

      closedConn.close();

      cancelStmt.cancel();
    } finally {
      if (cancelStmt != null) {
        cancelStmt.close();
      }
View Full Code Here

                conn.setAutoCommit(false);
                return "${text.result.autoCommitOff}";
            } else if (isBuiltIn(sql, "@cancel")) {
                stat = session.executingStatement;
                if (stat != null) {
                    stat.cancel();
                    buff.append("${text.result.statementWasCanceled}");
                } else {
                    buff.append("${text.result.noRunningStatement}");
                }
                return buff.toString();
View Full Code Here

                sleep(5000);
              } catch (InterruptedException iEx) {
                // ignore
              }

              cancelStmt.cancel();
            } catch (SQLException sqlEx) {
              throw new RuntimeException(sqlEx.toString());
            }
          }
View Full Code Here

      closedConn = getConnectionWithProps((String)null);
      cancelStmt = closedConn.createStatement();
   
      closedConn.close();

      cancelStmt.cancel();
    } finally {
      if (cancelStmt != null) {
        cancelStmt.close();
      }
     
View Full Code Here

        Assert.assertEquals(1, dataSource.getActiveCount());
        Assert.assertEquals(0, dataSource.getErrorCount());

        Exception error = null;
        try {
            stmt.cancel();
        } catch (Exception e) {
            error = e;
        }
        Assert.assertNotNull(error);
View Full Code Here

    public void test_cancel() throws Exception {
        Connection conn = dataSource.getConnection();
        Statement stmt = conn.createStatement();

        stmt.cancel();
        ((DruidPooledStatement) stmt).getStatement().close();

        {
            SQLException error = null;
            try {
View Full Code Here

        ((DruidPooledStatement) stmt).getStatement().close();

        {
            SQLException error = null;
            try {
                stmt.cancel();
            } catch (SQLException ex) {
                error = ex;
            }
            Assert.assertNotNull(error);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.