com.caucho.db.table
Class TableIterator

java.lang.Object
  extended by com.caucho.db.table.TableIterator

public class TableIterator
extends java.lang.Object

Iterates over a table's rows.


Constructor Summary
TableIterator()
           
 
Method Summary
 void delete()
           
 void evalToResult(Column column, SelectResult result)
          Evaluates the row to the result.
 void free()
           
 Block getBlock()
           
 long getBlockId()
          Returns the current block id of the iterator.
 byte[] getBuffer()
          Gets the current block.
 int getBuffer(Column column, byte[] buffer, int offset)
          Evaluates the row to the result.
 byte[] getBytes(Column column)
          Returns the column's bytes value.
 double getDouble(Column column)
          Returns the column's double value.
 int getInteger(Column column)
          Returns the column's value as an integer
 long getLong(Column column)
          Returns the column's long value.
 QueryContext getQueryContext()
          Returns the query context for the iterator.
 long getRowAddress()
          Returns the current address.
 int getRowOffset()
          Returns the current row offset of the iterator.
 java.lang.String getString(Column column)
          Returns the string for the column at the given index.
 Table getTable()
          Returns the table of the iterator.
 DbTransaction getTransaction()
          Returns the transaction for the iterator.
 void init(DbTransaction xa)
           
 void init(QueryContext queryContext)
           
 void init(Table table)
           
 void initNullRow()
          Sets the next row.
 void initRow()
           
 boolean isEqual(Column column, byte[] matchBuffer)
           
 boolean isEqual(Column column, byte[] matchBuffer, int matchLength)
           
 boolean isEqual(Column column, java.lang.String string)
           
 boolean isNull(Column column)
          Returns true if the column is null.
 boolean isNullRow()
          Returns true for the null for (for OUTER JOINs)
 boolean isValidRow(long rowAddr)
          Sets the next row.
 boolean next()
          Returns the next row.
 boolean nextBlock()
          Returns the following block.
 boolean nextRow()
          Returns the next tuple in the current row.
 void prevRow()
           
 void setBlockId(long blockId)
          Sets the current block id of the iterator.
 void setDirty()
           
 void setDouble(DbTransaction xa, Column column, double value)
          Returns the double for the column at the given index.
 void setInteger(DbTransaction xa, Column column, int value)
          Returns the integer for the column at the given index.
 void setLong(DbTransaction xa, Column column, long value)
          Returns the long for the column at the given index.
 void setRow(long rowAddr)
          Sets the next row.
 void setRowOffset(int rowOffset)
          Sets the current row offset of the iterator.
 void setString(DbTransaction xa, Column column, java.lang.String value)
          Returns the string for the column at the given index.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableIterator

public TableIterator()
Method Detail

init

public void init(Table table)

getTable

public Table getTable()
Returns the table of the iterator.


getBlockId

public final long getBlockId()
Returns the current block id of the iterator.


setBlockId

public final void setBlockId(long blockId)
Sets the current block id of the iterator.


getRowAddress

public final long getRowAddress()
Returns the current address.


getRowOffset

public final int getRowOffset()
Returns the current row offset of the iterator.


setRowOffset

public final void setRowOffset(int rowOffset)
Sets the current row offset of the iterator.


getBuffer

public final byte[] getBuffer()
Gets the current block.


getTransaction

public DbTransaction getTransaction()
Returns the transaction for the iterator.


getQueryContext

public QueryContext getQueryContext()
Returns the query context for the iterator.


init

public void init(QueryContext queryContext)
          throws java.sql.SQLException
Throws:
java.sql.SQLException

init

public void init(DbTransaction xa)
          throws java.sql.SQLException
Throws:
java.sql.SQLException

initRow

public void initRow()
             throws java.io.IOException
Throws:
java.io.IOException

prevRow

public void prevRow()

getBlock

public Block getBlock()

nextRow

public boolean nextRow()
                throws java.io.IOException
Returns the next tuple in the current row.

Returns:
true if a tuple is found, or false if the block has no more tuples
Throws:
java.io.IOException

next

public boolean next()
             throws java.io.IOException
Returns the next row.

Throws:
java.io.IOException

nextBlock

public boolean nextBlock()
                  throws java.io.IOException
Returns the following block.

Throws:
java.io.IOException

isValidRow

public boolean isValidRow(long rowAddr)
                   throws java.io.IOException
Sets the next row.

Throws:
java.io.IOException

setRow

public void setRow(long rowAddr)
            throws java.io.IOException
Sets the next row.

Throws:
java.io.IOException

initNullRow

public void initNullRow()
                 throws java.io.IOException
Sets the next row.

Throws:
java.io.IOException

isNullRow

public boolean isNullRow()
Returns true for the null for (for OUTER JOINs)


isNull

public boolean isNull(Column column)
               throws java.sql.SQLException
Returns true if the column is null.

Throws:
java.sql.SQLException

getString

public java.lang.String getString(Column column)
                           throws java.sql.SQLException
Returns the string for the column at the given index.

Throws:
java.sql.SQLException

setString

public void setString(DbTransaction xa,
                      Column column,
                      java.lang.String value)
               throws java.sql.SQLException
Returns the string for the column at the given index.

Throws:
java.sql.SQLException

getInteger

public int getInteger(Column column)
               throws java.sql.SQLException
Returns the column's value as an integer

Parameters:
index - column index in the row
Returns:
the integer value
Throws:
java.sql.SQLException

setInteger

public void setInteger(DbTransaction xa,
                       Column column,
                       int value)
                throws java.sql.SQLException
Returns the integer for the column at the given index.

Throws:
java.sql.SQLException

getLong

public long getLong(Column column)
             throws java.sql.SQLException
Returns the column's long value.

Parameters:
index - column index in the row
Returns:
the long value
Throws:
java.sql.SQLException

setLong

public void setLong(DbTransaction xa,
                    Column column,
                    long value)
             throws java.sql.SQLException
Returns the long for the column at the given index.

Throws:
java.sql.SQLException

getDouble

public double getDouble(Column column)
                 throws java.sql.SQLException
Returns the column's double value.

Parameters:
index - column index in the row
Returns:
the double value
Throws:
java.sql.SQLException

setDouble

public void setDouble(DbTransaction xa,
                      Column column,
                      double value)
               throws java.sql.SQLException
Returns the double for the column at the given index.

Throws:
java.sql.SQLException

getBytes

public byte[] getBytes(Column column)
                throws java.sql.SQLException
Returns the column's bytes value.

Parameters:
index - column index in the row
Returns:
the double value
Throws:
java.sql.SQLException

isEqual

public boolean isEqual(Column column,
                       byte[] matchBuffer)
                throws java.sql.SQLException
Throws:
java.sql.SQLException

isEqual

public boolean isEqual(Column column,
                       byte[] matchBuffer,
                       int matchLength)
                throws java.sql.SQLException
Throws:
java.sql.SQLException

isEqual

public boolean isEqual(Column column,
                       java.lang.String string)
                throws java.sql.SQLException
Throws:
java.sql.SQLException

getBuffer

public int getBuffer(Column column,
                     byte[] buffer,
                     int offset)
              throws java.sql.SQLException
Evaluates the row to the result.

Throws:
java.sql.SQLException

evalToResult

public void evalToResult(Column column,
                         SelectResult result)
                  throws java.sql.SQLException
Evaluates the row to the result.

Throws:
java.sql.SQLException

delete

public void delete()
            throws java.sql.SQLException
Throws:
java.sql.SQLException

setDirty

public void setDirty()
              throws java.sql.SQLException
Throws:
java.sql.SQLException

free

public void free()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object