Package com.caucho.db.index

Examples of com.caucho.db.index.BTree


  void setIndex(DbTransaction xa,
                byte []block, int rowOffset,
                long rowAddr, QueryContext context)
    throws SQLException
  {
    BTree index = getIndex();

    if (index == null)
      return;

    /*
    IndexCache manager = IndexCache.create();

    manager.insert(index,
                   block, rowOffset + getColumnOffset(), getLength(),
                   rowAddr,
                   xa);
    */
    index.insert(block, rowOffset + getColumnOffset(), getLength(),
                 rowAddr, false);
  }
View Full Code Here


   * @param expr the expression to store
   */
  void deleteIndex(DbTransaction xa, byte []block, int rowOffset)
    throws SQLException
  {
    BTree index = getIndex();

    if (index == null)
      return;

    /*
    IndexCache manager = IndexCache.create();

    manager.delete(index,
                   block, rowOffset + getColumnOffset(), getLength(),
                   xa);
    */

    index.remove(block, rowOffset + getColumnOffset(), getLength());
  }
View Full Code Here

  void validateIndex(DbTransaction xa,
                     byte []block, int rowOffset,
                     long rowAddr)
    throws SQLException, IOException
  {
    BTree index = getIndex();

    if (index == null)
      return;

    long value
      = index.lookup(block, rowOffset + getColumnOffset(), getLength());

    if (value != rowAddr)
      throw new IllegalStateException(L.l("invalid index '{0}' at {1}",
                                          value, Long.toHexString(rowAddr)));
  }
View Full Code Here

  /**
   * Cleanup of the column on table shutdown.
   */
  public void close()
  {
    BTree index = _index;
   
    if (index != null)
      index.close();
  }
View Full Code Here

   */
  @Override
  void deleteIndex(DbTransaction xa, byte []block, int rowOffset)
    throws SQLException
  {
    BTree index = getIndex();

    if (index != null)
      index.remove(block, rowOffset + _columnOffset, 8);
  }
View Full Code Here

  public void validate(TableIterator []sourceRows,
                       QueryContext queryContext, DbTransaction xa)
    throws SQLException
  {
    Column column = _uniqueColumn;
    BTree index = column.getIndex();

    if (index != null) {
      validateIndex(sourceRows, queryContext, xa);
      return;
    }
View Full Code Here

      TableIterator sourceRow = sourceRows[0];

      byte []sourceBuffer = sourceRow.getBuffer();
      int sourceOffset = sourceRow.getRowOffset();
     
      BTree index = column.getIndex();

      /*
      int length = column.evalToBuffer(sourceBuffer, sourceOffset,
                                       buffer, 0);

      if (length <= 0)
        return;

      long value = index.lookup(buffer, 0, length,
                                context.getTransaction());

      */

      // currently this is a static length.  See StringColumn.
      int length = column.getLength();
      int offset = sourceOffset + _uniqueColumn.getColumnOffset();
      long value = index.lookup(sourceBuffer, offset, length);

      if (value != 0) {
        Table table = sourceRow.getTable();
        long blockId = sourceRow.getBlockId();

View Full Code Here

      int length = _column.getLength();

      if (length <= 0)
        return;

      BTree index = _column.getIndex();

      long value = index.lookup(buffer, 0, length);

      if (value != 0) {
        Table table = sourceRow.getTable();
        long blockId = sourceRow.getBlockId();
View Full Code Here

  void setIndex(DbTransaction xa,
                byte []block, int rowOffset,
                long rowAddr, QueryContext context)
    throws SQLException
  {
    BTree index = getIndex();

    if (index == null)
      return;

    index.insert(block, rowOffset + _columnOffset, 2, rowAddr, false);
  }
View Full Code Here

   */
  @Override
  void deleteIndex(DbTransaction xa, byte []block, int rowOffset)
    throws SQLException
  {
    BTree index = getIndex();

    if (index != null)
      index.remove(block, rowOffset + _columnOffset, 2);
  }
View Full Code Here

TOP

Related Classes of com.caucho.db.index.BTree

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.