Quadcap Embeddable Database

com.quadcap.sql.TempTableMerge Class Reference

Inheritance diagram for com.quadcap.sql.TempTableMerge:

com.quadcap.sql.TempTable List of all members.

Detailed Description

A special temp table used to implement UNION and INTERSECT expressions.

The temp table that we build has keys based on the union columns, and the data as 13 bytes:
byte 0: if zero, the rowId refers to a real table row if one, the rowId refers to a temp row
bytes 1-8: the rowId of the union row
bytes 9-12: the duplicate count (from table 1)
bytes 13-16:the duplicate count (from table 2)

Author:
Stan Bailes

Definition at line 74 of file TempTableMerge.java.

Public Member Functions

 TempTableMerge (Session session, Key compare) throws SQLException, IOException
 Constructor for session and key.

void addRows (Session session, Cursor cursor, int side, int[] map) throws SQLException, IOException
 Add rows from one side of the {union/merge} operation, building a temporary index on the key.

byte[] getData (byte[] key) throws IOException

Package Functions

final int getCount (int side)

Static Package Functions

final int getCount (byte[] data, int side)

Static Package Attributes

final int fIS_TEMP = 0
 Byte offset of 'isTemp' byte flag in a data row.

final int fROW_ID = 1
 The byte offset of the (long) row ID in data data row.

final int fCOUNT = 9
 The byte offset of the two 'count' integers.

final int BUFSIZE = 17
 Total size of the data buffer in our temp index.


Constructor & Destructor Documentation

com.quadcap.sql.TempTableMerge.TempTableMerge Session  session,
Key  compare
throws SQLException, IOException
 

Constructor for session and key.

Definition at line 99 of file TempTableMerge.java.

References com.quadcap.sql.TempTableMerge.BUFSIZE.


Member Function Documentation

void com.quadcap.sql.TempTableMerge.addRows Session  session,
Cursor  cursor,
int  side,
int[]  map
throws SQLException, IOException
 

Add rows from one side of the {union/merge} operation, building a temporary index on the key.

Definition at line 110 of file TempTableMerge.java.

References com.quadcap.sql.TempTableMerge.addRows(), com.quadcap.sql.TempTableMerge.BUFSIZE, com.quadcap.sql.TempTableMerge.fCOUNT, com.quadcap.sql.TempTableMerge.fIS_TEMP, com.quadcap.sql.TempTableMerge.fROW_ID, com.quadcap.sql.index.Btree.getCursor(), com.quadcap.sql.Session.getDatabase(), com.quadcap.sql.index.BCursor.getValBuf(), com.quadcap.sql.index.BCursor.insert(), com.quadcap.sql.Database.putRow(), com.quadcap.sql.index.BCursor.release(), com.quadcap.sql.index.BCursor.replace(), com.quadcap.sql.index.BCursor.seek(), and com.quadcap.sql.MapRow.setRow().

Referenced by com.quadcap.sql.TempTableMerge.addRows(), and com.quadcap.sql.MergeExpression.getCursor().

final int com.quadcap.sql.TempTableMerge.getCount byte[]  data,
int  side
[static, package]
 

Definition at line 176 of file TempTableMerge.java.

References com.quadcap.sql.TempTableMerge.fCOUNT.

final int com.quadcap.sql.TempTableMerge.getCount int  side  )  [package]
 

Definition at line 172 of file TempTableMerge.java.

References com.quadcap.sql.TempTableMerge.getCount().

Referenced by com.quadcap.sql.TempTableMerge.getCount().

byte [] com.quadcap.sql.TempTableMerge.getData byte[]  key  )  throws IOException
 

Definition at line 165 of file TempTableMerge.java.

References com.quadcap.sql.index.Btree.get(), and com.quadcap.sql.TempTableMerge.getData().

Referenced by com.quadcap.sql.TempTableMerge.getData().


Member Data Documentation

final int com.quadcap.sql.TempTableMerge.BUFSIZE = 17 [static, package]
 

Total size of the data buffer in our temp index.

Definition at line 94 of file TempTableMerge.java.

Referenced by com.quadcap.sql.TempTableMerge.addRows(), and com.quadcap.sql.TempTableMerge.TempTableMerge().

final int com.quadcap.sql.TempTableMerge.fCOUNT = 9 [static, package]
 

The byte offset of the two 'count' integers.

in the data row

Definition at line 89 of file TempTableMerge.java.

Referenced by com.quadcap.sql.TempTableMerge.addRows(), and com.quadcap.sql.TempTableMerge.getCount().

final int com.quadcap.sql.TempTableMerge.fIS_TEMP = 0 [static, package]
 

Byte offset of 'isTemp' byte flag in a data row.

Definition at line 79 of file TempTableMerge.java.

Referenced by com.quadcap.sql.TempTableMerge.addRows().

final int com.quadcap.sql.TempTableMerge.fROW_ID = 1 [static, package]
 

The byte offset of the (long) row ID in data data row.

Definition at line 84 of file TempTableMerge.java.

Referenced by com.quadcap.sql.TempTableMerge.addRows().