Package com.caucho.db.xa

Examples of com.caucho.db.xa.DbTransaction


  private java.sql.ResultSet executeQuery(Query query,
                                          QueryContext queryContext)
    throws SQLException
  {
    DbTransaction xa = getConnectionImpl().getTransaction();
   
    queryContext.setNonLocking();
   
    SelectCursor result = query.executeCursor(queryContext, xa);
   
View Full Code Here


  }

  public DbTransaction getTransaction()
  {
    if (_isAutoCommit) {
      DbTransaction xa = DbTransaction.create(this);
      // XXX: value?
      // xa.setTransactionTimeout(15000);
      xa.setAutoCommit(true);
      return xa;
    }
    else if (_xa == null) {
      _xa = DbTransaction.create(this);
     
View Full Code Here

    throws SQLException
  {
    if (log.isLoggable(Level.FINER))
      log.finer("commit " + this + " " + _xa);
   
    DbTransaction xa = _xa;
    _xa = null;
   
    if (xa != null)
      xa.commit();
  }
View Full Code Here

  }

  public void rollback()
    throws SQLException
  {
    DbTransaction xa = _xa;
    _xa = null;

    if (xa != null) {
      if (log.isLoggable(Level.FINER))
        log.finer("rollback " + this + " " + _xa);
   
      xa.rollback();
    }
  }
View Full Code Here

  public void setAutoCommit(boolean autoCommit)
    throws SQLException
  {
    if (! _isAutoCommit && autoCommit) {
      DbTransaction xa = _xa;
      _xa = null;
   
      if (xa != null)
        xa.commit();
    }
   
    _isAutoCommit = autoCommit;
  }
View Full Code Here

   * @return the number of rows modified
   */
  private int executeUpdate(Query query)
    throws SQLException
  {
    DbTransaction xa = _conn.getTransaction();
    boolean isOkay = false;

    int rowUpdateCount = 0;

    try {
      _queryContext.setTransaction(xa);

      query.execute(_queryContext, xa);

      rowUpdateCount = _queryContext.getRowUpdateCount();

      isOkay = true;
    } finally {
      if (! xa.isAutoCommit()) {
      }
      else if (isOkay)
        xa.commit();
      else
        xa.rollback();
    }

    return rowUpdateCount;
  }
View Full Code Here

  private java.sql.ResultSet executeQuery(Query query,
                                          QueryContext queryContext)
    throws SQLException
  {
    DbTransaction xa = getConnectionImpl().getTransaction();
   
    queryContext.setNonLocking();
   
    SelectCursor result = query.executeCursor(queryContext, xa);
View Full Code Here

  private java.sql.ResultSet executeQuery(Query query,
                                          QueryContext queryContext)
    throws SQLException
  {
    DbTransaction xa = _conn.getTransaction();

    boolean isOkay = false;
    try {
      query.execute(queryContext, xa);
      isOkay = true;
    } finally {
      if (! xa.isAutoCommit()) {
      }
      else if (isOkay)
        xa.commit();
      else
        xa.rollback();
    }

    _rs = new ResultSetImpl(this, queryContext.getResult());

    return _rs;
View Full Code Here

  public boolean execute()
    throws SQLException
  {
    _count++;

    DbTransaction xa = null;

    try {
      if (_count != 1)
        throw new IllegalStateException("Multithreading execute");

      xa = _conn.getTransaction();
      QueryContext queryContext = getQueryContext();

      if (_query.isSelect()) {
        _query.execute(queryContext, xa);

        _wasResultSet = true;
        _resultSet = new ResultSetImpl(this, queryContext.getResult());

        return true;
      }
      else {
        queryContext.setReturnGeneratedKeys(_isReturnGeneratedKeys);

        _query.execute(queryContext, xa);

        _wasResultSet = false;
        return false;
      }
    } finally {
      _count--;

      if (xa != null && xa.isAutoCommit())
        xa.rollback();
    }
  }
View Full Code Here

  }

  class IndexCacheWriter extends TaskWorker {
    public long runTask()
    {
      DbTransaction xa = DbTransaction.create();
     
      try {
        IndexKey key = null;

        Thread.interrupted();
View Full Code Here

TOP

Related Classes of com.caucho.db.xa.DbTransaction

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.