示例#1
0
  public void close() throws SQLException {
    Thread thread = _thread;
    _thread = null;

    unlock();

    if (thread != null && thread != Thread.currentThread()) {
      throw new IllegalStateException();
    }

    DbTransaction xa = _xa;
    _xa = null;

    // db/0a10
    if (xa != null && xa.isAutoCommit()) xa.commit();
  }
示例#2
0
  /** Executes the query. */
  public boolean exists(QueryContext context, DbTransaction xa) throws SQLException {
    SelectResult result = SelectResult.create(_nullExprs, null);

    try {
      TableIterator[] rows = result.initRows(getFromItems());
      context.init(xa, rows, isReadOnly());

      return execute(result, rows, context, xa);
    } catch (IOException e) {
      throw new SQLExceptionWrapper(e);
    } finally {
      context.unlock();

      result.close();
    }
  }