Package com.alibaba.wasp.jdbc.command

Examples of com.alibaba.wasp.jdbc.command.CommandInterface


  @Override
  public ResultSet executeQuery(String sql) throws SQLException {
    synchronized (session) {
      checkClosed();
      closeOldResultSet();
      CommandInterface command = conn.prepareCommand(sql, fetchSize, session);
      ResultInterface result = null;
      setExecutingStatement(command);
      try {
        result = command.executeQuery(maxRows);
        session.setSessionId(result.getSessionId());
      } finally {
        setExecutingStatement(null);
      }
      command.close();
      resultSet = new JdbcResultSet(conn, this, result, closedByResultSet);
    }
    return resultSet;
  }
View Full Code Here


        if(autoCommit) {
          throw new SQLException("batch only support without autoCommit mode");
        }

        closeOldResultSet();
        CommandInterface command = conn.prepareCommand(batchCommands, session);
        synchronized (session) {
          setExecutingStatement(command);
          try {
            updateCount = command.executeTransaction();
          } finally {
            setExecutingStatement(null);
          }
        }
        command.close();
        batchCommands = null;
        //wasp ensures all success or all failure
        for (int i = 0; i < result.length; i++) {
          result[i] = (updateCount == size) ? 1 : 0;
        }
View Full Code Here

  private int executeUpdateInternal(String sql) throws SQLException {
    checkClosedForWrite();
    try {
      closeOldResultSet();
      CommandInterface command = conn.prepareCommand(sql, fetchSize, session);
      synchronized (session) {
        setExecutingStatement(command);
        try {
          updateCount = command.executeUpdate();
        } finally {
          setExecutingStatement(null);
        }
      }
      command.close();
      return updateCount;
    } finally {
      afterWriting();
    }
  }
View Full Code Here

  private boolean executeInternal(String sql) throws SQLException {
    checkClosedForWrite();
    try {
      closeOldResultSet();
      CommandInterface command = conn.prepareCommand(sql, fetchSize, session);
      boolean returnsResultSet;
      synchronized (session) {
        setExecutingStatement(command);
        try {
          if (command.isQuery()) {
            returnsResultSet = true;
            ResultInterface result = command.executeQuery(maxRows);
            resultSet = new JdbcResultSet(conn, this, result, closedByResultSet);
          } else {
            returnsResultSet = false;
            updateCount = command.executeUpdate();
          }
        } finally {
          setExecutingStatement(null);
        }
      }
      command.close();
      return returnsResultSet;
    } finally {
      afterWriting();
    }
  }
View Full Code Here

TOP

Related Classes of com.alibaba.wasp.jdbc.command.CommandInterface

Copyright © 2018 www.massapicom. 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.