Quadcap Embeddable Database

com.quadcap.sql.AggregateCursor Class Reference

Inheritance diagram for com.quadcap.sql.AggregateCursor:

com.quadcap.sql.FilterCursor com.quadcap.sql.CursorImpl com.quadcap.sql.TupleImpl com.quadcap.sql.Cursor com.quadcap.sql.Tuple Externalizable com.quadcap.sql.Tuple List of all members.

Detailed Description

Used in conjunction with a GroupByCursor to handle aggregate functions (e.g., SUM, AVG, etc.) with a GROUP BY clause.

Author:
Stan Bailes

Definition at line 56 of file AggregateCursor.java.

Public Member Functions

 AggregateCursor (Session session, Cursor cursor, GroupByCursor gcursor, Vector aggregates) throws SQLException
void resetAggregates () throws SQLException
void updateAggregates (Cursor c) throws SQLException
Row getRow () throws SQLException
 Derived class implements this function to return the current cursor row.

void updateRow (Row row) throws SQLException
 Replace the current cursor row with the specified row.

void deleteRow () throws SQLException
 Delete the current cursor row.

void beforeFirst () throws SQLException
 Position the cursor before the first row.

boolean next () throws SQLException
 This routine returns the next element of an aggregate cursor, i.e., one which uses SUM, COUNT, AVG, MAX, or MIN.

boolean isWritable (int col) throws SQLException
 Return true if the specified column is writable.

long size ()
 We don't know the size.

void close () throws SQLException
 Close the cursor and free up any resources (including closing the cursor's transaction if that is feasible) used by the cursor.


Package Attributes

GroupByCursor gcursor = null
Vector aggregates = null
Row row = null
int currentRowNum = 0
boolean first = true
boolean isItemCursor = false
ItemsCursor itemsCursor = null
Cursor baseCursor = null


Constructor & Destructor Documentation

com.quadcap.sql.AggregateCursor.AggregateCursor Session  session,
Cursor  cursor,
GroupByCursor  gcursor,
Vector  aggregates
throws SQLException
 

Definition at line 66 of file AggregateCursor.java.

References com.quadcap.sql.AggregateCursor.aggregates, com.quadcap.sql.AggregateCursor.baseCursor, com.quadcap.sql.AggregateCursor.gcursor, com.quadcap.sql.ItemsCursor.getBaseCursor(), com.quadcap.sql.AggregateCursor.isItemCursor, and com.quadcap.sql.AggregateCursor.itemsCursor.


Member Function Documentation

void com.quadcap.sql.AggregateCursor.beforeFirst  )  throws SQLException [virtual]
 

Position the cursor before the first row.

Reimplemented from com.quadcap.sql.FilterCursor.

Definition at line 117 of file AggregateCursor.java.

References com.quadcap.sql.Cursor.beforeFirst(), and com.quadcap.sql.AggregateCursor.first.

void com.quadcap.sql.AggregateCursor.close  )  throws SQLException [virtual]
 

Close the cursor and free up any resources (including closing the cursor's transaction if that is feasible) used by the cursor.

Exceptions:
SQLException may be thrown

Reimplemented from com.quadcap.sql.FilterCursor.

Definition at line 173 of file AggregateCursor.java.

References com.quadcap.sql.Cursor.close(), and com.quadcap.sql.AggregateCursor.resetAggregates().

void com.quadcap.sql.AggregateCursor.deleteRow  )  throws SQLException [virtual]
 

Delete the current cursor row.

Reimplemented from com.quadcap.sql.FilterCursor.

Definition at line 112 of file AggregateCursor.java.

Row com.quadcap.sql.AggregateCursor.getRow  )  throws SQLException [virtual]
 

Derived class implements this function to return the current cursor row.

Implementation required.

Reimplemented from com.quadcap.sql.FilterCursor.

Definition at line 103 of file AggregateCursor.java.

References com.quadcap.sql.AggregateCursor.row.

boolean com.quadcap.sql.AggregateCursor.isWritable int  col  )  throws SQLException [virtual]
 

Return true if the specified column is writable.

Parameters:
column the (one-based) column number
Exceptions:
SQLException may be thrown

Reimplemented from com.quadcap.sql.FilterCursor.

Definition at line 164 of file AggregateCursor.java.

References com.quadcap.sql.AggregateCursor.isWritable().

Referenced by com.quadcap.sql.AggregateCursor.isWritable().

boolean com.quadcap.sql.AggregateCursor.next  )  throws SQLException [virtual]
 

This routine returns the next element of an aggregate cursor, i.e., one which uses SUM, COUNT, AVG, MAX, or MIN.

If GROUP BY is not specified, 'next()' simply fetches all of the underlying rows, updating the aggregate expressions after each row. If there is a GROUP BY clause, we have to keep track of when a new group starts using our associated group-by cursor.

Reimplemented from com.quadcap.sql.FilterCursor.

Definition at line 132 of file AggregateCursor.java.

References com.quadcap.sql.AggregateCursor.baseCursor, com.quadcap.sql.AggregateCursor.first, com.quadcap.sql.AggregateCursor.gcursor, com.quadcap.sql.ItemsCursor.getEmptyAggregate(), com.quadcap.sql.Cursor.getRow(), com.quadcap.sql.AggregateCursor.isItemCursor, com.quadcap.sql.AggregateCursor.itemsCursor, com.quadcap.sql.GroupByCursor.lastRowOfGroup(), com.quadcap.sql.Cursor.next(), com.quadcap.sql.AggregateCursor.resetAggregates(), and com.quadcap.sql.AggregateCursor.row.

void com.quadcap.sql.AggregateCursor.resetAggregates  )  throws SQLException
 

Definition at line 81 of file AggregateCursor.java.

References com.quadcap.sql.AggregateCursor.aggregates.

Referenced by com.quadcap.sql.AggregateCursor.close(), and com.quadcap.sql.AggregateCursor.next().

long com.quadcap.sql.AggregateCursor.size  ) 
 

We don't know the size.

Reimplemented from com.quadcap.sql.FilterCursor.

Definition at line 171 of file AggregateCursor.java.

void com.quadcap.sql.AggregateCursor.updateAggregates Cursor  c  )  throws SQLException
 

Definition at line 93 of file AggregateCursor.java.

References com.quadcap.sql.AggregateCursor.aggregates, com.quadcap.sql.AggregateExpression.updateAggregate(), and com.quadcap.sql.AggregateCursor.updateAggregates().

Referenced by com.quadcap.sql.AggregateCursor.updateAggregates().

void com.quadcap.sql.AggregateCursor.updateRow Row  row  )  throws SQLException [virtual]
 

Replace the current cursor row with the specified row.

Reimplemented from com.quadcap.sql.FilterCursor.

Definition at line 107 of file AggregateCursor.java.

References com.quadcap.sql.AggregateCursor.updateRow().

Referenced by com.quadcap.sql.AggregateCursor.updateRow().


Member Data Documentation

Vector com.quadcap.sql.AggregateCursor.aggregates = null [package]
 

Definition at line 58 of file AggregateCursor.java.

Referenced by com.quadcap.sql.AggregateCursor.AggregateCursor(), com.quadcap.sql.AggregateCursor.resetAggregates(), and com.quadcap.sql.AggregateCursor.updateAggregates().

Cursor com.quadcap.sql.AggregateCursor.baseCursor = null [package]
 

Definition at line 64 of file AggregateCursor.java.

Referenced by com.quadcap.sql.AggregateCursor.AggregateCursor(), and com.quadcap.sql.AggregateCursor.next().

int com.quadcap.sql.AggregateCursor.currentRowNum = 0 [package]
 

Definition at line 60 of file AggregateCursor.java.

boolean com.quadcap.sql.AggregateCursor.first = true [package]
 

Definition at line 61 of file AggregateCursor.java.

Referenced by com.quadcap.sql.AggregateCursor.beforeFirst(), and com.quadcap.sql.AggregateCursor.next().

GroupByCursor com.quadcap.sql.AggregateCursor.gcursor = null [package]
 

Definition at line 57 of file AggregateCursor.java.

Referenced by com.quadcap.sql.AggregateCursor.AggregateCursor(), and com.quadcap.sql.AggregateCursor.next().

boolean com.quadcap.sql.AggregateCursor.isItemCursor = false [package]
 

Definition at line 62 of file AggregateCursor.java.

Referenced by com.quadcap.sql.AggregateCursor.AggregateCursor(), and com.quadcap.sql.AggregateCursor.next().

ItemsCursor com.quadcap.sql.AggregateCursor.itemsCursor = null [package]
 

Definition at line 63 of file AggregateCursor.java.

Referenced by com.quadcap.sql.AggregateCursor.AggregateCursor(), and com.quadcap.sql.AggregateCursor.next().

Row com.quadcap.sql.AggregateCursor.row = null [package]
 

Definition at line 59 of file AggregateCursor.java.

Referenced by com.quadcap.sql.AggregateCursor.getRow(), and com.quadcap.sql.AggregateCursor.next().