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

binder Class Reference

orvide 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
binderoperator= (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 (  ) 

destructor

Definition at line 66 of file db.cpp.

References deallocate_value().

binder::binder (  ) 

constructor

Definition at line 71 of file db.cpp.

References _value, terimber_db_value::nullVal, and terimber_db_value::val.

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

binder & binder::operator= ( const binder x  ) 

assign operator full copy with memory allocation

Definition at line 110 of file db.cpp.

References clone(), and deallocate_value().

void binder::set_name ( byte_allocator data_allocator,
const char *  x 
)

sets name, makes a copy or assigns only pointers - depends on responsibility

Parameters:
data_allocator  external allocator, if any
x  name

Definition at line 118 of file db.cpp.

References _name, copy_string(), and os_minus_one.

Referenced by orcl_dbserver::v_get_one_column_info(), odbc_dbserver::v_get_one_column_info(), and mysql_dbserver::v_get_one_column_info().

BEGIN_TERIMBER_NAMESPACE bool binder::set_as_null ( db_param_type  in_out,
dbtypes  type 
) [inline]

sets function

Parameters:
in_out  in/out binder property
type  binder type

Definition at line 36 of file db.hpp.

References _in_out, _type, _value, deallocate_value(), terimber_db_value::nullVal, and terimber_db_value::val.

bool binder::set_as_bool ( db_param_type  in_out,
bool  val 
) [inline]

sets param as boolean

Parameters:
in_out  in/out binder property
val  value

Definition at line 49 of file db.hpp.

References _in_out, _type, _value, _terimber_xml_value_::boolVal, db_bool, deallocate_value(), terimber_db_value::nullVal, and terimber_db_value::val.

bool binder::set_as_char ( db_param_type  in_out,
sb1_t  val 
) [inline]

sets param as char

Parameters:
in_out  in/out binder property
val  value

Definition at line 62 of file db.hpp.

References _in_out, _type, _value, _terimber_xml_value_::cVal, db_sb1, deallocate_value(), terimber_db_value::nullVal, and terimber_db_value::val.

bool binder::set_as_byte ( db_param_type  in_out,
ub1_t  val 
) [inline]

sets param as byte

Parameters:
in_out  in/out binder property
val  value

Definition at line 75 of file db.hpp.

References _in_out, _type, _value, _terimber_xml_value_::bVal, db_ub1, deallocate_value(), terimber_db_value::nullVal, and terimber_db_value::val.

bool binder::set_as_short ( db_param_type  in_out,
sb2_t  val 
) [inline]

sets param as short

Parameters:
in_out  in/out binder property
val  value

Definition at line 88 of file db.hpp.

References _in_out, _type, _value, db_sb2, deallocate_value(), _terimber_xml_value_::iVal, terimber_db_value::nullVal, and terimber_db_value::val.

bool binder::set_as_word ( db_param_type  in_out,
ub2_t  val 
) [inline]

sets param as word

Parameters:
in_out  in/out binder property
val  value

Definition at line 101 of file db.hpp.

References _in_out, _type, _value, db_ub2, deallocate_value(), terimber_db_value::nullVal, _terimber_xml_value_::uiVal, and terimber_db_value::val.

bool binder::set_as_long ( db_param_type  in_out,
sb4_t  val 
) [inline]

sets param as long

Parameters:
in_out  in/out binder property
val  value

Definition at line 114 of file db.hpp.

References _in_out, _type, _value, db_sb4, deallocate_value(), _terimber_xml_value_::lVal, terimber_db_value::nullVal, and terimber_db_value::val.

bool binder::set_as_dword ( db_param_type  in_out,
ub4_t  val 
) [inline]

sets param as dword

Parameters:
in_out  in/out binder property
val  value

Definition at line 127 of file db.hpp.

References _in_out, _type, _value, db_ub4, deallocate_value(), terimber_db_value::nullVal, _terimber_xml_value_::ulVal, and terimber_db_value::val.

bool binder::set_as_float ( db_param_type  in_out,
float  val 
) [inline]

sets param as float

Parameters:
in_out  in/out binder property
val  value

Definition at line 140 of file db.hpp.

References _in_out, _type, _value, db_float, deallocate_value(), _terimber_xml_value_::fltVal, terimber_db_value::nullVal, and terimber_db_value::val.

bool binder::set_as_double ( db_param_type  in_out,
double  val 
) [inline]

sets param as double

Parameters:
in_out  in/out binder property
val  value

Definition at line 153 of file db.hpp.

References _in_out, _type, _value, allocate_value(), db_double, _terimber_xml_value_::dblVal, deallocate_value(), terimber_db_value::nullVal, and terimber_db_value::val.

bool binder::set_as_long64 ( db_param_type  in_out,
sb8_t  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.

bool binder::set_as_dword64 ( db_param_type  in_out,
ub8_t  val 
) [inline]

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_guid ( db_param_type  in_out,
const guid_t val 
) [inline]

sets param as guid

Parameters:
in_out  in/out binder property
val  value

Definition at line 262 of file db.hpp.

References _in_out, _type, _value, allocate_value(), db_guid, deallocate_value(), _terimber_xml_value_::guidVal, terimber_db_value::nullVal, 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.

bool binder::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 
) [inline]

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 string pointer

Parameters:
val  value, only for input

Definition at line 443 of file db.hpp.

References _in_out, _type, _value, db_param_in, db_string, deallocate_value(), terimber_db_value::nullVal, _terimber_xml_value_::strVal, and terimber_db_value::val.

bool binder::set_as_wstring ( db_param_type  in_out,
const wchar_t val,
size_t  len 
) [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]

sets param as wide string pointer

Parameters:
val  value, only for input

Definition at line 484 of file db.hpp.

References _in_out, _type, _value, db_param_in, db_wstring, deallocate_value(), terimber_db_value::nullVal, terimber_db_value::val, and _terimber_xml_value_::wstrVal.

bool binder::set_as_binary ( db_param_type  in_out,
const ub1_t val,
size_t  len 
) [inline]

sets param as binary

Parameters:
in_out  in/out binder property
val  value
len  binary length

Definition at line 497 of file db.hpp.

References _in_out, _type, _value, allocate_value(), _terimber_xml_value_::bufVal, db_binary, deallocate_value(), terimber_db_value::nullVal, and terimber_db_value::val.

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.


Member Data Documentation

const char* binder::_name

name of binder

Definition at line 294 of file db.h.

Referenced by clone(), and set_name().

additional memory for some types of database server

Definition at line 302 of file db.h.

Referenced by clone(), orcl_dbserver::v_bind_one_column(), orcl_dbserver::v_convert_one_value(), odbc_dbserver::v_convert_one_value(), and orcl_dbserver::v_rebind_one_param().

memory cleans up responsibility

Definition at line 304 of file db.h.

Referenced by allocate_value(), clone(), deallocate_value(), and odbc_dbserver::v_get_one_column_info().


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


© Copyright Terimber 2003-.