Home / Open source / Terimber 2.0
binder Class Referenceorvide functionality for binding sql parameters
More...
#include <db.h>
List of all members.
|
Public Member Functions |
| ~binder () |
| destructor
|
| binder () |
| constructor
|
| binder (const binder &x) |
| copy constructor full copy with memory allocation
|
binder & | operator= (const binder &x) |
| assign operator full copy with memory allocation
|
void | set_name (byte_allocator *data_allocator, const char *x) |
| sets name, makes a copy or assigns only pointers - depends on responsibility
|
bool | set_as_null (db_param_type in_out, dbtypes type) |
| sets function
|
bool | set_as_bool (db_param_type in_out, bool val) |
| sets param as boolean
|
bool | set_as_char (db_param_type in_out, sb1_t val) |
| sets param as char
|
bool | set_as_byte (db_param_type in_out, ub1_t val) |
| sets param as byte
|
bool | set_as_short (db_param_type in_out, sb2_t val) |
| sets param as short
|
bool | set_as_word (db_param_type in_out, ub2_t val) |
| sets param as word
|
bool | set_as_long (db_param_type in_out, sb4_t val) |
| sets param as long
|
bool | set_as_dword (db_param_type in_out, ub4_t val) |
| sets param as dword
|
bool | set_as_float (db_param_type in_out, float val) |
| sets param as float
|
bool | set_as_double (db_param_type in_out, double val) |
| sets param as double
|
bool | set_as_long64 (db_param_type in_out, sb8_t val) |
| sets param as long64
|
bool | set_as_dword64 (db_param_type in_out, ub8_t val) |
| sets param as dword64
|
bool | set_as_guid (db_param_type in_out, const guid_t &val) |
| sets param as guid
|
bool | set_as_numeric (db_param_type in_out, const char *val, char delimeter) |
| sets param as numeric
|
bool | set_as_decimal (db_param_type in_out, const char *val, char delimeter) |
| sets param as decimal
|
bool | set_as_date (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) |
| sets param as date
|
bool | set_as_string (db_param_type in_out, const char *val, size_t len) |
| sets param as string
|
bool | set_as_string_ptr (const char *val) |
| sets param as string pointer
|
bool | set_as_wstring (db_param_type in_out, const wchar_t *val, size_t len) |
| sets param as wide string
|
bool | set_as_wstring_ptr (const wchar_t *val) |
| sets param as wide string pointer
|
bool | set_as_binary (db_param_type in_out, const ub1_t *val, size_t len) |
| sets param as binary
|
bool | set_as_binary_ptr (const ub1_t *val) |
| sets param as binary pointer
|
void * | allocate_value (size_t n) |
| allocates value accoring to the assigned type
|
void | deallocate_value () |
| deallocates value if required
|
void | clone (binder &out) const |
| makes a full copy of value
|
Public Attributes |
db_param_type | _in_out |
| input/output parameter
|
dbtypes | _type |
| db predifined types
|
const char * | _name |
| name of binder
|
size_t | _scale |
| size of binder, usually for numeric types
|
size_t | _precision |
| precision of binder, usually for numeric types
|
size_t | _max_length |
| length of binder max
|
size_t | _bind_type |
| binds type while binding column or output parameter
|
size_t | _native_type |
| native type, specific for database server
|
size_t | _real_length |
| actual length of column value or output parameter
|
void * | _bind_buffer |
| memory for binding
|
void * | _user_code |
| additional memory for some types of database server
|
terimber_db_value | _value |
| parameter value
|
bool | _responsible |
| memory cleans up responsibility
|
Detailed Description
orvide functionality for binding sql parameters
Definition at line 120 of file db.h.
Constructor & Destructor Documentation
binder::binder |
( |
const binder & |
x |
) |
|
copy constructor full copy with memory allocation
Definition at line 92 of file db.cpp.
References clone().
Member Function Documentation
void binder::set_name |
( |
byte_allocator * |
data_allocator, |
|
|
const char * |
x | |
|
) |
| | |
bool binder::set_as_bool |
( |
db_param_type |
in_out, |
|
|
bool |
val | |
|
) |
| | [inline] |
bool binder::set_as_float |
( |
db_param_type |
in_out, |
|
|
float |
val | |
|
) |
| | [inline] |
bool binder::set_as_double |
( |
db_param_type |
in_out, |
|
|
double |
val | |
|
) |
| | [inline] |
sets param as long64
- Parameters:
-
in_out |
in/out binder property |
val |
value |
Definition at line 188 of file db.hpp.
References _in_out, _type, _value, allocate_value(), db_date, db_sb8, db_ub8, deallocate_value(), _terimber_xml_value_::intVal, terimber_db_value::nullVal, and terimber_db_value::val.
sets param as dword64
- Parameters:
-
in_out |
in/out binder property |
val |
value |
Definition at line 225 of file db.hpp.
References _in_out, _type, _value, allocate_value(), db_date, db_sb8, db_ub8, deallocate_value(), terimber_db_value::nullVal, _terimber_xml_value_::uintVal, and terimber_db_value::val.
bool binder::set_as_numeric |
( |
db_param_type |
in_out, |
|
|
const char * |
val, |
|
|
char |
delimeter | |
|
) |
| | [inline] |
sets param as numeric
- Parameters:
-
in_out |
in/out binder property |
val |
value |
delimeter |
delimeter |
Definition at line 292 of file db.hpp.
References _in_out, _type, _value, allocate_value(), _terimber_xml_value_::bufVal, db_decimal, db_numeric, deallocate_value(), terimber_db_value::nullVal, numeric::orcl_len(), numeric::parse_orcl(), numeric::persist_orcl(), and terimber_db_value::val.
bool binder::set_as_decimal |
( |
db_param_type |
in_out, |
|
|
const char * |
val, |
|
|
char |
delimeter | |
|
) |
| | [inline] |
sets param as decimal
- Parameters:
-
in_out |
in/out binder property |
val |
value |
delimeter |
delimeter |
Definition at line 332 of file db.hpp.
References _in_out, _type, _value, allocate_value(), _terimber_xml_value_::bufVal, db_decimal, db_numeric, deallocate_value(), terimber_db_value::nullVal, numeric::orcl_len(), numeric::parse_orcl(), numeric::persist_orcl(), and terimber_db_value::val.
sets param as date
- Parameters:
-
in_out |
in/out binder 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] |
Definition at line 372 of file db.hpp.
References _in_out, _type, _value, allocate_value(), date::convert_to(), db_date, db_sb8, db_ub8, deallocate_value(), _terimber_xml_value_::intVal, terimber_db_value::nullVal, and terimber_db_value::val.
bool binder::set_as_string |
( |
db_param_type |
in_out, |
|
|
const char * |
val, |
|
|
size_t |
len | |
|
) |
| | [inline] |
sets param as string
- Parameters:
-
in_out |
in/out binder property |
val |
value |
len |
string length, -1 for zero terminated |
Definition at line 412 of file db.hpp.
References _in_out, _type, _value, allocate_value(), db_string, deallocate_value(), terimber_db_value::nullVal, os_minus_one, str_template::strcpy(), str_template::strlen(), _terimber_xml_value_::strVal, and terimber_db_value::val.
bool binder::set_as_string_ptr |
( |
const char * |
val |
) |
[inline] |
sets param as wide string
- Parameters:
-
in_out |
in/out binder property |
val |
value |
len |
string length, -1 for zero terminated |
Definition at line 455 of file db.hpp.
References _in_out, _type, _value, allocate_value(), db_wstring, deallocate_value(), terimber_db_value::nullVal, os_minus_one, str_template::strcpy(), str_template::strlen(), terimber_db_value::val, and _terimber_xml_value_::wstrVal.
bool binder::set_as_wstring_ptr |
( |
const wchar_t * |
val |
) |
[inline] |
bool binder::set_as_binary |
( |
db_param_type |
in_out, |
|
|
const ub1_t * |
val, |
|
|
size_t |
len | |
|
) |
| | [inline] |
bool binder::set_as_binary_ptr |
( |
const ub1_t * |
val |
) |
[inline] |
sets param as binary pointer
- Parameters:
-
val |
value, only for input, first size_t bytes are length |
Definition at line 525 of file db.hpp.
References _in_out, _type, _value, _terimber_xml_value_::bufVal, db_binary, db_param_in, deallocate_value(), terimber_db_value::nullVal, and terimber_db_value::val.
void * binder::allocate_value |
( |
size_t |
n |
) |
|
allocates value accoring to the assigned type
- Parameters:
-
n |
length of value for variable byte length |
Definition at line 125 of file db.cpp.
References _responsible, _type, _value, _terimber_xml_value_::bufVal, check_pointer(), db_binary, db_bool, db_date, db_decimal, db_double, db_float, db_guid, db_numeric, db_sb1, db_sb2, db_sb4, db_sb8, db_string, db_ub1, db_ub2, db_ub4, db_ub8, db_unknown, db_wstring, _terimber_xml_value_::dblVal, _terimber_xml_value_::guidVal, _terimber_xml_value_::intVal, _terimber_xml_value_::strVal, _terimber_xml_value_::uintVal, terimber_db_value::val, and _terimber_xml_value_::wstrVal.
Referenced by set_as_binary(), set_as_date(), set_as_decimal(), set_as_double(), set_as_dword64(), set_as_guid(), set_as_long64(), set_as_numeric(), set_as_string(), set_as_wstring(), orcl_dbserver::v_rebind_one_param(), odbc_dbserver::v_rebind_one_param(), and mysql_dbserver::v_rebind_one_param().
void binder::deallocate_value |
( |
|
) |
|
deallocates value if required
Definition at line 188 of file db.cpp.
References _responsible, _type, _value, _terimber_xml_value_::bufVal, db_binary, db_bool, db_date, db_decimal, db_double, db_float, db_guid, db_numeric, db_sb1, db_sb2, db_sb4, db_sb8, db_string, db_ub1, db_ub2, db_ub4, db_ub8, db_unknown, db_wstring, _terimber_xml_value_::dblVal, _terimber_xml_value_::guidVal, _terimber_xml_value_::intVal, _terimber_xml_value_::strVal, _terimber_xml_value_::uintVal, terimber_db_value::val, and _terimber_xml_value_::wstrVal.
Referenced by operator=(), set_as_binary(), set_as_binary_ptr(), set_as_bool(), set_as_byte(), set_as_char(), set_as_date(), set_as_decimal(), set_as_double(), set_as_dword(), set_as_dword64(), set_as_float(), set_as_guid(), set_as_long(), set_as_long64(), set_as_null(), set_as_numeric(), set_as_short(), set_as_string(), set_as_string_ptr(), set_as_word(), set_as_wstring(), set_as_wstring_ptr(), and ~binder().
void binder::clone |
( |
binder & |
out |
) |
const |
makes a full copy of value
Definition at line 276 of file db.cpp.
References _bind_buffer, _bind_type, _in_out, _max_length, _name, _native_type, _precision, _real_length, _responsible, _scale, _type, _user_code, _value, _terimber_xml_value_::bufVal, check_pointer(), db_binary, db_bool, db_date, db_decimal, db_double, db_float, db_guid, db_numeric, db_sb1, db_sb2, db_sb4, db_sb8, db_string, db_ub1, db_ub2, db_ub4, db_ub8, db_unknown, db_wstring, _terimber_xml_value_::dblVal, _terimber_xml_value_::guidVal, _terimber_xml_value_::intVal, terimber_db_value::nullVal, numeric::orcl_len(), numeric::parse_orcl(), str_template::strlen(), _terimber_xml_value_::strVal, _terimber_xml_value_::uintVal, terimber_db_value::val, and _terimber_xml_value_::wstrVal.
Referenced by binder(), and operator=().
Member Data Documentation
input/output parameter
Definition at line 292 of file db.h.
Referenced by clone(), set_as_binary(), set_as_binary_ptr(), set_as_bool(), set_as_byte(), set_as_char(), set_as_date(), set_as_decimal(), set_as_double(), set_as_dword(), set_as_dword64(), set_as_float(), set_as_guid(), set_as_long(), set_as_long64(), set_as_null(), set_as_numeric(), set_as_short(), set_as_string(), set_as_string_ptr(), set_as_word(), set_as_wstring(), set_as_wstring_ptr(), orcl_dbserver::v_bind_one_param(), odbc_dbserver::v_bind_one_param(), mysql_dbserver::v_bind_one_param(), orcl_dbserver::v_rebind_one_param(), odbc_dbserver::v_rebind_one_param(), and mysql_dbserver::v_rebind_one_param().
db predifined types
Definition at line 293 of file db.h.
Referenced by allocate_value(), clone(), deallocate_value(), set_as_binary(), set_as_binary_ptr(), set_as_bool(), set_as_byte(), set_as_char(), set_as_date(), set_as_decimal(), set_as_double(), set_as_dword(), set_as_dword64(), set_as_float(), set_as_guid(), set_as_long(), set_as_long64(), set_as_null(), set_as_numeric(), set_as_short(), set_as_string(), set_as_string_ptr(), set_as_word(), set_as_wstring(), set_as_wstring_ptr(), orcl_dbserver::v_bind_one_param(), odbc_dbserver::v_bind_one_param(), and mysql_dbserver::v_bind_one_param().
length of binder max
Definition at line 297 of file db.h.
Referenced by clone(), orcl_dbserver::v_bind_one_column(), odbc_dbserver::v_bind_one_column(), mysql_dbserver::v_bind_one_column(), orcl_dbserver::v_bind_one_param(), odbc_dbserver::v_bind_one_param(), mysql_dbserver::v_bind_one_param(), orcl_dbserver::v_convert_one_value(), odbc_dbserver::v_convert_one_value(), mysql_dbserver::v_convert_one_value(), orcl_dbserver::v_get_one_column_info(), odbc_dbserver::v_get_one_column_info(), mysql_dbserver::v_get_one_column_info(), orcl_dbserver::v_rebind_one_param(), odbc_dbserver::v_rebind_one_param(), and mysql_dbserver::v_rebind_one_param().
native type, specific for database server
Definition at line 299 of file db.h.
Referenced by clone(), orcl_dbserver::v_bind_one_column(), odbc_dbserver::v_bind_one_column(), mysql_dbserver::v_bind_one_column(), orcl_dbserver::v_bind_one_param(), odbc_dbserver::v_bind_one_param(), mysql_dbserver::v_bind_one_param(), orcl_dbserver::v_convert_one_value(), odbc_dbserver::v_convert_one_value(), mysql_dbserver::v_convert_one_value(), orcl_dbserver::v_get_one_column_info(), odbc_dbserver::v_get_one_column_info(), mysql_dbserver::v_get_one_column_info(), orcl_dbserver::v_rebind_one_param(), odbc_dbserver::v_rebind_one_param(), and mysql_dbserver::v_rebind_one_param().
actual length of column value or output parameter
Definition at line 300 of file db.h.
Referenced by clone(), orcl_dbserver::v_bind_one_column(), odbc_dbserver::v_bind_one_column(), mysql_dbserver::v_bind_one_column(), orcl_dbserver::v_bind_one_param(), odbc_dbserver::v_bind_one_param(), mysql_dbserver::v_bind_one_param(), orcl_dbserver::v_convert_one_value(), odbc_dbserver::v_convert_one_value(), mysql_dbserver::v_convert_one_value(), mysql_dbserver::v_get_one_column_info(), orcl_dbserver::v_rebind_one_param(), odbc_dbserver::v_rebind_one_param(), and mysql_dbserver::v_rebind_one_param().
memory for binding
Definition at line 301 of file db.h.
Referenced by clone(), orcl_dbserver::v_bind_one_column(), odbc_dbserver::v_bind_one_column(), mysql_dbserver::v_bind_one_column(), orcl_dbserver::v_bind_one_param(), odbc_dbserver::v_bind_one_param(), mysql_dbserver::v_bind_one_param(), orcl_dbserver::v_convert_one_value(), odbc_dbserver::v_convert_one_value(), mysql_dbserver::v_convert_one_value(), orcl_dbserver::v_rebind_one_param(), odbc_dbserver::v_rebind_one_param(), and mysql_dbserver::v_rebind_one_param().
parameter value
Definition at line 303 of file db.h.
Referenced by allocate_value(), binder(), clone(), deallocate_value(), set_as_binary(), set_as_binary_ptr(), set_as_bool(), set_as_byte(), set_as_char(), set_as_date(), set_as_decimal(), set_as_double(), set_as_dword(), set_as_dword64(), set_as_float(), set_as_guid(), set_as_long(), set_as_long64(), set_as_null(), set_as_numeric(), set_as_short(), set_as_string(), set_as_string_ptr(), set_as_word(), set_as_wstring(), set_as_wstring_ptr(), orcl_dbserver::v_bind_one_column(), mysql_dbserver::v_bind_one_column(), orcl_dbserver::v_bind_one_param(), odbc_dbserver::v_bind_one_param(), mysql_dbserver::v_bind_one_param(), orcl_dbserver::v_convert_one_value(), mysql_dbserver::v_convert_one_value(), orcl_dbserver::v_get_one_column_info(), odbc_dbserver::v_get_one_column_info(), mysql_dbserver::v_get_one_column_info(), orcl_dbserver::v_rebind_one_param(), odbc_dbserver::v_rebind_one_param(), and mysql_dbserver::v_rebind_one_param().
The documentation for this class was generated from the following files:
|
|