Package org.hsqldb.index

Examples of org.hsqldb.index.RowIterator


            return;
        }

        rowIdSequence = new NumberSequence(null, 0, 1, Types.BIGINT);

        RowIterator it = getPrimaryIndex().firstRow(session);;

        while (it.hasNext()) {
            Row row = it.next();
            int pos = (int) rowIdSequence.getValue();

            row.setPos(pos);
        }
    }
View Full Code Here


  int size(Session paramSession)
    throws HsqlException
  {
    int i = 0;
    RowIterator localRowIterator = firstRow(paramSession);
    while (localRowIterator.hasNext())
    {
      localRowIterator.next();
      i++;
    }
    return i;
  }
View Full Code Here

        {
          if (bool)
          {
            this.schemaToLog = localTable.getName().schema;
            writeTableInit(localTable);
            RowIterator localRowIterator = localTable.rowIterator(this.currentSession);
            while (localRowIterator.hasNext())
              writeRow(this.currentSession, localTable, localRowIterator.next().getData());
            writeTableTerm(localTable);
          }
        }
        catch (Exception localException)
        {
View Full Code Here

    throws HsqlException
  {
    int i = createIndexStructureGetNo(paramArrayOfInt, paramHsqlName, paramBoolean1, paramBoolean2, paramBoolean3);
    Index localIndex1 = this.indexList[i];
    Index localIndex2 = getPrimaryIndex();
    RowIterator localRowIterator = localIndex2.firstRow(paramSession);
    int j = 0;
    Object localObject1 = null;
    Object localObject2;
    Node localNode;
    try
    {
      while (localRowIterator.hasNext())
      {
        Row localRow = localRowIterator.next();
        localObject2 = localRow.getNode(i - 1);
        localNode = Node.newNode(localRow, i, this);
        localNode.nNext = ((Node)localObject2).nNext;
        ((Node)localObject2).nNext = localNode;
        j++;
        localIndex1.insert(paramSession, localRow, i);
      }
      return localIndex1;
    }
    catch (OutOfMemoryError localOutOfMemoryError)
    {
      localObject1 = Trace.error(72);
    }
    catch (HsqlException localHsqlException)
    {
      localObject1 = localHsqlException;
    }
    localRowIterator = localIndex2.firstRow(paramSession);
    for (int k = 0; k < j; k++)
    {
      localObject2 = localRowIterator.next();
      localNode = ((Row)localObject2).getNode(0);
      int m = i;
      while (true)
      {
        m--;
View Full Code Here

  }

  void dropIndexFromRows(Session paramSession, int paramInt)
    throws HsqlException
  {
    RowIterator localRowIterator = getPrimaryIndex().firstRow(paramSession);
    while (localRowIterator.hasNext())
    {
      Row localRow = localRowIterator.next();
      int i = paramInt - 1;
      for (Node localNode = localRow.getNode(0); i-- > 0; localNode = localNode.nNext);
      localNode.nNext = localNode.nNext.nNext;
    }
  }
View Full Code Here

    if ((paramInt2 >= 0) && (paramInt1 != -1))
    {
      localColumn = getColumn(paramInt1);
      localObject = localColumn.getDefaultValue(paramSession);
    }
    RowIterator localRowIterator = paramTable.getPrimaryIndex().firstRow(paramSession);
    while (localRowIterator.hasNext())
    {
      Row localRow1 = localRowIterator.next();
      Object[] arrayOfObject1 = localRow1.getData();
      Object[] arrayOfObject2 = getEmptyRowData();
      if ((paramInt2 == 0) && (paramInt1 != -1))
        localObject = Column.convertObject(paramSession, arrayOfObject1[paramInt1], localColumn.getType(), localColumn.getSize(), localColumn.getScale());
      ArrayUtil.copyAdjustArray(arrayOfObject1, arrayOfObject2, localObject, paramInt1, paramInt2);
View Full Code Here

    while (i < j)
    {
      Constraint localConstraint = paramTable.constraintList[i];
      if ((localConstraint.getType() == 1) && (localConstraint.getRef() != null))
      {
        RowIterator localRowIterator = localConstraint.findFkRef(paramSession, paramRow.getData(), paramBoolean);
        if (localRowIterator.hasNext())
          try
          {
            Object localObject1;
            if (localConstraint.core.deleteAction == 3)
            {
              if (localConstraint.core.mainTable == localConstraint.core.refTable)
              {
                localObject1 = localRowIterator.next();
                if (paramRow.equals(localObject1))
                {
                  localRowIterator.release();
                  break label650;
                }
              }
              throw Trace.error(8, 100, new Object[] { localConstraint.core.fkName.name, localConstraint.core.refTable.getName().name });
            }
            else
            {
              localObject1 = localConstraint.getRef();
              int k = ((Table)localObject1).getNextConstraintIndex(0, 1) != -1 ? 1 : 0;
              if ((!paramBoolean) && (k == 0))
              {
                localRowIterator.release();
              }
              else
              {
                Index localIndex = localConstraint.getRefIndex();
                int[] arrayOfInt1 = localConstraint.getMainColumns();
                int[] arrayOfInt2 = localConstraint.getRefColumns();
                Object[] arrayOfObject1 = paramRow.getData();
                int m = (localConstraint.getDeleteAction() == 2) || (localConstraint.getDeleteAction() == 4) ? 1 : 0;
                HashMappedList localHashMappedList = null;
                if (m != 0)
                {
                  localHashMappedList = (HashMappedList)paramHashMappedList.get(localObject1);
                  if (localHashMappedList == null)
                  {
                    localHashMappedList = new HashMappedList();
                    paramHashMappedList.add(localObject1, localHashMappedList);
                  }
                }
                while (true)
                {
                  Row localRow = localRowIterator.next();
                  if ((localRow == null) || (localRow.isCascadeDeleted()) || (localIndex.compareRowNonUnique(paramSession, arrayOfObject1, arrayOfInt1, localRow.getData()) != 0))
                    break;
                  if (m != 0)
                  {
                    Object[] arrayOfObject2 = ((Table)localObject1).getEmptyRowData();
                    System.arraycopy(localRow.getData(), 0, arrayOfObject2, 0, arrayOfObject2.length);
                    if (localConstraint.getDeleteAction() == 2)
                      for (n = 0; n < arrayOfInt2.length; n++)
                        arrayOfObject2[arrayOfInt2[n]] = null;
                    for (int n = 0; n < arrayOfInt2.length; n++)
                    {
                      Column localColumn = ((Table)localObject1).getColumn(arrayOfInt2[n]);
                      arrayOfObject2[arrayOfInt2[n]] = localColumn.getDefaultValue(paramSession);
                    }
                    if ((k != 0) && (paramHashSet.add(localConstraint)))
                    {
                      checkCascadeUpdate(paramSession, (Table)localObject1, null, localRow, arrayOfObject2, arrayOfInt2, null, paramHashSet);
                      paramHashSet.remove(localConstraint);
                    }
                    if ((paramBoolean) && ((localObject1 != paramTable) || (!localRow.equals(paramRow))))
                      mergeUpdate(localHashMappedList, localRow, arrayOfObject2, arrayOfInt2);
                  }
                  else if (k != 0)
                  {
                    if (localObject1 != paramTable)
                    {
                      if (paramHashSet.add(localConstraint))
                      {
                        checkCascadeDelete(paramSession, (Table)localObject1, paramHashMappedList, localRow, paramBoolean, paramHashSet);
                        paramHashSet.remove(localConstraint);
                      }
                    }
                    else if (localRow != paramRow)
                      checkCascadeDelete(paramSession, (Table)localObject1, paramHashMappedList, localRow, paramBoolean, paramHashSet);
                  }
                  if ((!paramBoolean) || (m != 0) || (localRow.isCascadeDeleted()))
                    continue;
                  ((Table)localObject1).deleteNoRefCheck(paramSession, localRow);
                }
              }
            }
          }
          finally
          {
            localRowIterator.release();
          }
      }
      label650: i++;
    }
  }
View Full Code Here

            k = 0;
            break;
          }
          if (k == 0)
          {
            RowIterator localRowIterator = localConstraint.findFkRef(paramSession, paramRow.getData(), false);
            if (localRowIterator.hasNext())
            {
              if (localConstraint.core.updateAction == 3)
                throw Trace.error(8, 100, new Object[] { localConstraint.core.fkName.name, localConstraint.core.refTable.getName().name });
              Table localTable = localConstraint.getRef();
              int n = localTable.getNextConstraintIndex(0, 1) != -1 ? 1 : 0;
              Index localIndex = localConstraint.getRefIndex();
              HashMappedList localHashMappedList = (HashMappedList)paramHashMappedList.get(localTable);
              if (localHashMappedList == null)
              {
                localHashMappedList = new HashMappedList();
                paramHashMappedList.add(localTable, localHashMappedList);
              }
              for (Row localRow = localRowIterator.next(); (localRow != null) && (localIndex.compareRowNonUnique(paramSession, paramRow.getData(), arrayOfInt2, localRow.getData()) == 0); localRow = localRowIterator.next())
              {
                Object[] arrayOfObject = localTable.getEmptyRowData();
                System.arraycopy(localRow.getData(), 0, arrayOfObject, 0, arrayOfObject.length);
                int i1;
                if (localConstraint.getUpdateAction() == 2)
View Full Code Here

  public void deleteNoCheckFromLog(Session paramSession, Object[] paramArrayOfObject)
    throws HsqlException
  {
    Row localRow = null;
    RowIterator localRowIterator;
    Object localObject;
    if (hasPrimaryKey())
    {
      localRowIterator = getPrimaryIndex().findFirstRow(paramSession, paramArrayOfObject, this.primaryKeyColsSequence);
      localRow = localRowIterator.next();
    }
    else if (this.bestIndex == null)
    {
      localRowIterator = getPrimaryIndex().firstRow(paramSession);
      do
      {
        localRow = localRowIterator.next();
        if (localRow == null)
          break;
      }
      while (Index.compareRows(paramSession, localRow.getData(), paramArrayOfObject, this.defaultColumnMap, this.colTypes) != 0);
    }
    else
    {
      localRowIterator = this.bestIndex.findFirstRow(paramSession, paramArrayOfObject);
      while (true)
      {
        localRow = localRowIterator.next();
        if (localRow == null)
          break;
        localObject = localRow.getData();
        if (this.bestIndex.compareRowNonUnique(paramSession, paramArrayOfObject, this.bestIndex.getColumns(), localObject) != 0)
          localRow = null;
View Full Code Here

    throws HsqlException
  {
    if (this.isCached)
      return;
    this.rowIdSequence = new NumberSequence(null, 0L, 1L, -5);
    RowIterator localRowIterator = getPrimaryIndex().firstRow(paramSession);
    while (localRowIterator.hasNext())
    {
      Row localRow = localRowIterator.next();
      int i = (int)this.rowIdSequence.getValue();
      localRow.setPos(i);
    }
  }
View Full Code Here

TOP

Related Classes of org.hsqldb.index.RowIterator

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.