Package com.caucho.db.index

Examples of com.caucho.db.index.BTree


   */
  @Override
  void deleteIndex(Transaction 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, Transaction 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

      Block rootBlock = allocateIndexBlock();
      long rootBlockId = rootBlock.getBlockId();
      rootBlock.free();

      BTree btree = new BTree(this, rootBlockId, column.getLength(),
                              keyCompare);

      column.setIndex(btree);
    }
  }
View Full Code Here

    throws IOException
  {
    Column []columns = _row.getColumns();

    for (int i = 0; i < columns.length; i++) {
      BTree index = columns[i].getIndex();

      if (index == null)
        continue;

      long rootAddr = index.getIndexRoot();

      Block block = readBlock(addressToBlockId(rootAddr));

      try {
        byte []blockBuffer = block.getBuffer();
View Full Code Here

    Column []columns = _row.getColumns();
    for (int i = 0; i < columns.length; i++) {
      if (! columns[i].isUnique())
        continue;

      BTree index = columns[i].getIndex();

      if (index != null) {
        writeLong(os, index.getIndexRoot());
      }
      else {
        writeLong(os, 0);
      }
    }
View Full Code Here

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

    if (index == null)
      return;

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

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

    if (index != null)
      index.remove(block, rowOffset + _columnOffset, 8);
  }
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.