#include <DS_Table.h>
Public Types | |
enum | ColumnType { NUMERIC, STRING, BINARY } |
enum | FilterQueryType { QF_EQUAL, QF_NOT_EQUAL, QF_GREATER_THAN, QF_LESS_THAN, QF_IS_EMPTY, QF_NOT_EMPTY } |
enum | SortQueryType { QS_INCREASING_ORDER, QS_DECREASING_ORDER } |
Increasing or decreasing sort order. | |
Public Member Functions | |
Table () | |
Constructor. | |
~Table () | |
Destructor. | |
unsigned | AddColumn (char columnName[_TABLE_MAX_COLUMN_NAME_LENGTH], ColumnType columnType) |
Adds a column to the table. | |
void | RemoveColumn (unsigned columnIndex) |
Removes a column by index. | |
unsigned | ColumnIndex (char columnName[_TABLE_MAX_COLUMN_NAME_LENGTH]) |
Gets the index of a column by name Column indices are stored in the order they are added. | |
char * | ColumnName (unsigned index) |
Gives the string name of the column at a certain index. | |
ColumnType | GetColumnType (unsigned index) |
Returns the type of a column, referenced by index. | |
unsigned | GetColumnCount (void) const |
unsigned | GetRowCount (void) const |
Table::Row * | AddRow (unsigned rowId) |
Adds a row to the table New rows are added with empty values for all cells. However, if you specify initialCelLValues you can specify initial values It's up to you to ensure that the values in the specific cells match the type of data used by that row rowId can be considered the primary key for the row. It is much faster to lookup a row by its rowId than by searching keys. rowId must be unique Rows are stored in sorted order in the table, using rowId as the sort key. | |
Table::Row * | AddRow (unsigned rowId, DataStructures::List< Cell > &initialCellValues) |
void | RemoveRow (unsigned rowId) |
void | RemoveRows (Table *tableContainingRowIDs) |
bool | UpdateCell (unsigned rowId, unsigned columnIndex, int value) |
bool | UpdateCell (unsigned rowId, unsigned columnIndex, char *str) |
bool | UpdateCell (unsigned rowId, unsigned columnIndex, int byteLength, char *data) |
Row * | GetRowByID (unsigned rowId) |
Row * | GetRowByIndex (unsigned rowIndex) |
void | QueryTable (unsigned *columnSubset, unsigned numColumnSubset, FilterQuery *inclusionFilters, unsigned numInclusionFilters, unsigned *rowIds, unsigned numRowIDs, Table *result) |
Queries the table, optionally returning only a subset of columns and rows. | |
void | SortTable (Table::SortQuery *sortQueries, unsigned numSortQueries, Table::Row **out) |
Sorts the table by rows You can sort the table in ascending or descending order on one or more columns Columns have precedence in the order they appear in the sortQueries array If a row cell on column n has the same value as a a different row on column n, then the row will be compared on column n+1. | |
void | Clear (void) |
Frees all memory in the table. | |
void | PrintRow (char *out, int outLength, char columnDelineator, bool printDelineatorForBinary, Table::Row *inputRow) |
DataStructures::List< ColumnDescriptor > & | GetColumns (void) |
Direct access to make things easier. | |
DataStructures::BPlusTree< unsigned, Row *, _TABLE_BPLUS_TREE_ORDER > & | GetRows (void) |
Direct access to make things easier. | |
DataStructures::Page< unsigned, DataStructures::Table::Row *, _TABLE_BPLUS_TREE_ORDER > * | GetListHead (void) |
Protected Member Functions | |
Table::Row * | AddRowColumns (unsigned rowId, Row *row, DataStructures::List< unsigned > columnIndices) |
void | DeleteRow (Row *row) |
void | QueryRow (DataStructures::List< unsigned > &inclusionFilterColumnIndices, DataStructures::List< unsigned > &columnIndicesToReturn, unsigned key, Table::Row *row, FilterQuery *inclusionFilters, Table *result) |
Protected Attributes | |
DataStructures::BPlusTree< unsigned, Row *, _TABLE_BPLUS_TREE_ORDER > | rows |
DataStructures::List< ColumnDescriptor > | columns |
Classes | |
struct | Cell |
Holds the actual data in the table. More... | |
struct | ColumnDescriptor |
struct | FilterQuery |
struct | Row |
Stores the list of cells for this row, and a special flag used for internal sorting. More... | |
struct | SortQuery |
|
Adds a column to the table.
|
|
Adds a row to the table New rows are added with empty values for all cells. However, if you specify initialCelLValues you can specify initial values It's up to you to ensure that the values in the specific cells match the type of data used by that row rowId can be considered the primary key for the row. It is much faster to lookup a row by its rowId than by searching keys. rowId must be unique Rows are stored in sorted order in the table, using rowId as the sort key.
|
|
Gets the index of a column by name Column indices are stored in the order they are added.
|
|
Gives the string name of the column at a certain index.
|
|
Returns the number of columns
|
|
Returns the type of a column, referenced by index.
|
|
Gets a row. More efficient to do this and access Row::cells than to repeatedly call GetCell. You can also update cells in rows from this function.
|
|
Gets a row at a specific index rowIndex should be less than GetRowCount()
|
|
Returns the number of rows
|
|
Writes a text representation of the row to out
|
|
Queries the table, optionally returning only a subset of columns and rows.
|
|
Removes a column by index.
|
|
Removes a row specified by rowId
|
|
Removes all the rows with IDs that the specified table also has
|
|
Sorts the table by rows You can sort the table in ascending or descending order on one or more columns Columns have precedence in the order they appear in the sortQueries array If a row cell on column n has the same value as a a different row on column n, then the row will be compared on column n+1.
|
|
|