Package com.caucho.db.xa

Examples of com.caucho.db.xa.DbTransaction


   * Rebuilds the indexes
   */
  private void rebuildIndexes()
    throws IOException, SQLException
  {
    DbTransaction xa = DbTransaction.create();
    xa.setAutoCommit(true);

    try {
      TableIterator iter = createTableIterator();

      iter.init(xa);

      Column []columns = _row.getColumns();

      while (iter.nextBlock()) {
        iter.initRow();

        byte []blockBuffer = iter.getBuffer();

        while (iter.nextRow()) {
          try {
            long rowAddress = iter.getRowAddress();
            int rowOffset = iter.getRowOffset();

            for (int i = 0; i < columns.length; i++) {
              Column column = columns[i];

              /*
              if (column.getIndex() != null)
                System.out.println(Long.toHexString(iter.getBlock().getBlockId()) + ":" + Long.toHexString(rowAddress) + ":" + Long.toHexString(rowOffset) + ": " + column.getIndexKeyCompare().toString(blockBuffer, rowOffset + column.getColumnOffset(), column.getLength()));
              */

              column.setIndex(xa, blockBuffer, rowOffset, rowAddress, null);
            }
          } catch (Exception e) {
            log.log(Level.WARNING, e.toString(), e);
          }
        }
      }
    } finally {
      xa.commit();
    }
  }
View Full Code Here


   * Rebuilds the indexes
   */
  public void validateIndexes()
    throws IOException, SQLException
  {
    DbTransaction xa = DbTransaction.create();
    xa.setAutoCommit(true);

    TableIterator iter = null;
   
    try {
      iter = createTableIterator();

      iter.init(xa);

      Column []columns = _row.getColumns();

      while (iter.nextBlock()) {
        iter.initRow();

        byte []blockBuffer = iter.getBuffer();

        while (iter.nextRow()) {
          try {
            long rowAddress = iter.getRowAddress();
            int rowOffset = iter.getRowOffset();

            for (int i = 0; i < columns.length; i++) {
              Column column = columns[i];

              column.validateIndex(xa, blockBuffer, rowOffset, rowAddress);
            }
          } catch (Exception e) {
            log.log(Level.WARNING, e.toString(), e);
          }
        }
      }
    } finally {
      if (iter != null)
        iter.free();
     
      xa.commit();
     
    }
  }
View Full Code Here

    if (thread != null && thread != Thread.currentThread()) {
      throw new IllegalStateException();
    }
   
    DbTransaction xa = _xa;
    _xa = null;
   
    // db/0a10
    if (xa != null && xa.isAutoCommit())
      xa.commit();
  }
View Full Code Here

   */
  @Override
  public void updateString(QueryContext context, String value)
    throws SQLException
  {
    DbTransaction xa = context.getTransaction();
    TableIterator []rows = context.getTableIterators();
    TableIterator row = rows[_tableIndex];

    row.setString(xa, _column, value);
  }
View Full Code Here

   */
  @Override
  public void updateLong(QueryContext context, long value)
    throws SQLException
  {
    DbTransaction xa = context.getTransaction();
    TableIterator []rows = context.getTableIterators();
    TableIterator row = rows[_tableIndex];

    row.setLong(xa, _column, value);
  }
View Full Code Here

   */
  @Override
  public void updateDouble(QueryContext context, double value)
    throws SQLException
  {
    DbTransaction xa = context.getTransaction();
    TableIterator []rows = context.getTableIterators();
    TableIterator row = rows[_tableIndex];

    row.setDouble(xa, _column, value);
  }
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.