|
|
|
Home / Open source / Terimber 2.0
memtable Class Referenceinterface to memory table
More...
#include <memdb.h>
List of all members.
|
Public Member Functions |
| memtable () |
| constructor
|
virtual | ~memtable () |
| destructor user is responsible for destoying memtable object
|
virtual const char * | get_last_error () |
| returns the last occured error
|
virtual bool | populate (dbserver *server, size_t start_row, size_t max_rows) |
| create internal table structure from server object db_server has to be after executing query or stored procedure and ready to fetch data memtable automatically detects the list of columns in recordset and creates table in memory with the same columns' order and types. max_rows sets a restriction on max rows to be retrived, -1 - all of them start_row means absolute number of row to start with unless you specify 0, the memtable starts with the current row to create an empty table, the fake select can be used for instanse, select CAST(0 as NUMBER) as col1, CAST('' as VARCHAR2(255)) as col2 from dual; or you can specifiy the max_rows = 0
|
virtual bool | create (size_t columns, const terimber_table_column_desc desc[]) |
| the other alternative for creating an empty table in the memory is column specification the list of columns descriptions explicitly
|
virtual void | refresh () |
| resets all new, update rows status to original, removes deleted rows update all indexes
|
virtual size_t | get_row_count () |
| after population and any time after that you can request the number of rows in table
|
virtual size_t | get_column_count () const |
| columns description is pretty much the same as db_server provides
|
virtual dbtypes | get_column_type (size_t index) const |
| returns the virtual terimber dbtype like db_bool, ...
|
virtual const char * | get_column_name (size_t index) const |
| returns the name of the column
|
virtual bool | get_column_nullable (size_t index) const |
| returns the nullable - database specific
|
virtual size_t | get_column_scale (size_t index) const |
| returns the scale
|
virtual size_t | get_column_precision (size_t index) const |
| returns the precision
|
virtual size_t | get_column_max_length (size_t index) const |
| returns the length of the column (only for fixed length columns)
|
virtual terimber_memindex * | add_index (size_t columns, const terimber_index_column_info info[]) |
| creates index to perform the quick search columns the size of index info - array of index column descriptions returns the new created memindex object user must not to use object after returning it back or after memtable will be destoyed this is an expensive operation in order to consume memory and CPU time
|
virtual bool | remove_index (terimber_memindex *obj) |
| destroy index memtable data is still valid all memlookups on the current index will be destroyed!
|
virtual terimber_db_value_vector * | allocate_db_values (size_t count) |
| requests value array
|
virtual void | destroy_db_values (terimber_db_value_vector *obj) |
| destroys value array
|
const memdb_rowset_t & | get_rowset () const |
| returns rowset
|
const binders_t & | get_cols () const |
| returns column binders
|
bool | insert_row (const terimber_db_value_vector *info) |
| inserts new row if row is modified it will still have a status = new if row is removed it's just deleted from recordset inserted row has all columns' value as null
|
bool | update_row (memdb_rowset_citerator_t iter, const terimber_db_value_vector *info) |
| updates row
|
bool | delete_row (memdb_rowset_citerator_t iter) |
| deletes existing row if row was in original recordset (modified or not), it will have a status = delete, and will not be accessible anymore deleting of new row will just remove row from recordset
|
Private Types |
typedef list< memindex * > | list_indexes_t |
| list of memindex pointers
|
typedef list
< terimber_db_value_vector_impl * > | list_values_t |
| list of value vector pointers
|
Private Member Functions |
void | uninit () |
| uninit
|
Private Attributes |
byte_allocator | _allocator |
| internal allocator
|
binders_t | _cols |
| columns binders
|
memdb_rowset_t | _rowset |
| rowset
|
string_t | _error |
| last error
|
mutex | _mtx |
| mutex
|
list_indexes_t | _indexes |
| list of indexes
|
list_values_t | _values |
| list of value vectors
|
Detailed Description
interface to memory table
Definition at line 464 of file memdb.h.
Member Typedef Documentation
Constructor & Destructor Documentation
BEGIN_TERIMBER_NAMESPACE memtable::memtable |
( |
|
) |
|
memtable::~memtable |
( |
|
) |
[virtual] |
Member Function Documentation
const char * memtable::get_last_error |
( |
|
) |
[virtual] |
bool memtable::populate |
( |
dbserver * |
server, |
|
|
size_t |
start_row, |
|
|
size_t |
max_rows | |
|
) |
| | [virtual] |
create internal table structure from server object db_server has to be after executing query or stored procedure and ready to fetch data memtable automatically detects the list of columns in recordset and creates table in memory with the same columns' order and types. max_rows sets a restriction on max rows to be retrived, -1 - all of them start_row means absolute number of row to start with unless you specify 0, the memtable starts with the current row to create an empty table, the fake select can be used for instanse, select CAST(0 as NUMBER) as col1, CAST('' as VARCHAR2(255)) as col2 from dual; or you can specifiy the max_rows = 0
- Parameters:
-
server |
dbserver instance, connected to database and opened the recordset |
start_row |
row to fetch from, 0 - current row |
max_rows |
max row to fetch |
Implements terimber_memtable.
Definition at line 90 of file memtable.cpp.
References _allocator, _cols, _error, memdb_row::_row, _rowset, memdb_row::_status, base_list< T >::back(), copy_db_row(), dbserver::fetch_data(), dbserver::get_column_count(), dbserver::get_column_max_length(), dbserver::get_column_name(), dbserver::get_column_nullable(), dbserver::get_column_precision(), dbserver::get_column_scale(), dbserver::get_column_type(), dbserver::get_error(), dbserver::next(), list< T >::push_back(), _vector< T, A >::resize(), base_vector< T >::size(), status_original, and uninit().
the other alternative for creating an empty table in the memory is column specification the list of columns descriptions explicitly
- Parameters:
-
columns |
number of columns |
desc |
array of columns' descriptors |
Implements terimber_memtable.
Definition at line 143 of file memtable.cpp.
References _allocator, _cols, terimber_table_column_desc::_max_length, terimber_table_column_desc::_nullable, terimber_table_column_desc::_precision, terimber_table_column_desc::_scale, terimber_table_column_desc::_type, _vector< T, A >::resize(), base_vector< T >::size(), and uninit().
void memtable::refresh |
( |
|
) |
[virtual] |
size_t memtable::get_row_count |
( |
|
) |
[virtual] |
size_t memtable::get_column_count |
( |
|
) |
const [virtual] |
dbtypes memtable::get_column_type |
( |
size_t |
index |
) |
const [virtual] |
const char * memtable::get_column_name |
( |
size_t |
index |
) |
const [virtual] |
bool memtable::get_column_nullable |
( |
size_t |
index |
) |
const [virtual] |
size_t memtable::get_column_scale |
( |
size_t |
index |
) |
const [virtual] |
size_t memtable::get_column_precision |
( |
size_t |
index |
) |
const [virtual] |
size_t memtable::get_column_max_length |
( |
size_t |
index |
) |
const [virtual] |
creates index to perform the quick search columns the size of index info - array of index column descriptions returns the new created memindex object user must not to use object after returning it back or after memtable will be destoyed this is an expensive operation in order to consume memory and CPU time
index management there are no connection between the indexes in the memory and the indexes in the database - Parameters:
-
columns |
columns in index |
info |
array of index columns' descriptions |
Implements terimber_memtable.
Definition at line 267 of file memtable.cpp.
References terimber_index_column_info::_asc_sort, terimber_index_column_info::_case_insensitive, _cols, _error, terimber_index_column_info::_index, _indexes, _mtx, memindex::construct(), terimber_log_helper::log_on(), list< T >::push_back(), vector< T >::resize(), base_vector< T >::size(), and str_template::strprint().
const binders_t& memtable::get_cols |
( |
|
) |
const [inline] |
returns column binders
Definition at line 608 of file memdb.h.
References _cols.
inserts new row if row is modified it will still have a status = new if row is removed it's just deleted from recordset inserted row has all columns' value as null
- Parameters:
-
Definition at line 369 of file memtable.cpp.
References _allocator, _cols, _error, _indexes, _mtx, memdb_row::_row, _rowset, memdb_row::_status, base_list< T >::back(), base_list< T >::begin(), copy_db_row(), base_list< T >::end(), terimber_db_value_vector::get_size(), list< T >::push_back(), _vector< T, A >::resize(), base_vector< T >::size(), and status_new.
Referenced by memlookup::insert_row().
updates row
- Parameters:
-
iter |
row iterator for update |
info |
value vector |
Definition at line 401 of file memtable.cpp.
References _allocator, _cols, _error, _indexes, _mtx, base_list< T >::begin(), copy_db_row(), base_list< T >::end(), base_vector< T >::size(), status_deleted, status_new, status_original, and status_updated.
Referenced by memlookup::update_row().
deletes existing row if row was in original recordset (modified or not), it will have a status = delete, and will not be accessible anymore deleting of new row will just remove row from recordset
- Parameters:
-
iter |
row iterator for deletion |
Definition at line 438 of file memtable.cpp.
References _indexes, _mtx, _rowset, base_list< T >::begin(), base_list< T >::end(), list< T >::erase(), status_deleted, status_new, status_original, and status_updated.
Referenced by memlookup::delete_row().
void memtable::uninit |
( |
|
) |
[private] |
uninit
Definition at line 52 of file memtable.cpp.
References _allocator, _cols, _indexes, _mtx, _rowset, _values, base_list< T >::begin(), _vector< T, A >::clear(), list< T >::clear(), byte_allocator::clear_all(), and base_list< T >::end().
Referenced by create(), populate(), and ~memtable().
Member Data Documentation
columns binders
Definition at line 637 of file memdb.h.
Referenced by add_index(), create(), get_cols(), get_column_count(), get_column_max_length(), get_column_name(), get_column_nullable(), get_column_precision(), get_column_scale(), get_column_type(), insert_row(), populate(), uninit(), and update_row().
The documentation for this class was generated from the following files:
|
|
|
|