Thread portable class


Gate portable class


Timer class


Pool class


Terimber 2.0


About C++


Downloads Products & Services Support Clients Open Source About



Home / Open source / Terimber 2.0

memlookup Class Reference

implementation of terimber_memlookup interface More...

#include <memdb.h>

Inheritance diagram for memlookup:

terimber_memlookup terimber_log_helper terimber_log

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_tget_value_as_wstring (size_t index) const
 gets the value as a wide string function returns the pointer to wide string
virtual const ub1_tget_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_tget_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]

memlookup::~memlookup (  )  [protected, virtual]

destructor

Definition at line 494 of file memlookup.cpp.


Member Function Documentation

bool memlookup::assign ( const terimber_memlookup x  )  [virtual]

copy method lookups must be created for the same index

Parameters:
x  input lookup

Implements terimber_memlookup.

Definition at line 538 of file memlookup.cpp.

References _current_iter, _low_bounder, _parent, and _upper_bounder.

bool memlookup::reset ( const terimber_db_value_vector info  )  [virtual]

navigation methods

sets lookup outside the row sequence and initialize the selection criteria

Parameters:
info  value vector

Implements terimber_memlookup.

Definition at line 557 of file memlookup.cpp.

References construct().

bool memlookup::next (  )  const [virtual]

tries to find the next row according to lookup values

Implements terimber_memlookup.

Definition at line 567 of file memlookup.cpp.

References _current_iter, _low_bounder, and _upper_bounder.

bool memlookup::prev (  )  const [virtual]

tries to find the previous row according to lookup values

Implements terimber_memlookup.

Definition at line 585 of file memlookup.cpp.

References _current_iter, _low_bounder, and _upper_bounder.

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:
index  index

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]

gets the value as a boolean

Parameters:
index  index

Implements terimber_memlookup.

Definition at line 624 of file memlookup.cpp.

References _terimber_xml_value_::boolVal, get_value_as_value(), and vt_bool.

sb1_t memlookup::get_value_as_char ( size_t  index  )  const [virtual]

gets the value as a char

Parameters:
index  index

Implements terimber_memlookup.

Definition at line 630 of file memlookup.cpp.

References _terimber_xml_value_::cVal, get_value_as_value(), and vt_sb1.

ub1_t memlookup::get_value_as_byte ( size_t  index  )  const [virtual]

gets the value as a byte

Parameters:
index  index

Implements terimber_memlookup.

Definition at line 636 of file memlookup.cpp.

References _terimber_xml_value_::bVal, get_value_as_value(), and vt_ub1.

sb2_t memlookup::get_value_as_short ( size_t  index  )  const [virtual]

gets the value as a short

Parameters:
index  index

Implements terimber_memlookup.

Definition at line 642 of file memlookup.cpp.

References get_value_as_value(), _terimber_xml_value_::iVal, and vt_sb2.

ub2_t memlookup::get_value_as_word ( size_t  index  )  const [virtual]

gets the value as a unsigned short

Parameters:
index  index

Implements terimber_memlookup.

Definition at line 648 of file memlookup.cpp.

References get_value_as_value(), _terimber_xml_value_::uiVal, and vt_ub2.

sb4_t memlookup::get_value_as_long ( size_t  index  )  const [virtual]

gets the value as a long

Parameters:
index  index

Implements terimber_memlookup.

Definition at line 654 of file memlookup.cpp.

References get_value_as_value(), _terimber_xml_value_::lVal, and vt_sb4.

ub4_t memlookup::get_value_as_dword ( size_t  index  )  const [virtual]

gets the value as a unsigned long

Parameters:
index  index

Implements terimber_memlookup.

Definition at line 660 of file memlookup.cpp.

References get_value_as_value(), _terimber_xml_value_::ulVal, and vt_ub4.

float memlookup::get_value_as_float ( size_t  index  )  const [virtual]

gets the value as a float

Parameters:
index  index

Implements terimber_memlookup.

Definition at line 666 of file memlookup.cpp.

References _terimber_xml_value_::fltVal, get_value_as_value(), and vt_float.

double memlookup::get_value_as_double ( size_t  index  )  const [virtual]

gets the value as a double

Parameters:
index  index

Implements terimber_memlookup.

Definition at line 672 of file memlookup.cpp.

References _terimber_xml_value_::dblVal, get_value_as_value(), and vt_double.

sb8_t memlookup::get_value_as_long64 ( size_t  index  )  const [virtual]

gets the value as a int64

Parameters:
index  index

Implements terimber_memlookup.

Definition at line 683 of file memlookup.cpp.

References get_value_as_value(), _terimber_xml_value_::intVal, and vt_sb8.

ub8_t memlookup::get_value_as_dword64 ( size_t  index  )  const [virtual]

gets the value as a unsigned int64

Parameters:
index  index

Implements terimber_memlookup.

Definition at line 694 of file memlookup.cpp.

References get_value_as_value(), _terimber_xml_value_::uintVal, and vt_ub8.

bool memlookup::get_value_as_guid ( size_t  index,
guid_t val 
) const [virtual]

gets the value as a guid for high performance we are using reference

Parameters:
index  index

Implements terimber_memlookup.

Definition at line 706 of file memlookup.cpp.

References get_value_as_value(), _terimber_xml_value_::guidVal, and vt_guid.

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:
index  index

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]

gets the value as a decimal delimeter defines the desirable delimeter sign

Parameters:
index  index

Implements terimber_memlookup.

Definition at line 743 of file memlookup.cpp.

References get_value_as_numeric().

bool memlookup::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 [virtual]

gets the value as a date to avoid confusions with different date formats, functions return parsed date

Parameters:
index  index
year  [out] year [0-1000000]
month  [out] month [1-12]
day  [out] day [1-31]
hour  [out] hour [0-23]
minute  [out] minute [0-59]
second  [out] second [0-59]
millisec  [out] millisecond [0-999]
wday  [out] day of week [1-7]
yday  [out] day of year [1-366]

Implements terimber_memlookup.

Definition at line 750 of file memlookup.cpp.

References date::convert_from(), get_value_as_value(), _terimber_xml_value_::intVal, and vt_date.

const char * memlookup::get_value_as_string ( size_t  index  )  const [virtual]

gets the value as a string function returns the pointer to string

Parameters:
index  index

Implements terimber_memlookup.

Definition at line 766 of file memlookup.cpp.

References get_value_as_value(), _terimber_xml_value_::strVal, and vt_string.

const wchar_t * memlookup::get_value_as_wstring ( size_t  index  )  const [virtual]

gets the value as a wide string function returns the pointer to wide string

Parameters:
index  index

Implements terimber_memlookup.

Definition at line 773 of file memlookup.cpp.

References get_value_as_value(), vt_wstring, and _terimber_xml_value_::wstrVal.

const ub1_t * memlookup::get_value_as_binary ( size_t  index,
size_t &  len 
) const [virtual]

gets the value as a binary returns pointer to the raw bytes size of bytes is put to len

Parameters:
index  index

Implements terimber_memlookup.

Definition at line 782 of file memlookup.cpp.

References _terimber_xml_value_::bufVal, get_value_as_value(), and vt_binary.

const ub1_t * memlookup::get_value_as_binary_ptr ( size_t  index  )  const [virtual]

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

Parameters:
index  index

Implements terimber_memlookup.

Definition at line 794 of file memlookup.cpp.

References _terimber_xml_value_::bufVal, get_value_as_value(), and vt_binary.

bool memlookup::insert_row ( const terimber_db_value_vector info  )  [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:
info  value vector

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]

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

Implements terimber_memlookup.

Definition at line 854 of file memlookup.cpp.

References _current_iter, _parent, _upper_bounder, memtable::delete_row(), and memindex::get_table().

bool memlookup::update_row ( const terimber_db_value_vector info  )  [virtual]

updates the column value update of new row will preserve status = new update of original row will change status from original to update.

Parameters:
info  value vector

Implements terimber_memlookup.

Definition at line 872 of file memlookup.cpp.

References _current_iter, _parent, _upper_bounder, memindex::get_table(), and memtable::update_row().

terimber_db_row_status memlookup::get_row_status (  )  [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.

void memlookup::notify ( memdb_index_citer_t  iter,
bool  insert_or_delete 
) [private]

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.


Friends And Related Function Documentation

friend class memindex [friend]

memindex

Definition at line 734 of file memdb.h.


Member Data Documentation

temporary allocator

Definition at line 972 of file memdb.h.

Referenced by construct(), get_value_as_numeric(), and get_value_as_value().

parent memory index

Definition at line 973 of file memdb.h.

Referenced by assign(), construct(), delete_row(), get_value_as_value(), get_value_is_null(), insert_row(), memlookup(), notify(), and update_row().

lower bound iterator

Definition at line 974 of file memdb.h.

Referenced by assign(), construct(), next(), notify(), and prev().

consition allocator

Definition at line 977 of file memdb.h.

Referenced by memlookup().

condition rowset

Definition at line 978 of file memdb.h.

Referenced by construct(), memlookup(), and notify().


The documentation for this class was generated from the following files:


© Copyright Terimber 2003-.