public final class DataTable extends DefaultDataTable
row_countDEBUG_QUERY| Modifier and Type | Method and Description |
|---|---|
void |
add(RowData row_data)
Adds a given 'RowData' object to the table.
|
void |
add(RowData[] row_data_arr)
Adds an array of 'RowData' objects to the table.
|
void |
addDataTableListener(com.mckoi.database.DataTableListener listener)
Adds a DataTableListener to the DataTable objects at the root of this
table tree hierarchy.
|
protected void |
blankSelectableSchemes(int type)
Overwritten from DefaultDataTable to do nothing.
|
RowData |
createRowDataObject(QueryContext context)
Generates an empty RowData object for 'addRow'ing into the Table.
|
DebugLogger |
Debug()
Convenience - used to log debug messages.
|
ReferenceTable |
declareAs(TableName new_name)
We can declare a DataTable as a new type.
|
int |
delete(Table table) |
int |
delete(Table table,
int limit)
This is the public method for removing a given result set from this
table.
|
int |
findFieldName(Variable v)
Given a fully qualified variable field name, ie.
|
TObject |
getCellContents(int column,
int row)
Returns an object that represents the information in the given cell
in the table.
|
int |
getColumnCount()
Returns the number of columns in the table.
|
DataTableDef |
getDataTableDef()
Returns the DataTableDef object for this table.
|
Variable |
getResolvedVariable(int column)
Returns a fully qualified Variable object that represents the name of
the column at the given index.
|
protected SelectableScheme |
getRootColumnScheme(int column)
Returns the SelectableScheme for the given column.
|
int |
getRowCount()
Returns the current row count.
|
String |
getSchema()
Returns the schema that this table is within.
|
boolean |
hasRootsLocked()
Returns true if the table has its row roots locked (via the lockRoot(int)
method.
|
void |
lockRoot(int lock_key)
Locks the root table(s) of this table so that it is impossible to
overwrite the underlying rows that may appear in this table.
|
void |
removeDataTableListener(com.mckoi.database.DataTableListener listener)
Removes a DataTableListener from the DataTable objects at the root of
this table tree hierarchy.
|
RowEnumeration |
rowEnumeration()
Returns an Enumeration of the rows in this table.
|
void |
unlockRoot(int lock_key)
Unlocks the root tables so that the underlying rows may
once again be used if they are not locked and have been removed.
|
int |
update(QueryContext context,
Table table,
Assignment[] assign_list,
int limit)
Updates the table by applying the assignment operations over each row
that is found in the input 'table' set.
|
blankSelectableSchemes, clearColumnScheme, getDatabasegetTableName, toString, typeEqualsall, allColumnMatchesValue, any, columnContainsCell, columnContainsValue, columnMatchesValue, columnMerge, compareCells, distinct, distinct, dumpTo, emptySelect, exhaustiveSelect, fastFindFieldName, getColumnDefAt, getColumnScheme, getFirstCellContent, getFirstCellContent, getLastCellContent, getLastCellContent, getSingleCellContent, getSingleCellContent, getSystem, getTableAccessState, getTTypeForColumn, getTTypeForColumn, join, orderByColumn, orderByColumn, orderByColumn, orderByColumns, orderedRowList, outside, printGraph, rangeSelect, selectAll, selectAll, selectFirst, selectLast, selectRange, selectRest, simpleJoin, simpleSelect, singleRowSelect, toMap, unionpublic final DebugLogger Debug()
protected void blankSelectableSchemes(int type)
blankSelectableSchemes in class DefaultDataTableprotected SelectableScheme getRootColumnScheme(int column)
getRootColumnScheme in class DefaultDataTablepublic ReferenceTable declareAs(TableName new_name)
public final RowData createRowDataObject(QueryContext context)
public int getRowCount()
getRowCount in interface TableDataSourcegetRowCount in class DefaultDataTablepublic final void add(RowData row_data) throws DatabaseException
This method performs some checking of the cells in the table. It first checks that all columns declared as 'not null' have a value that is not null. It then checks that a the added row will not cause any duplicates in a column declared as unique.
It then uses the low level io manager to store the data.
SYNCHRONIZATION ISSUE: We are assuming this is running in a synchronized environment that is unable to add or alter rows in this object within the lifetime of this method.
DatabaseExceptionpublic final void add(RowData[] row_data_arr) throws DatabaseException
This method performs some checking of the cells in the table. It first checks that all columns declared as 'not null' have a value that is not null. It then checks that a the added row will not cause any duplicates in a column declared as unique.
It then uses the low level io manager to store the data.
SYNCHRONIZATION ISSUE: We are assuming this is running in a synchronized environment that is unable to add or alter rows in this object within the lifetime of this method.
DatabaseExceptionpublic int delete(Table table, int limit) throws DatabaseException
INTERNAL NOTE: The 'table' parameter may be the result of joins. This may cause the same row in this table to be referenced more than once. We must make sure that we delete any given row only once by using the 'distinct' function.
'limit' dictates how many rows will be deleted. If 'limit' is less than 0 then this indicates there is no limit. Keep in mind that rows are picked out from top to bottom in the 'table' object. Normally the input table will be the result of an un-ordered 'where' clause so using a limit does not permit deletes in a deterministic manner.
ASSUMPTION: There are no duplicate rows in the input set.
DatabaseExceptionpublic int delete(Table table) throws DatabaseException
DatabaseExceptionpublic final int update(QueryContext context, Table table, Assignment[] assign_list, int limit) throws DatabaseException
This operation assumes that there is a WRITE lock on this table. A WRITE lock means no other thread may access this table while the operation is being performed. (However, a result set may still be downloading from this table).
'limit' dictates how many rows will be updated. If 'limit' is less than 0 then this indicates there is no limit. Keep in mind that rows are picked out from top to bottom in the 'table' object. Normally the input table will be the result of an un-ordered 'where' clause so using a limit does not permit updates in a deterministic manner.
Returns the number of rows updated in this table.
NOTE: We assume there are no duplicate rows to the root set from the given 'table'.
DatabaseExceptionpublic DataTableDef getDataTableDef()
NOTE: Do not keep references to this object. The DataTableDef is invalidated when a table is closed.
getDataTableDef in interface TableDataSourcegetDataTableDef in class Tablepublic String getSchema()
public void addDataTableListener(com.mckoi.database.DataTableListener listener)
A DataTableListener is notified of all modifications to the raw entries of the table. This listener can be used for detecting changes in VIEWs, for triggers or for caching of common queries.
public void removeDataTableListener(com.mckoi.database.DataTableListener listener)
public TObject getCellContents(int column, int row)
getCellContents in interface TableDataSourcegetCellContents in class Tablepublic RowEnumeration rowEnumeration()
rowEnumeration in interface TableDataSourcerowEnumeration in class Tablepublic void lockRoot(int lock_key)
NOTE: This is nothing to do with the 'LockingMechanism' object.
public void unlockRoot(int lock_key)
unlockRoot in class Tablepublic boolean hasRootsLocked()
hasRootsLocked in class Tablepublic int getColumnCount()
DefaultDataTablegetColumnCount in class DefaultDataTablepublic Variable getResolvedVariable(int column)
DefaultDataTablegetResolvedVariable in class DefaultDataTablepublic int findFieldName(Variable v)
DefaultDataTablefindFieldName in class DefaultDataTableCopyright © 2016. All rights reserved.