Manage a static (pre-bound) record to fetch data. More...
#include <record.h>
Classes | |
class | bind_info_t |
The structure used to hold the binding information. More... | |
Public Member Functions | |
virtual bool | is_dynamic () const |
Bound all the columns to variables automatically? | |
Protected Member Functions | |
void | bind (SQLSMALLINT col, SQLGUID &guid, bool *is_null=0) |
Bind a GUID to the specified column. | |
void | bind (const std::string &name, SQLGUID &guid, bool *is_null=0) |
Bind a GUID to the specified column. | |
void | bind (SQLSMALLINT col, SQL_NUMERIC_STRUCT &numeric, bool *is_null=0) |
Bind a Numeric to the specified column. | |
void | bind (const std::string &name, SQL_NUMERIC_STRUCT &numeric, bool *is_null=0) |
Bind a Numeric to the specified column. | |
void | bind (SQLSMALLINT col, SQL_TIMESTAMP_STRUCT ×tamp, bool *is_null=0) |
Bind a timestamp to the specified column. | |
void | bind (const std::string &name, SQL_TIMESTAMP_STRUCT ×tamp, bool *is_null=0) |
Bind a timestamp to the specified column. | |
void | bind (SQLSMALLINT col, SQL_TIME_STRUCT &time, bool *is_null=0) |
Bind a time to the specified column. | |
void | bind (const std::string &name, SQL_TIME_STRUCT &time, bool *is_null=0) |
Bind a time to the specified column. | |
void | bind (SQLSMALLINT col, SQL_DATE_STRUCT &date, bool *is_null=0) |
Bind a date to the specified column. | |
void | bind (const std::string &name, SQL_DATE_STRUCT &date, bool *is_null=0) |
Bind a date to the specified column. | |
void | bind (SQLSMALLINT col, SQLCHAR *binary, SQLLEN length, bool *is_null=0) |
Bind a binary buffer to the specified column. | |
void | bind (const std::string &name, SQLCHAR *binary, SQLLEN length, bool *is_null=0) |
Bind a binary buffer to the specified column. | |
void | bind (SQLSMALLINT col, SQLFLOAT &dbl, bool *is_null=0) |
Bind a float (C/C++ double) to the specified column. | |
void | bind (const std::string &name, SQLFLOAT &dbl, bool *is_null=0) |
Bind a float (C/C++ double) to the specified column. | |
void | bind (SQLSMALLINT col, SQLREAL &real, bool *is_null=0) |
Bind a real (C/C++ float) to the specified column. | |
void | bind (const std::string &name, SQLREAL &real, bool *is_null=0) |
Bind a real (C/C++ float) to the specified column. | |
void | bind (SQLSMALLINT col, SQLUBIGINT &big_int, bool *is_null=0) |
Bind a big integer to the specified column. | |
void | bind (const std::string &name, SQLUBIGINT &big_int, bool *is_null=0) |
Bind a big integer to the specified column. | |
void | bind (SQLSMALLINT col, SQLBIGINT &big_int, bool *is_null=0) |
Bind a big integer to the specified column. | |
void | bind (const std::string &name, SQLBIGINT &big_int, bool *is_null=0) |
Bind a big integer to the specified column. | |
void | bind (SQLSMALLINT col, SQLUINTEGER &integer, bool *is_null=0) |
Bind an integer to the specified column. | |
void | bind (const std::string &name, SQLUINTEGER &integer, bool *is_null=0) |
Bind an integer to the specified column. | |
void | bind (SQLSMALLINT col, SQLINTEGER &integer, bool *is_null=0) |
Bind an integer to the specified column. | |
void | bind (const std::string &name, SQLINTEGER &integer, bool *is_null=0) |
Bind an integer to the specified column. | |
void | bind (SQLSMALLINT col, SQLUSMALLINT &small_int, bool *is_null=0) |
Bind a small integer to the specified column. | |
void | bind (const std::string &name, SQLUSMALLINT &small_int, bool *is_null=0) |
Bind a small integer to the specified column. | |
void | bind (SQLSMALLINT col, SQLSMALLINT &small_int, bool *is_null=0) |
Bind a small integer to the specified column. | |
void | bind (const std::string &name, SQLSMALLINT &small_int, bool *is_null=0) |
Bind a small integer to the specified column. | |
void | bind (SQLSMALLINT col, SQLSCHAR &tiny_int, bool *is_null=0) |
Bind a tiny integer to the specified column. | |
void | bind (const std::string &name, SQLSCHAR &tiny_int, bool *is_null=0) |
Bind a tiny integer to the specified column. | |
void | bind (SQLSMALLINT col, SQLCHAR &tiny_int, bool *is_null=0) |
Bind a tiny integer to the specified column. | |
void | bind (const std::string &name, SQLCHAR &tiny_int, bool *is_null=0) |
Bind a tiny integer to the specified column. | |
void | bind (SQLSMALLINT col, std::wstring &str, bool *is_null=0) |
Bind a string to the specified column. | |
void | bind (const std::string &name, std::wstring &str, bool *is_null=0) |
Bind a string to the specified column. | |
void | bind (SQLSMALLINT col, std::string &str, bool *is_null=0) |
Bind a string to the specified column. | |
void | bind (const std::string &name, std::string &str, bool *is_null=0) |
Bind a string to the specified column. | |
bool | empty () const |
Check whether any bounds were added to this record. | |
size_t | size () const |
Returns the number of variables bound. | |
Private Types | |
typedef std::map< const SQLSMALLINT, bind_info_t * > | bind_info_col_map_t |
A map that links a column index and the column bind information. | |
typedef std::pair< const SQLSMALLINT, bind_info_t * > | bind_info_col_t |
A pair with the column index and its information. | |
typedef std::map< const std::string, bind_info_t * > | bind_info_name_map_t |
A map that links a column name and the column bind information. | |
typedef std::pair< const std::string, bind_info_t * > | bind_info_name_t |
A pair with the column name and its information. | |
Private Member Functions | |
virtual void | bind_impl () |
Proceed with binding the variables. | |
virtual void | finalize () |
Called after each call to SQLFetch(). | |
void | finalize_info (bind_info_t *info) |
Finalize the setup of the given info. | |
Private Attributes | |
bind_info_col_map_t | f_bind_by_col |
Map holding the column binding information by index. | |
bind_info_name_map_t | f_bind_by_name |
Map holding the column binding information by name. |
Manage a static (pre-bound) record to fetch data.
This is a base class you will derive from in order to generate a pre-defined record.
This class is particularly adapted if you know the exact structure of a table at compile time. It is also the fastest way to get data from the database.
Whenever you fetch data using a record object, the data is read directly into your record variables. This makes it really fast.
On the other hand, if you do not know what columns will be available, then use a dynamic_record instead.
To use a record properly:
1. derive from it in your own class; 2. add variable members to your class; 3. bind the variables on initialization (in the constructor).
For instance, with a table including a SMALLINT and a VARCHAR one can write:
class my_table : public record { public: my_table() : m_identifier(0) //m_name -- auto-init { bind(1, m_identifier); bind(2, m_name); } private: short m_identifier; std::string m_name; };
Note that it is possible to use the name of the column instead of the number. This can be a good idea if it is possible that the order changes between machines.
You should not bind a column more than once. Only the last bind() will be in effect.
Definition at line 118 of file record.h.
typedef std::map<const SQLSMALLINT, bind_info_t *> odbcpp::record::bind_info_col_map_t [private] |
typedef std::pair<const SQLSMALLINT, bind_info_t *> odbcpp::record::bind_info_col_t [private] |
typedef std::map<const std::string, bind_info_t *> odbcpp::record::bind_info_name_map_t [private] |
typedef std::pair<const std::string, bind_info_t *> odbcpp::record::bind_info_name_t [private] |
void odbcpp::record::bind | ( | SQLSMALLINT | col, | |
SQLGUID & | guid, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a GUID to the specified column.
This function binds the GUID variable to the specified colunm.
[in] | col | The column number, starting at 1 |
[in] | guid | The guid variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 1299 of file record.cpp.
References f_bind_by_col, odbcpp::record::bind_info_t::f_col, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | const std::string & | name, | |
SQLGUID & | guid, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a GUID to the specified column.
This function binds the GUID variable to the specified colunm.
[in] | name | The name of the column |
[in] | guid | The guid variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 1273 of file record.cpp.
References f_bind_by_name, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_name, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | SQLSMALLINT | col, | |
SQL_NUMERIC_STRUCT & | numeric, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a Numeric to the specified column.
This function binds the numeric variable to the specified colunm.
[in] | col | The column number, starting at 1 |
[in] | numeric | The numeric variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 1247 of file record.cpp.
References f_bind_by_col, odbcpp::record::bind_info_t::f_col, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | const std::string & | name, | |
SQL_NUMERIC_STRUCT & | numeric, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a Numeric to the specified column.
This function binds the numeric variable to the specified colunm.
[in] | name | The name of column |
[in] | numeric | The numeric variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 1221 of file record.cpp.
References f_bind_by_name, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_name, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | SQLSMALLINT | col, | |
SQL_TIMESTAMP_STRUCT & | timestamp, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a timestamp to the specified column.
This function binds the timestamp variable to the specified colunm.
[in] | col | The column number, starting at 1 |
[in] | timestamp | The timestamp variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 1195 of file record.cpp.
References f_bind_by_col, odbcpp::record::bind_info_t::f_col, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | const std::string & | name, | |
SQL_TIMESTAMP_STRUCT & | timestamp, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a timestamp to the specified column.
This function binds the timestamp variable to the specified colunm.
[in] | name | The name of the column |
[in] | timestamp | The timestamp variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 1169 of file record.cpp.
References f_bind_by_name, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_name, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | SQLSMALLINT | col, | |
SQL_TIME_STRUCT & | time, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a time to the specified column.
This function binds the time variable to the specified colunm.
[in] | col | The column number, starting at 1 |
[in] | time | The time variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 1143 of file record.cpp.
References f_bind_by_col, odbcpp::record::bind_info_t::f_col, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | const std::string & | name, | |
SQL_TIME_STRUCT & | time, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a time to the specified column.
This function binds the time variable to the specified colunm.
[in] | name | The name of the column |
[in] | time | The time variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 1117 of file record.cpp.
References f_bind_by_name, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_name, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | SQLSMALLINT | col, | |
SQL_DATE_STRUCT & | date, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a date to the specified column.
This function binds the date variable to the specified colunm.
[in] | col | The column number, starting at 1 |
[in] | date | The date variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 1091 of file record.cpp.
References f_bind_by_col, odbcpp::record::bind_info_t::f_col, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | const std::string & | name, | |
SQL_DATE_STRUCT & | date, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a date to the specified column.
This function binds the date variable to the specified colunm.
[in] | name | The name of the column |
[in] | date | The date variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 1065 of file record.cpp.
References f_bind_by_name, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_name, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | SQLSMALLINT | col, | |
SQLCHAR * | binary, | |||
SQLLEN | length, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a binary buffer to the specified column.
This function binds the binary variable to the specified colunm.
[in] | col | The column number, starting at 1 |
[in] | binary | The binary variable to bind |
[in] | length | The size of the binary buffer in bytes |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 1039 of file record.cpp.
References f_bind_by_col, odbcpp::record::bind_info_t::f_col, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | const std::string & | name, | |
SQLCHAR * | binary, | |||
SQLLEN | length, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a binary buffer to the specified column.
This function binds the binary variable to the specified colunm.
[in] | name | The name of the column |
[in] | binary | The binary variable to bind |
[in] | length | The size of the binary buffer in bytes |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 1012 of file record.cpp.
References f_bind_by_name, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_name, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | SQLSMALLINT | col, | |
SQLFLOAT & | dbl, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a float (C/C++ double) to the specified column.
This function binds the float variable to the specified colunm.
[in] | col | The column number, starting at 1 |
[in] | dbl | The double variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 985 of file record.cpp.
References f_bind_by_col, odbcpp::record::bind_info_t::f_col, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | const std::string & | name, | |
SQLFLOAT & | dbl, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a float (C/C++ double) to the specified column.
This function binds the float variable to the specified colunm.
[in] | name | The name of the column |
[in] | dbl | The double variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 956 of file record.cpp.
References f_bind_by_name, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_name, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | SQLSMALLINT | col, | |
SQLREAL & | real, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a real (C/C++ float) to the specified column.
This function binds the real variable to the specified colunm.
[in] | col | The column number, starting at 1 |
[in] | real | The real variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 927 of file record.cpp.
References f_bind_by_col, odbcpp::record::bind_info_t::f_col, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | const std::string & | name, | |
SQLREAL & | real, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a real (C/C++ float) to the specified column.
This function binds the real variable to the specified colunm.
[in] | name | The name of the column |
[in] | real | The real variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 898 of file record.cpp.
References f_bind_by_name, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_name, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | SQLSMALLINT | col, | |
SQLUBIGINT & | big_int, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a big integer to the specified column.
This function binds the big integer variable to the specified colunm.
[in] | col | The column number, starting at 1 |
[in] | big_int | The big integer variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 869 of file record.cpp.
References f_bind_by_col, odbcpp::record::bind_info_t::f_col, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | const std::string & | name, | |
SQLUBIGINT & | big_int, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a big integer to the specified column.
This function binds the big integer variable to the specified colunm.
[in] | name | The name of the column |
[in] | big_int | The big integer variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 843 of file record.cpp.
References f_bind_by_name, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_name, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | SQLSMALLINT | col, | |
SQLBIGINT & | big_int, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a big integer to the specified column.
This function binds the big integer variable to the specified colunm.
[in] | col | The column number, starting at 1 |
[in] | big_int | The big integer variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 817 of file record.cpp.
References f_bind_by_col, odbcpp::record::bind_info_t::f_col, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | const std::string & | name, | |
SQLBIGINT & | big_int, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a big integer to the specified column.
This function binds the big integer variable to the specified colunm.
[in] | name | The name of the column |
[in] | big_int | The big integer variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 791 of file record.cpp.
References f_bind_by_name, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_name, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | SQLSMALLINT | col, | |
SQLUINTEGER & | integer, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind an integer to the specified column.
This function binds the integer variable to the specified colunm.
[in] | col | The column number, starting at 1 |
[in] | integer | The integer variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 765 of file record.cpp.
References f_bind_by_col, odbcpp::record::bind_info_t::f_col, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | const std::string & | name, | |
SQLUINTEGER & | integer, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind an integer to the specified column.
This function binds the integer variable to the specified colunm.
[in] | name | The name of the column |
[in] | integer | The integer variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 739 of file record.cpp.
References f_bind_by_name, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_name, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | SQLSMALLINT | col, | |
SQLINTEGER & | integer, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind an integer to the specified column.
This function binds the integer variable to the specified colunm.
[in] | col | The column number, starting at 1 |
[in] | integer | The integer variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 713 of file record.cpp.
References f_bind_by_col, odbcpp::record::bind_info_t::f_col, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | const std::string & | name, | |
SQLINTEGER & | integer, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind an integer to the specified column.
This function binds the integer variable to the specified colunm.
[in] | name | The name of the column |
[in] | integer | The integer variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 687 of file record.cpp.
References f_bind_by_name, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_name, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | SQLSMALLINT | col, | |
SQLUSMALLINT & | small_int, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a small integer to the specified column.
This function binds the small integer variable to the specified colunm.
[in] | col | The column number, starting at 1 |
[in] | small_int | The small integer variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 661 of file record.cpp.
References f_bind_by_col, odbcpp::record::bind_info_t::f_col, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | const std::string & | name, | |
SQLUSMALLINT & | small_int, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a small integer to the specified column.
This function binds the small integer variable to the specified colunm.
[in] | name | The name of the column |
[in] | small_int | The small integer variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 635 of file record.cpp.
References f_bind_by_name, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_name, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | SQLSMALLINT | col, | |
SQLSMALLINT & | small_int, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a small integer to the specified column.
This function binds the small integer variable to the specified colunm.
[in] | col | The column number, starting at 1 |
[in] | small_int | The small integer variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 609 of file record.cpp.
References f_bind_by_col, odbcpp::record::bind_info_t::f_col, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | const std::string & | name, | |
SQLSMALLINT & | small_int, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a small integer to the specified column.
This function binds the small integer variable to the specified colunm.
[in] | name | The name of the column |
[in] | small_int | The small integer variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 583 of file record.cpp.
References f_bind_by_name, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_name, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | SQLSMALLINT | col, | |
SQLSCHAR & | tiny_int, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a tiny integer to the specified column.
This function binds the tiny integer variable to the specified colunm.
[in] | col | The column number, starting at 1 |
[in] | tiny_int | The tiny integer variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 557 of file record.cpp.
References f_bind_by_col, odbcpp::record::bind_info_t::f_col, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | const std::string & | name, | |
SQLSCHAR & | tiny_int, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a tiny integer to the specified column.
This function binds the tiny integer variable to the specified colunm.
[in] | name | The name of the column |
[in] | tiny_int | The tiny integer variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 531 of file record.cpp.
References f_bind_by_name, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_name, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | SQLSMALLINT | col, | |
SQLCHAR & | tiny_int, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a tiny integer to the specified column.
This function binds the tiny integer variable to the specified colunm.
[in] | col | The column number, starting at 1 |
[in] | tiny_int | The tiny integer variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 505 of file record.cpp.
References f_bind_by_col, odbcpp::record::bind_info_t::f_col, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | const std::string & | name, | |
SQLCHAR & | tiny_int, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a tiny integer to the specified column.
This function binds the tiny integer variable to the specified colunm.
[in] | name | The name of the column |
[in] | tiny_int | The tiny integer variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 479 of file record.cpp.
References f_bind_by_name, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_name, odbcpp::record::bind_info_t::f_size, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | SQLSMALLINT | col, | |
std::wstring & | str, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a string to the specified column.
This function binds the string variable to the specified colunm.
[in] | col | The column number, starting at 1 |
[in] | str | The string variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 453 of file record.cpp.
References f_bind_by_col, odbcpp::record::bind_info_t::f_col, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_target_type, and odbcpp::record::bind_info_t::f_wstring.
void odbcpp::record::bind | ( | const std::string & | name, | |
std::wstring & | str, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a string to the specified column.
This function binds the string variable to the specified colunm.
[in] | name | The name of the column |
[in] | str | The string variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 427 of file record.cpp.
References f_bind_by_name, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_name, odbcpp::record::bind_info_t::f_target_type, and odbcpp::record::bind_info_t::f_wstring.
void odbcpp::record::bind | ( | SQLSMALLINT | col, | |
std::string & | str, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a string to the specified column.
This function binds the string variable to the specified colunm.
[in] | col | The column number, starting at 1 |
[in] | str | The string variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 401 of file record.cpp.
References f_bind_by_col, odbcpp::record::bind_info_t::f_col, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_string, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind | ( | const std::string & | name, | |
std::string & | str, | |||
bool * | is_null = 0 | |||
) | [protected] |
Bind a string to the specified column.
This function binds the string variable to the specified colunm.
[in] | name | The name of the column |
[in] | str | The string variable to bind |
[in] | is_null | A pointer to a boolean variable set to true whenever this column is NULL in the database |
Definition at line 375 of file record.cpp.
References f_bind_by_name, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_name, odbcpp::record::bind_info_t::f_string, and odbcpp::record::bind_info_t::f_target_type.
void odbcpp::record::bind_impl | ( | ) | [private, virtual] |
Proceed with binding the variables.
This function is the one used to bind a record variables to an ODBC statement.
The following shows what the SQL types are bound with. (=) SQL_<name> and SQL_C_<name> are equal (<>) SQL_<name> and SQL_C_<name> differ and a mapping is necessary We do not make use of SQL_C_DEFAULT at this time. SQL data types C data types SQL_UNKNOWN_TYPE 0 <undefined> SQL_CHAR 1 SQL_C_CHAR (=) SQL_NUMERIC 2 SQL_C_NUMERIC (=, SQL_C_CHAR up to v3.0 and thus <>) SQL_DECIMAL 3 SQL_C_CHAR (<>) SQL_INTEGER 4 SQL_C_LONG (=) SQL_SMALLINT 5 SQL_C_SHORT (=) SQL_FLOAT 6 SQL_C_DOUBLE (<>) SQL_REAL 7 SQL_C_FLOAT (=) SQL_DOUBLE 8 SQL_C_DOUBLE (=) SQL_DATETIME 9 ignore, same as SQL_DATE SQL_DATE 9 SQL_C_DATE (=) SQL_INTERVAL 10 ignore, same as SQL_TIME SQL_TIME 10 SQL_C_TIME (=) SQL_TIMESTAMP 11 SQL_C_TIMESTAMP (=) SQL_VARCHAR 12 SQL_C_CHAR (<>) SQL_TYPE_DATE 91 SQL_C_TYPE_DATE (=) SQL_TYPE_TIME 92 SQL_C_TYPE_TIME (=) SQL_TYPE_TIMESTAMP 93 SQL_C_TYPE_TIMESTAMP (=) SQL_LONGVARCHAR (-1) SQL_C_CHAR (<>) SQL_BINARY (-2) SQL_C_BINARY (=) SQL_VARBINARY (-3) SQL_C_CHAR (<>) SQL_LONGVARBINARY (-4) SQL_C_CHAR (<>) SQL_BIGINT (-5) SQL_C_SBIGINT (<>) SQL_TINYINT (-6) SQL_C_TINYINT (=) SQL_BIT (-7) SQL_C_BIT (=) SQL_WCHAR (-8) SQL_C_WCHAR (=) SQL_WVARCHAR (-9) SQL_C_WCHAR (<>) SQL_WLONGVARCHAR (-10) SQL_C_WCHAR (<>) SQL_GUID (-11) SQL_C_CHAR (<>)
odbcpp_error | A record with no variable will raise an odbcpp_error. |
Implements odbcpp::record_base.
Definition at line 1317 of file record.cpp.
References f_bind_by_col, f_bind_by_name, odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_data_buffer, odbcpp::record::bind_info_t::f_fetch_size, odbcpp::record::bind_info_t::f_size, odbcpp::record_base::f_statement, odbcpp::record::bind_info_t::f_target_type, odbcpp::smartptr< T >::reset(), and size().
odbcpp::record::empty | ( | ) | const [inline, protected] |
Check whether any bounds were added to this record.
In order to use a record in a fetch, it is necessary to have at least one variable defined.
Definition at line 125 of file record.h.
References f_bind_by_col, and f_bind_by_name.
void odbcpp::record::finalize | ( | ) | [private, virtual] |
Called after each call to SQLFetch().
After we read a row, there can be some data that we need to copy from the internal buffer to the user buffer. Namely, we copy C strings to std::string's in pre-bound records.
Reimplemented from odbcpp::record_base.
Definition at line 1411 of file record.cpp.
References f_bind_by_col, f_bind_by_name, and finalize_info().
void odbcpp::record::finalize_info | ( | bind_info_t * | info | ) | [private] |
Finalize the setup of the given info.
This function finalizes the specified info.
In effect it will update the necessary null pointer boolean values and when a string was bound, it will copy the C-string data to the C++ string.
[in] | info | The info to finalize |
Definition at line 1437 of file record.cpp.
References odbcpp::record::bind_info_t::f_data, odbcpp::record::bind_info_t::f_fetch_size, odbcpp::record::bind_info_t::f_is_null, odbcpp::record::bind_info_t::f_size, odbcpp::record::bind_info_t::f_string, odbcpp::record::bind_info_t::f_target_type, and odbcpp::record::bind_info_t::f_wstring.
Referenced by finalize().
virtual bool odbcpp::record::is_dynamic | ( | ) | const [inline, virtual] |
Bound all the columns to variables automatically?
If this function returns true, then the record will dynamically bound the columns to variables.
Implements odbcpp::record_base.
odbcpp::record::size | ( | ) | const [inline, protected] |
Returns the number of variables bound.
This function returns the number of variables that you have bound in this record.
Definition at line 126 of file record.h.
References f_bind_by_col, and f_bind_by_name.
Referenced by bind_impl().
odbcpp::record::f_bind_by_col [private] |
Map holding the column binding information by index.
This variable holds the indexed columns you bound to this record. They are ordered by index.
Definition at line 220 of file record.h.
Referenced by bind(), bind_impl(), empty(), finalize(), and size().
odbcpp::record::f_bind_by_name [private] |
Map holding the column binding information by name.
This variable holds the named columns you bound to this record. They are ordered by name.
Definition at line 219 of file record.h.
Referenced by bind(), bind_impl(), empty(), finalize(), and size().