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

dbserver Class Reference

class implements the access to database in the general way More...

#include <dbaccess.h>

Inheritance diagram for dbserver:

terimber_log_helper terimber_log dbserver_impl mysql_dbserver odbc_dbserver orcl_dbserver

List of all members.

Public Member Functions

virtual ~dbserver ()
 destructor
virtual size_t get_ident () const =0
 returns current ident to distingush different instances of dbserver
virtual bool is_ready () const =0
 returns current state to check if the sql asynchronous action completed.
virtual size_t get_code () const =0
 returns error code
virtual const char * get_error () const =0
 returns error description, NULL will be returned if there are no errors
virtual bool connect (bool trusted_connection, const char *connect_string)=0
 db connection methods
virtual bool disconnect ()=0
 closes connection
virtual bool start_transaction ()=0
 starts transaction
virtual bool commit ()=0
 commits transaction
virtual bool rollback ()=0
 rolls back transaction
virtual bool is_connect () const =0
 returns the connection status
virtual bool is_in_transaction () const =0
 returns the transaction status
virtual bool is_connect_alive ()=0
 checks if the connection is alive or not
virtual bool resize_params (size_t size)=0
 sql methods
virtual size_t get_param_count () const =0
 gets param count
virtual dbtypes get_param_type (size_t index) const =0
 returns the virtual terimber type like db_bool, ...
virtual db_param_type get_param_in_out (size_t index) const =0
 returns the in/out
virtual bool get_param_is_null (size_t index) const =0
 returns the nullable - database specific
virtual bool get_param_as_bool (size_t index) const =0
 returns param value
virtual sb1_t get_param_as_char (size_t index) const =0
 get parameter as char conversion can be made
virtual ub1_t get_param_as_byte (size_t index) const =0
 gets the parameter as a byte conversion can be made
virtual sb2_t get_param_as_short (size_t index) const =0
 gets the parameter as a short conversion can be made
virtual ub2_t get_param_as_word (size_t index) const =0
 gets the parameter as an unsigned short conversion can be made
virtual sb4_t get_param_as_long (size_t index) const =0
 gets the parameter as a long int (4 bytes) conversion can be made
virtual ub4_t get_param_as_dword (size_t index) const =0
 gets the parameter as an unsigned long int (4 bytes) conversion can be made
virtual float get_param_as_float (size_t index) const =0
 gets the parameter as a float (4 bytes) conversion can be made
virtual double get_param_as_double (size_t index) const =0
 gets the parameter as a double (8 bytes) conversion can be made
virtual sb8_t get_param_as_long64 (size_t index) const =0
 gets the parameter as a signed long long (8 bytes) conversion can be made
virtual ub8_t get_param_as_dword64 (size_t index) const =0
 gets the parameter as an unsigned long long (8 bytes) conversion can be made
virtual bool get_param_as_guid (size_t index, guid_t &val) const =0
 gets the parameter as a guid conversion can be made for high performance we are using reference
virtual const char * get_param_as_numeric (size_t index, char delimeter) const =0
 gets the parameter as a word conversion can be made delimeter defines the desirable delimeter sign
virtual const char * get_param_as_decimal (size_t index, char delimeter) const =0
 gets the parameter as a word conversion can be made delimeter defines the desirable delimeter sign
virtual bool get_param_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 =0
 gets the parameter as a word conversion can be made to avoid confusions with different date format functions returns parsed date
virtual const char * get_param_as_string (size_t index) const =0
 gets the parameter as a word conversion can be made function returns the pointer to the string
virtual const wchar_tget_param_as_wstring (size_t index) const =0
 gets the parameter as a word conversion can be made function returns the pointer to the wide string
virtual const ub1_tget_param_as_binary (size_t index, size_t &len) const =0
 function returns the pointer to byte array len will contain the length of byte array
virtual const ub1_tget_param_as_binary_ptr (size_t index) const =0
 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 set_param_as_null (size_t index, db_param_type in_out, dbtypes type)=0
 sets the parameter as null
virtual bool set_param_as_bool (size_t index, db_param_type in_out, bool val)=0
 sets the parameter as a bool
virtual bool set_param_as_char (size_t index, db_param_type in_out, sb1_t val)=0
 sets the parameter as a char
virtual bool set_param_as_byte (size_t index, db_param_type in_out, ub1_t val)=0
 sets the parameter as a byte
virtual bool set_param_as_short (size_t index, db_param_type in_out, sb2_t val)=0
 sets the parameter as a signed short (2 bytes)
virtual bool set_param_as_word (size_t index, db_param_type in_out, ub2_t val)=0
 sets the parameter as an unsigned short (2 bytes)
virtual bool set_param_as_long (size_t index, db_param_type in_out, sb4_t val)=0
 sets the parameter as a long int (4 bytes)
virtual bool set_param_as_dword (size_t index, db_param_type in_out, ub4_t val)=0
 sets the parameter as an unsigned long int (4 bytes)
virtual bool set_param_as_float (size_t index, db_param_type in_out, float val)=0
 sets the parameter as a float (4 bytes)
virtual bool set_param_as_double (size_t index, db_param_type in_out, double val)=0
 sets the parameter as a double (8 bytes)
virtual bool set_param_as_long64 (size_t index, db_param_type in_out, sb8_t val)=0
 sets the parameter as a long long int (8 bytes)
virtual bool set_param_as_dword64 (size_t index, db_param_type in_out, ub8_t val)=0
 sets the parameter as an unsigned long long int (8 bytes)
virtual bool set_param_as_guid (size_t index, db_param_type in_out, const guid_t &val)=0
 sets the parameter as a guid
virtual bool set_param_as_numeric (size_t index, db_param_type in_out, const char *val, char delimeter)=0
 sets the parameter as numeric
virtual bool set_param_as_decimal (size_t index, db_param_type in_out, const char *val, char delimeter)=0
 sets the parameter as a decimal
virtual bool set_param_as_date (size_t index, db_param_type in_out, ub4_t year, ub1_t month, ub1_t day, ub1_t hour, ub1_t minute, ub1_t second, ub2_t millisec)=0
 sets the parameter as a date
virtual bool set_param_as_string (size_t index, db_param_type in_out, const char *val, size_t len, size_t max_len=0)=0
 sets the parameter as a string for 0 terminated string len can be -1 max_len for output parameter only
virtual bool set_param_as_string_ptr (size_t index, const char *val)=0
 sets the parameter as a string pointer to avoid copying already allocated memory, only the pointer can be used be careful! the caller is responsible for the life time of the provided pointer, which has to be valid until the sql statement has been executed. it supposed that it will work only for the input parameters, not for output or input/output ones
virtual bool set_param_as_wstring (size_t index, db_param_type in_out, const wchar_t *val, size_t len, size_t max_len=0)=0
 sets the parameter as a wide string for 0 terminated string len can be -1 max_len for output parameter only
virtual bool set_param_as_wstring_ptr (size_t index, const wchar_t *val)=0
 sets the parameter as a wide string pointer to avoid copying the already allocated huge memory, only the pointer can be used be careful! the caller is responsible for the life time of provided pointer, which has to be valid until the sql statement is been executing. it is supposed to work only for input parameters, not for output or input/output ones
virtual bool set_param_as_binary (size_t index, db_param_type in_out, const ub1_t *val, size_t len, size_t max_len=0)=0
 sets the parameter as a wide string pointer val points to the valid buffer of raw byte of "len" length max_len for output parameter only
virtual bool set_param_as_binary_ptr (size_t index, const ub1_t *val)=0
 sets the parameter as a wide string pointer to avoid copying the already allocated huge memory, only the pointer can be used be careful! the caller is responsible for the life time of the provided pointer, which has to be valid until the sql statement is been executing. the format of buffer must be as follow first size_t bytes the length of the rest of buffer, which contains the raw byte data it is supposed to only work for input parameters, not for output or input/output ones
virtual size_t get_column_count () const =0
 internal columns access
virtual dbtypes get_column_type (size_t index) const =0
 returns the virtual terimber dbtype like db_bool, ...
virtual const char * get_column_name (size_t index) const =0
 returns the name of the column
virtual bool get_column_nullable (size_t index) const =0
 returns the nullable - database specific
virtual size_t get_column_scale (size_t index) const =0
 returns the scale
virtual size_t get_column_precision (size_t index) const =0
 returns the precision
virtual size_t get_column_max_length (size_t index) const =0
 returns the length of column (only for fixed length columns)
virtual size_t get_row_count () const =0
 rowset navigation methods
virtual void reset () const =0
 resets the internal cursor to the out of end
virtual bool next () const =0
 tries to find the next row, after reset it goes to the first row
virtual bool prev () const =0
 tries to find the previous row, after reset it goes to the last row
virtual bool get_value_is_null (size_t index) const =0
 returns the value of the column at the current row position
virtual bool get_value_as_bool (size_t index) const =0
 gets the value as a boolean
virtual sb1_t get_value_as_char (size_t index) const =0
 gets the value as a char
virtual ub1_t get_value_as_byte (size_t index) const =0
 gets the value as a byte
virtual sb2_t get_value_as_short (size_t index) const =0
 gets the value as a short int (2 bytes)
virtual ub2_t get_value_as_word (size_t index) const =0
 gets the value as an unsigned short int (2 bytes)
virtual sb4_t get_value_as_long (size_t index) const =0
 gets the value as a long int (4 bytes)
virtual ub4_t get_value_as_dword (size_t index) const =0
 gets the value as an unsigned long int (4 bytes)
virtual float get_value_as_float (size_t index) const =0
 gets the value as a float (4 bytes)
virtual double get_value_as_double (size_t index) const =0
 gets the value as a double (8 bytes)
virtual sb8_t get_value_as_long64 (size_t index) const =0
 gets the value as a long long int (8 bytes)
virtual ub8_t get_value_as_dword64 (size_t index) const =0
 gets the value as an unsigned long long int (8 bytes)
virtual bool get_value_as_guid (size_t index, guid_t &val) const =0
 gets the value as a guid
virtual const char * get_value_as_numeric (size_t index, char delimeter) const =0
 gets the value as a guid delimeter defines the desirable delimeter sign
virtual const char * get_value_as_decimal (size_t index, char delimeter) const =0
 gets the value as a guid 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 =0
 gets the value as a date to avoid confusions with different date format the functions return parsed date
virtual const char * get_value_as_string (size_t index) const =0
 gets the value as a date function returns the pointer to string
virtual const wchar_tget_value_as_wstring (size_t index) const =0
 function returns the pointer to wide string
virtual const ub1_tget_value_as_binary (size_t index, size_t &len) const =0
 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 =0
 returns pointer to the raw bytes for reusing only the format of buffer is as follow first size_t bytes the length of the rest of buffer, which contains the raw byte data
virtual bool is_open_sql () const =0
 checks the state of the sql request
virtual bool open_sql (bool async, const char *sql)=0
 executes the parameterized sql statement with recordset result
virtual bool exec_sql (bool async, const char *sql)=0
 executes the parameterized sql statement without recordset result
virtual bool open_proc (bool async, const char *name)=0
 executes the stored procedure with recordset result
virtual bool exec_proc (bool async, const char *name)=0
 executes the stored procedure without recordset result
virtual bool fetch_data (bool async, size_t start_row, size_t num_rows, bool forward)=0
 fetches the data and returns the recordset defines the start row, numbers rows and fetches direction if start_row is 0 then the fetch starts from the position after the last position fetched before if start_row > 0 then start_row is considered as absolute row number in recordset
virtual bool close_sql ()=0
 closes sql - free allocated resources
virtual bool interrupt_request ()=0
 interrupts asynchronous request
virtual bool set_quote (char quote)=0
 sets quote the syntax of sql statement with parameters must be understandable for internal sql processor therefore it should look like selects * from the table where pk = :pk here ':' char is an identificator of parameter with name "pk" function set_quote allows to change this identificator to the preferable one ':' is a default identificator
virtual void set_callback (async_db_notify *target)=0
 sets the callback function for asynchronous actions
virtual void remove_callback (async_db_notify *target)=0
 remove the callback function for asynchronous actions
virtual bool param_bulk_store ()=0
 bulk operation support caller should very careful with these functionality current set of parameters previously set by set_param_* functions will be moved to the bulk parameters list the current parameters set will have the same values, but will not participate in bulk operations moreover if the next call set_param_* function will change the type - all bulk parameters will be deleted.
virtual bool param_bulk_remove ()=0
 removes the last stored bulk parameter
virtual bool param_bulk_remove_all ()=0
 removes all stored bulk parameters


Detailed Description

class implements the access to database in the general way

Definition at line 54 of file dbaccess.h.


Constructor & Destructor Documentation

virtual dbserver::~dbserver (  )  [inline, virtual]

destructor

Definition at line 59 of file dbaccess.h.


Member Function Documentation

virtual size_t dbserver::get_ident (  )  const [pure virtual]

returns current ident to distingush different instances of dbserver

base methods

Implemented in dbserver_impl.

virtual bool dbserver::is_ready (  )  const [pure virtual]

returns current state to check if the sql asynchronous action completed.

Implemented in dbserver_impl.

virtual size_t dbserver::get_code (  )  const [pure virtual]

returns error code

Implemented in dbserver_impl.

virtual const char* dbserver::get_error (  )  const [pure virtual]

returns error description, NULL will be returned if there are no errors

Implemented in dbserver_impl.

Referenced by memtable::populate().

virtual bool dbserver::connect ( bool  trusted_connection,
const char *  connect_string 
) [pure virtual]

db connection methods

establish db connection the syntax of the connection string depends on db server type ODBC syntax: DSN=alias;UID=user;PWD=password MYSQL syntax: UID=user;PWD=password;HOST=hostname;PORT=port;DB=database;

Parameters:
trusted_connection  flag trusted connection, if BD sever supports trusted connections
connect_string  connection string

Implemented in dbserver_impl.

Referenced by db_creator< T >::activate().

virtual bool dbserver::disconnect (  )  [pure virtual]

closes connection

Implemented in dbserver_impl.

Referenced by db_creator< T >::deactivate().

virtual bool dbserver::start_transaction (  )  [pure virtual]

starts transaction

Implemented in dbserver_impl.

virtual bool dbserver::commit (  )  [pure virtual]

commits transaction

Implemented in dbserver_impl.

virtual bool dbserver::rollback (  )  [pure virtual]

rolls back transaction

Implemented in dbserver_impl.

Referenced by db_creator< T >::back().

virtual bool dbserver::is_connect (  )  const [pure virtual]

returns the connection status

Implemented in dbserver_impl.

Referenced by db_creator< T >::activate(), and db_creator< T >::deactivate().

virtual bool dbserver::is_in_transaction (  )  const [pure virtual]

returns the transaction status

Implemented in dbserver_impl.

Referenced by db_creator< T >::back().

virtual bool dbserver::is_connect_alive (  )  [pure virtual]

checks if the connection is alive or not

Implemented in dbserver_impl.

virtual bool dbserver::resize_params ( size_t  size  )  [pure virtual]

sql methods

prepares the sql parameter methods allocates params - the param count can reduced or incresed and the parameters, which shouldn't be affected will be still valid to clear parameters use size == 0

Parameters:
size  number of parameters

Implemented in dbserver_impl.

virtual size_t dbserver::get_param_count (  )  const [pure virtual]

gets param count

Implemented in dbserver_impl.

virtual dbtypes dbserver::get_param_type ( size_t  index  )  const [pure virtual]

returns the virtual terimber type like db_bool, ...

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual db_param_type dbserver::get_param_in_out ( size_t  index  )  const [pure virtual]

returns the in/out

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual bool dbserver::get_param_is_null ( size_t  index  )  const [pure virtual]

returns the nullable - database specific

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual bool dbserver::get_param_as_bool ( size_t  index  )  const [pure virtual]

returns param value

if index out of range then zero will be return if type is mismatched then attempt to convert will be taken the convertion of internal value is made on temporary allocator the returned pointer is valid until next call the best practice to check type before call gets value functions

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual sb1_t dbserver::get_param_as_char ( size_t  index  )  const [pure virtual]

get parameter as char conversion can be made

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual ub1_t dbserver::get_param_as_byte ( size_t  index  )  const [pure virtual]

gets the parameter as a byte conversion can be made

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual sb2_t dbserver::get_param_as_short ( size_t  index  )  const [pure virtual]

gets the parameter as a short conversion can be made

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual ub2_t dbserver::get_param_as_word ( size_t  index  )  const [pure virtual]

gets the parameter as an unsigned short conversion can be made

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual sb4_t dbserver::get_param_as_long ( size_t  index  )  const [pure virtual]

gets the parameter as a long int (4 bytes) conversion can be made

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual ub4_t dbserver::get_param_as_dword ( size_t  index  )  const [pure virtual]

gets the parameter as an unsigned long int (4 bytes) conversion can be made

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual float dbserver::get_param_as_float ( size_t  index  )  const [pure virtual]

gets the parameter as a float (4 bytes) conversion can be made

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual double dbserver::get_param_as_double ( size_t  index  )  const [pure virtual]

gets the parameter as a double (8 bytes) conversion can be made

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual sb8_t dbserver::get_param_as_long64 ( size_t  index  )  const [pure virtual]

gets the parameter as a signed long long (8 bytes) conversion can be made

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual ub8_t dbserver::get_param_as_dword64 ( size_t  index  )  const [pure virtual]

gets the parameter as an unsigned long long (8 bytes) conversion can be made

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual bool dbserver::get_param_as_guid ( size_t  index,
guid_t val 
) const [pure virtual]

gets the parameter as a guid conversion can be made for high performance we are using reference

Parameters:
index  parameter index
val  [out] value

Implemented in dbserver_impl.

virtual const char* dbserver::get_param_as_numeric ( size_t  index,
char  delimeter 
) const [pure virtual]

gets the parameter as a word conversion can be made delimeter defines the desirable delimeter sign

Parameters:
index  parameter index
delimeter  delimdeter like '.' or ','

Implemented in dbserver_impl.

virtual const char* dbserver::get_param_as_decimal ( size_t  index,
char  delimeter 
) const [pure virtual]

gets the parameter as a word conversion can be made delimeter defines the desirable delimeter sign

Parameters:
index  parameter index
delimeter  delimdeter like '.' or ','

Implemented in dbserver_impl.

virtual bool dbserver::get_param_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 [pure virtual]

gets the parameter as a word conversion can be made to avoid confusions with different date format functions returns parsed date

Parameters:
index  parameter 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] millisec [0-999]
wday  [out] wday [1-7]
yday  [out] yday [1-366]

Implemented in dbserver_impl.

virtual const char* dbserver::get_param_as_string ( size_t  index  )  const [pure virtual]

gets the parameter as a word conversion can be made function returns the pointer to the string

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual const wchar_t* dbserver::get_param_as_wstring ( size_t  index  )  const [pure virtual]

gets the parameter as a word conversion can be made function returns the pointer to the wide string

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual const ub1_t* dbserver::get_param_as_binary ( size_t  index,
size_t &  len 
) const [pure virtual]

function returns the pointer to byte array len will contain the length of byte array

Parameters:
index  parameter index
len  [out] the length of binaries

Implemented in dbserver_impl.

virtual const ub1_t* dbserver::get_param_as_binary_ptr ( size_t  index  )  const [pure virtual]

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

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_null ( size_t  index,
db_param_type  in_out,
dbtypes  type 
) [pure virtual]

sets the parameter as null

Parameters:
index  parameter index
in_out  in/out parameter property
type  parameter type

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_bool ( size_t  index,
db_param_type  in_out,
bool  val 
) [pure virtual]

sets the parameter as a bool

Parameters:
index  parameter index
in_out  in/out parameter property
val  value

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_char ( size_t  index,
db_param_type  in_out,
sb1_t  val 
) [pure virtual]

sets the parameter as a char

Parameters:
index  parameter index
in_out  in/out parameter property
val  value

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_byte ( size_t  index,
db_param_type  in_out,
ub1_t  val 
) [pure virtual]

sets the parameter as a byte

Parameters:
index  parameter index
in_out  in/out parameter property
val  value

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_short ( size_t  index,
db_param_type  in_out,
sb2_t  val 
) [pure virtual]

sets the parameter as a signed short (2 bytes)

Parameters:
index  parameter index
in_out  in/out parameter property
val  value

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_word ( size_t  index,
db_param_type  in_out,
ub2_t  val 
) [pure virtual]

sets the parameter as an unsigned short (2 bytes)

Parameters:
index  parameter index
in_out  in/out parameter property
val  value

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_long ( size_t  index,
db_param_type  in_out,
sb4_t  val 
) [pure virtual]

sets the parameter as a long int (4 bytes)

Parameters:
index  parameter index
in_out  in/out parameter property
val  value

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_dword ( size_t  index,
db_param_type  in_out,
ub4_t  val 
) [pure virtual]

sets the parameter as an unsigned long int (4 bytes)

Parameters:
index  parameter index
in_out  in/out parameter property
val  value

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_float ( size_t  index,
db_param_type  in_out,
float  val 
) [pure virtual]

sets the parameter as a float (4 bytes)

Parameters:
index  parameter index
in_out  in/out parameter property
val  value

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_double ( size_t  index,
db_param_type  in_out,
double  val 
) [pure virtual]

sets the parameter as a double (8 bytes)

Parameters:
index  parameter index
in_out  in/out parameter property
val  value

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_long64 ( size_t  index,
db_param_type  in_out,
sb8_t  val 
) [pure virtual]

sets the parameter as a long long int (8 bytes)

Parameters:
index  parameter index
in_out  in/out parameter property
val  value

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_dword64 ( size_t  index,
db_param_type  in_out,
ub8_t  val 
) [pure virtual]

sets the parameter as an unsigned long long int (8 bytes)

Parameters:
index  parameter index
in_out  in/out parameter property
val  value

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_guid ( size_t  index,
db_param_type  in_out,
const guid_t val 
) [pure virtual]

sets the parameter as a guid

Parameters:
index  parameter index
in_out  in/out parameter property
val  value

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_numeric ( size_t  index,
db_param_type  in_out,
const char *  val,
char  delimeter 
) [pure virtual]

sets the parameter as numeric

this function depends on the format to avoid the confusions of different numeric and date formats -1223456.7894 - delimeter here is "." -1223456,7894 - delimeter here is ","

Parameters:
index  parameter index
in_out  in/out parameter property
val  value
delimeter  delimeter

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_decimal ( size_t  index,
db_param_type  in_out,
const char *  val,
char  delimeter 
) [pure virtual]

sets the parameter as a decimal

Parameters:
index  parameter index
in_out  in/out parameter property
val  value
delimeter  delimeter

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_date ( size_t  index,
db_param_type  in_out,
ub4_t  year,
ub1_t  month,
ub1_t  day,
ub1_t  hour,
ub1_t  minute,
ub1_t  second,
ub2_t  millisec 
) [pure virtual]

sets the parameter as a date

Parameters:
index  parameter index
in_out  in/out parameter property
year  year [0-1000000]
month  month [1-12]
day  day [1-31]
hour  hour [0-23]
minute  minute [0-59]
second  second [0-59]
millisec  millisec [0-999]

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_string ( size_t  index,
db_param_type  in_out,
const char *  val,
size_t  len,
size_t  max_len = 0 
) [pure virtual]

sets the parameter as a string for 0 terminated string len can be -1 max_len for output parameter only

Parameters:
index  parameter index
in_out  in/out parameter property
val  value
len  string length
max_len  optional expected max length for output parameter

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_string_ptr ( size_t  index,
const char *  val 
) [pure virtual]

sets the parameter as a string pointer to avoid copying already allocated memory, only the pointer can be used be careful! the caller is responsible for the life time of the provided pointer, which has to be valid until the sql statement has been executed. it supposed that it will work only for the input parameters, not for output or input/output ones

Parameters:
index  parameter index
val  value

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_wstring ( size_t  index,
db_param_type  in_out,
const wchar_t val,
size_t  len,
size_t  max_len = 0 
) [pure virtual]

sets the parameter as a wide string for 0 terminated string len can be -1 max_len for output parameter only

Parameters:
index  parameter index
in_out  in/out parameter property
val  value
len  string length
max_len  optional expected max length for output parameter

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_wstring_ptr ( size_t  index,
const wchar_t val 
) [pure virtual]

sets the parameter as a wide string pointer to avoid copying the already allocated huge memory, only the pointer can be used be careful! the caller is responsible for the life time of provided pointer, which has to be valid until the sql statement is been executing. it is supposed to work only for input parameters, not for output or input/output ones

Parameters:
index  parameter index
val  value

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_binary ( size_t  index,
db_param_type  in_out,
const ub1_t val,
size_t  len,
size_t  max_len = 0 
) [pure virtual]

sets the parameter as a wide string pointer val points to the valid buffer of raw byte of "len" length max_len for output parameter only

Parameters:
index  parameter index
in_out  in/out parameter property
val  value
len  byte stream length
max_len  optional expected max length for output parameter

Implemented in dbserver_impl.

virtual bool dbserver::set_param_as_binary_ptr ( size_t  index,
const ub1_t val 
) [pure virtual]

sets the parameter as a wide string pointer to avoid copying the already allocated huge memory, only the pointer can be used be careful! the caller is responsible for the life time of the provided pointer, which has to be valid until the sql statement is been executing. the format of buffer must be as follow first size_t bytes the length of the rest of buffer, which contains the raw byte data it is supposed to only work for input parameters, not for output or input/output ones

Parameters:
index  parameter index
val  value

Implemented in dbserver_impl.

virtual size_t dbserver::get_column_count (  )  const [pure virtual]

internal columns access

gets the column count

Implemented in dbserver_impl.

Referenced by memtable::populate().

virtual dbtypes dbserver::get_column_type ( size_t  index  )  const [pure virtual]

returns the virtual terimber dbtype like db_bool, ...

Parameters:
index  parameter index

Implemented in dbserver_impl.

Referenced by memtable::populate().

virtual const char* dbserver::get_column_name ( size_t  index  )  const [pure virtual]

returns the name of the column

Parameters:
index  parameter index

Implemented in dbserver_impl.

Referenced by memtable::populate().

virtual bool dbserver::get_column_nullable ( size_t  index  )  const [pure virtual]

returns the nullable - database specific

Parameters:
index  parameter index

Implemented in dbserver_impl.

Referenced by memtable::populate().

virtual size_t dbserver::get_column_scale ( size_t  index  )  const [pure virtual]

returns the scale

Parameters:
index  parameter index

Implemented in dbserver_impl.

Referenced by memtable::populate().

virtual size_t dbserver::get_column_precision ( size_t  index  )  const [pure virtual]

returns the precision

Parameters:
index  parameter index

Implemented in dbserver_impl.

Referenced by memtable::populate().

virtual size_t dbserver::get_column_max_length ( size_t  index  )  const [pure virtual]

returns the length of column (only for fixed length columns)

Parameters:
index  parameter index

Implemented in dbserver_impl.

Referenced by memtable::populate().

virtual size_t dbserver::get_row_count (  )  const [pure virtual]

rowset navigation methods

gets the row count

Implemented in dbserver_impl.

virtual void dbserver::reset (  )  const [pure virtual]

resets the internal cursor to the out of end

Implemented in dbserver_impl.

virtual bool dbserver::next (  )  const [pure virtual]

tries to find the next row, after reset it goes to the first row

Implemented in dbserver_impl.

Referenced by memtable::populate().

virtual bool dbserver::prev (  )  const [pure virtual]

tries to find the previous row, after reset it goes to the last row

Implemented in dbserver_impl.

virtual bool dbserver::get_value_is_null ( size_t  index  )  const [pure virtual]

returns the value of the column at the current row position

if index out of range then zero will be return if type is mismatched then attempt to convert will be taken the convertion of internal value is made on temporary allocator the returned pointer is valid until next call the best practice to check type before call gets value functions

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual bool dbserver::get_value_as_bool ( size_t  index  )  const [pure virtual]

gets the value as a boolean

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual sb1_t dbserver::get_value_as_char ( size_t  index  )  const [pure virtual]

gets the value as a char

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual ub1_t dbserver::get_value_as_byte ( size_t  index  )  const [pure virtual]

gets the value as a byte

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual sb2_t dbserver::get_value_as_short ( size_t  index  )  const [pure virtual]

gets the value as a short int (2 bytes)

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual ub2_t dbserver::get_value_as_word ( size_t  index  )  const [pure virtual]

gets the value as an unsigned short int (2 bytes)

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual sb4_t dbserver::get_value_as_long ( size_t  index  )  const [pure virtual]

gets the value as a long int (4 bytes)

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual ub4_t dbserver::get_value_as_dword ( size_t  index  )  const [pure virtual]

gets the value as an unsigned long int (4 bytes)

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual float dbserver::get_value_as_float ( size_t  index  )  const [pure virtual]

gets the value as a float (4 bytes)

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual double dbserver::get_value_as_double ( size_t  index  )  const [pure virtual]

gets the value as a double (8 bytes)

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual sb8_t dbserver::get_value_as_long64 ( size_t  index  )  const [pure virtual]

gets the value as a long long int (8 bytes)

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual ub8_t dbserver::get_value_as_dword64 ( size_t  index  )  const [pure virtual]

gets the value as an unsigned long long int (8 bytes)

Parameters:
index  parameter index

Implemented in dbserver_impl.

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

gets the value as a guid

Parameters:
index  parameter index
val  [out] value

Implemented in dbserver_impl.

virtual const char* dbserver::get_value_as_numeric ( size_t  index,
char  delimeter 
) const [pure virtual]

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

Parameters:
index  parameter index
delimeter  delimeter

Implemented in dbserver_impl.

virtual const char* dbserver::get_value_as_decimal ( size_t  index,
char  delimeter 
) const [pure virtual]

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

Parameters:
index  parameter index
delimeter  delimeter

Implemented in dbserver_impl.

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

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

Parameters:
index  parameter index
year  [out] year [0-1000000] from 1 A.D.
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]

Implemented in dbserver_impl.

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

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

Parameters:
index  parameter index

Implemented in dbserver_impl.

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

function returns the pointer to wide string

Parameters:
index  parameter index

Implemented in dbserver_impl.

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

returns pointer to the raw bytes size of bytes is put to len

Parameters:
index  parameter index
len  [out] length of byte array

Implemented in dbserver_impl.

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

returns pointer to the raw bytes for reusing only the format of buffer is as follow first size_t bytes the length of the rest of buffer, which contains the raw byte data

Parameters:
index  parameter index

Implemented in dbserver_impl.

virtual bool dbserver::is_open_sql (  )  const [pure virtual]

checks the state of the sql request

Implemented in dbserver_impl.

Referenced by db_creator< T >::back().

virtual bool dbserver::open_sql ( bool  async,
const char *  sql 
) [pure virtual]

executes the parameterized sql statement with recordset result

Parameters:
async  asynchronous flag
sql  sql statement

Implemented in dbserver_impl.

virtual bool dbserver::exec_sql ( bool  async,
const char *  sql 
) [pure virtual]

executes the parameterized sql statement without recordset result

Parameters:
async  asynchronous flag
sql  sql statement

Implemented in dbserver_impl.

virtual bool dbserver::open_proc ( bool  async,
const char *  name 
) [pure virtual]

executes the stored procedure with recordset result

Parameters:
async  asynchronous flag
name  stored procedure name

Implemented in dbserver_impl.

virtual bool dbserver::exec_proc ( bool  async,
const char *  name 
) [pure virtual]

executes the stored procedure without recordset result

Parameters:
async  asynchronous flag
name  stored procedure name

Implemented in dbserver_impl.

virtual bool dbserver::fetch_data ( bool  async,
size_t  start_row,
size_t  num_rows,
bool  forward 
) [pure virtual]

fetches the data and returns the recordset defines the start row, numbers rows and fetches direction if start_row is 0 then the fetch starts from the position after the last position fetched before if start_row > 0 then start_row is considered as absolute row number in recordset

Parameters:
async  asynchronous flag
start_row  start row
num_rows  number of rows to fetch
forward  direction

Implemented in dbserver_impl.

Referenced by memtable::populate().

virtual bool dbserver::close_sql (  )  [pure virtual]

closes sql - free allocated resources

Implemented in dbserver_impl.

Referenced by db_creator< T >::back().

virtual bool dbserver::interrupt_request (  )  [pure virtual]

interrupts asynchronous request

Implemented in dbserver_impl.

virtual bool dbserver::set_quote ( char  quote  )  [pure virtual]

sets quote the syntax of sql statement with parameters must be understandable for internal sql processor therefore it should look like selects * from the table where pk = :pk here ':' char is an identificator of parameter with name "pk" function set_quote allows to change this identificator to the preferable one ':' is a default identificator

Parameters:
quote  quote

Implemented in dbserver_impl.

virtual void dbserver::set_callback ( async_db_notify target  )  [pure virtual]

sets the callback function for asynchronous actions

Parameters:
target  notification callback

Implemented in dbserver_impl.

virtual void dbserver::remove_callback ( async_db_notify target  )  [pure virtual]

remove the callback function for asynchronous actions

Parameters:
target  notification callback

Implemented in dbserver_impl.

virtual bool dbserver::param_bulk_store (  )  [pure virtual]

bulk operation support caller should very careful with these functionality current set of parameters previously set by set_param_* functions will be moved to the bulk parameters list the current parameters set will have the same values, but will not participate in bulk operations moreover if the next call set_param_* function will change the type - all bulk parameters will be deleted.

Implemented in dbserver_impl.

virtual bool dbserver::param_bulk_remove (  )  [pure virtual]

removes the last stored bulk parameter

Implemented in dbserver_impl.

virtual bool dbserver::param_bulk_remove_all (  )  [pure virtual]

removes all stored bulk parameters

Implemented in dbserver_impl.


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


© Copyright Terimber 2003-.