|
|
|
Home / Open source / Terimber 2.0
memlookup Class Referenceimplementation of terimber_memlookup interface
More...
#include <memdb.h>
List of all members.
|
Public Member Functions |
virtual bool | assign (const terimber_memlookup &x) |
| copy method lookups must be created for the same index
|
virtual bool | reset (const terimber_db_value_vector *info) |
| navigation methods
|
virtual bool | next () const |
| tries to find the next row according to lookup values
|
virtual bool | prev () const |
| tries to find the previous row according to lookup values
|
virtual bool | get_value_is_null (size_t index) const |
| checks if value is null
|
virtual bool | get_value_as_bool (size_t index) const |
| gets the value as a boolean
|
virtual sb1_t | get_value_as_char (size_t index) const |
| gets the value as a char
|
virtual ub1_t | get_value_as_byte (size_t index) const |
| gets the value as a byte
|
virtual sb2_t | get_value_as_short (size_t index) const |
| gets the value as a short
|
virtual ub2_t | get_value_as_word (size_t index) const |
| gets the value as a unsigned short
|
virtual sb4_t | get_value_as_long (size_t index) const |
| gets the value as a long
|
virtual ub4_t | get_value_as_dword (size_t index) const |
| gets the value as a unsigned long
|
virtual float | get_value_as_float (size_t index) const |
| gets the value as a float
|
virtual double | get_value_as_double (size_t index) const |
| gets the value as a double
|
virtual sb8_t | get_value_as_long64 (size_t index) const |
| gets the value as a int64
|
virtual ub8_t | get_value_as_dword64 (size_t index) const |
| gets the value as a unsigned int64
|
virtual bool | get_value_as_guid (size_t index, guid_t &val) const |
| gets the value as a guid for high performance we are using reference
|
virtual const char * | get_value_as_numeric (size_t index, char delimeter) const |
| gets the value as a numeric delimeter defines the desirable delimeter sign
|
virtual const char * | get_value_as_decimal (size_t index, char delimeter) const |
| gets the value as a decimal delimeter defines the desirable delimeter sign
|
virtual bool | get_value_as_date (size_t index, ub4_t &year, ub1_t &month, ub1_t &day, ub1_t &hour, ub1_t &minute, ub1_t &second, ub2_t &millisec, ub1_t &wday, ub2_t &yday) const |
| gets the value as a date to avoid confusions with different date formats, functions return parsed date
|
virtual const char * | get_value_as_string (size_t index) const |
| gets the value as a string function returns the pointer to string
|
virtual const wchar_t * | get_value_as_wstring (size_t index) const |
| gets the value as a wide string function returns the pointer to wide string
|
virtual const ub1_t * | get_value_as_binary (size_t index, size_t &len) const |
| gets the value as a binary returns pointer to the raw bytes size of bytes is put to len
|
virtual const ub1_t * | get_value_as_binary_ptr (size_t index) const |
| gets the value as a binary pointer for reusing only the format of buffer is as follows first size_t bytes the length of the rest of buffer, which contains the raw byte data
|
virtual bool | insert_row (const terimber_db_value_vector *info) |
| inserts new row if the row is modified it will still have a status = new if the row is removed it's just deleted from recordset inserted row has all columns' value as null
|
virtual bool | delete_row () |
| delete 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
|
virtual bool | update_row (const terimber_db_value_vector *info) |
| updates the column value update of new row will preserve status = new update of original row will change status from original to update.
|
virtual terimber_db_row_status | get_row_status () |
| returns the current status user can't get the status of row already deleted however if lookup is created from empty index, then all rows are available to see including deleted ones
|
Protected Member Functions |
| memlookup (memindex &parent) |
| constructor
|
virtual | ~memlookup () |
| destructor
|
bool | construct (const terimber_db_value_vector_impl *info) |
| constructs lookup
|
Private Member Functions |
void | notify (memdb_index_citer_t iter, bool insert_or_delete) |
| make changes according to the action
|
terimber_xml_value | get_value_as_value (size_t index, vt_types type) const |
| converts value to the different type
|
Private Attributes |
byte_allocator | _tmp_allocator |
| temporary allocator
|
memindex & | _parent |
| parent memory index
|
memdb_index_citer_t | _low_bounder |
| lower bound iterator
|
memdb_index_citer_t | _upper_bounder |
| upper bound iterator
|
memdb_index_citer_t | _current_iter |
| current iterator
|
byte_allocator | _condition_allocator |
| consition allocator
|
memdb_rowset_t | _condition_rowset |
| condition rowset
|
Friends |
class | memindex |
| memindex
|
Detailed Description
implementation of terimber_memlookup interface
Definition at line 730 of file memdb.h.
Constructor & Destructor Documentation
memlookup::memlookup |
( |
memindex & |
parent |
) |
[protected] |
constructor
- Parameters:
-
parent |
parent index table |
Definition at line 474 of file memlookup.cpp.
References _condition_allocator, _condition_rowset, _parent, base_list< T >::begin(), base_map< K, T, Pr, M >::comp(), memindex::get_index(), memdb_rowset_less::get_info(), list< T >::push_back(), base_vector< T >::size(), and status_lookup.
memlookup::~memlookup |
( |
|
) |
[protected, virtual] |
Member Function Documentation
constructs lookup
- Parameters:
-
Definition at line 499 of file memlookup.cpp.
References _condition_rowset, _current_iter, _low_bounder, _parent, _tmp_allocator, _upper_bounder, base_map< K, T, Pr, M >::begin(), base_list< T >::begin(), base_map< K, T, Pr, M >::comp(), copy_db_row(), base_map< K, T, Pr, M >::end(), base_map< K, T, Pr, M >::equal_range(), pair< T1, T2 >::first, memindex::get_index(), memdb_rowset_less::get_info(), terimber_db_value_vector_impl::get_size(), byte_allocator::reset(), pair< T1, T2 >::second, and base_vector< T >::size().
Referenced by memindex::add_lookup(), and reset().
bool memlookup::next |
( |
|
) |
const [virtual] |
bool memlookup::prev |
( |
|
) |
const [virtual] |
bool memlookup::get_value_is_null |
( |
size_t |
index |
) |
const [virtual] |
checks if value is null
access to the row this is pretty much the same as db_server provides. returns the value of the column at the current row position if the index is out of range then zero will be returnes if the type is mismatched then an attempt to convert will be made the convertion of internal values is made on the temporary allocator the returned pointer is valid until the next call the best practice to check type before call get value functions - Parameters:
-
Implements terimber_memlookup.
Definition at line 614 of file memlookup.cpp.
References _current_iter, _parent, _upper_bounder, memtable::get_column_count(), and memindex::get_table().
bool memlookup::get_value_as_bool |
( |
size_t |
index |
) |
const [virtual] |
sb1_t memlookup::get_value_as_char |
( |
size_t |
index |
) |
const [virtual] |
ub1_t memlookup::get_value_as_byte |
( |
size_t |
index |
) |
const [virtual] |
sb2_t memlookup::get_value_as_short |
( |
size_t |
index |
) |
const [virtual] |
ub2_t memlookup::get_value_as_word |
( |
size_t |
index |
) |
const [virtual] |
sb4_t memlookup::get_value_as_long |
( |
size_t |
index |
) |
const [virtual] |
ub4_t memlookup::get_value_as_dword |
( |
size_t |
index |
) |
const [virtual] |
float memlookup::get_value_as_float |
( |
size_t |
index |
) |
const [virtual] |
double memlookup::get_value_as_double |
( |
size_t |
index |
) |
const [virtual] |
sb8_t memlookup::get_value_as_long64 |
( |
size_t |
index |
) |
const [virtual] |
ub8_t memlookup::get_value_as_dword64 |
( |
size_t |
index |
) |
const [virtual] |
bool memlookup::get_value_as_guid |
( |
size_t |
index, |
|
|
guid_t & |
val | |
|
) |
| | const [virtual] |
const char * memlookup::get_value_as_numeric |
( |
size_t |
index, |
|
|
char |
delimeter | |
|
) |
| | const [virtual] |
gets the value as a numeric delimeter defines the desirable delimeter sign
- Parameters:
-
Implements terimber_memlookup.
Definition at line 718 of file memlookup.cpp.
References _tmp_allocator, byte_allocator::allocate(), _terimber_xml_value_::bufVal, numeric::format(), get_value_as_value(), numeric::is_zero(), numeric::parse_orcl(), numeric::precision(), numeric::scale(), numeric::sign(), and vt_numeric.
Referenced by get_value_as_decimal().
const char * memlookup::get_value_as_decimal |
( |
size_t |
index, |
|
|
char |
delimeter | |
|
) |
| | const [virtual] |
const char * memlookup::get_value_as_string |
( |
size_t |
index |
) |
const [virtual] |
const wchar_t * memlookup::get_value_as_wstring |
( |
size_t |
index |
) |
const [virtual] |
const ub1_t * memlookup::get_value_as_binary |
( |
size_t |
index, |
|
|
size_t & |
len | |
|
) |
| | const [virtual] |
const ub1_t * memlookup::get_value_as_binary_ptr |
( |
size_t |
index |
) |
const [virtual] |
inserts new row if the row is modified it will still have a status = new if the row is removed it's just deleted from recordset inserted row has all columns' value as null
row modificators the current row can be changed there are possible scenarios 1. inserts the new row - it will become the current one 2. updates the current row - it will be the same current row, only index columns are affected 3. deletes the current row - the current row will be next to the current one or current will point to the out of row sequence - Parameters:
-
Implements terimber_memlookup.
Definition at line 839 of file memlookup.cpp.
References _parent, memindex::get_table(), and memtable::insert_row().
bool memlookup::delete_row |
( |
|
) |
[virtual] |
returns the current status user can't get the status of row already deleted however if lookup is created from empty index, then all rows are available to see including deleted ones
so far the possible status changes are "original -> "update" "original -> "delete" "original -> "update" -> "delete" "new" will be always "new" unless row will be deleted, there will be no status so.
Implements terimber_memlookup.
Definition at line 892 of file memlookup.cpp.
References _current_iter, _upper_bounder, and status_deleted.
make changes according to the action
- Parameters:
-
iter |
affected row iterator |
insert_or_delete |
remove row or not |
Definition at line 901 of file memlookup.cpp.
References _condition_rowset, _current_iter, _low_bounder, _parent, _upper_bounder, base_list< T >::begin(), base_map< K, T, Pr, M >::end(), base_map< K, T, Pr, M >::equal_range(), pair< T1, T2 >::first, memindex::get_index(), and pair< T1, T2 >::second.
converts value to the different type
- Parameters:
-
index |
index |
type |
output type |
Definition at line 800 of file memlookup.cpp.
References _current_iter, _parent, exception::_throw(), _tmp_allocator, _upper_bounder, dbserver_impl::convert_types(), memtable::get_column_count(), memtable::get_column_type(), memindex::get_table(), parse_value(), persist_value(), and byte_allocator::reset().
Referenced by get_value_as_binary(), get_value_as_binary_ptr(), get_value_as_bool(), get_value_as_byte(), get_value_as_char(), get_value_as_date(), get_value_as_double(), get_value_as_dword(), get_value_as_dword64(), get_value_as_float(), get_value_as_guid(), get_value_as_long(), get_value_as_long64(), get_value_as_numeric(), get_value_as_short(), get_value_as_string(), get_value_as_word(), and get_value_as_wstring().
Friends And Related Function Documentation
Member Data Documentation
The documentation for this class was generated from the following files:
|
|
|
|