|
CppDB
|
Namespaces | |
| namespace | backend |
This namepace includes all classes required to implement a cppdb SQL backend. | |
Classes | |
| class | atomic_counter |
| Atomic counter is a class that allows perform counting in thread safe way. More... | |
| class | connections_manager |
| This class is the major gateway to new connections. More... | |
| class | connection_specific_data |
| Special abstract object that holds a connection specific data. More... | |
| class | driver_manager |
| this class is used to handle all drivers, loading them, unloading them etc. More... | |
| class | cppdb_error |
| This is the base error of all errors thrown by cppdb. More... | |
| class | bad_value_cast |
| invalid data conversions More... | |
| class | null_value_fetch |
| attempt to fetch a null value. More... | |
| class | empty_row_access |
| attempt to fetch a value from the row without calling next() first time or when next() returned false. More... | |
| class | invalid_column |
| trying to fetch a value using invalid column index More... | |
| class | invalid_placeholder |
| trying to fetch a value using invalid placeholder More... | |
| class | multiple_rows_query |
| trying to fetch a single row for a query that returned multiple ones. More... | |
| class | not_supported_by_backend |
| This operation is not supported by the backend. More... | |
| class | result |
| This object represents query result. More... | |
| class | statement |
| This class represents a prepared (or ordinary) statement that can be executed. More... | |
| class | session |
| SQL session object that represents a single connection and is the gateway to SQL database. More... | |
| class | transaction |
| The transaction guard. More... | |
| class | mutex |
| mutex class, used internally More... | |
| class | pool |
| Connections pool, allows to handle multiple connections for specific connection string. More... | |
| class | ref_ptr |
| This is a smart intrusive reference counting pointer that throws a error on empty access. More... | |
| class | ref_counted |
| This is a class that implements reference counting and designed to be used with ref_ptr. More... | |
| class | shared_object |
| This class allows to load and unload shared objects in simple and exception safe way. More... | |
| class | connection_info |
| Class that represents parsed connection string. More... | |
Typedefs | |
| typedef unspecified_class_type | once_functor |
Enumerations | |
| enum | null_tag_type { null_value, not_null_value } |
Functions | |
| CPPDB_API char const * | version_string () |
| CPPDB_API int | version_number () |
| template<typename T > | |
| tags::into_tag< T > | into (T &value, null_tag_type &tag) |
| Create a pair of value and tag for fetching a value from row. | |
|
tags::use_tag< std::string const & > | use (std::string const &v, null_tag_type tag) |
| Create a pair of a string value and tag for storing it to DB. | |
| tags::use_tag< char const * > | use (char const *v, null_tag_type tag) |
| Create a pair of a string value and tag for storing it to DB. | |
| template<typename T > | |
| tags::use_tag< T > | use (T value, null_tag_type tag) |
| Create a pair of value and tag for storing it to DB. | |
| void | exec (statement &st) |
| Manipulator that causes statement execution. Used as: | |
| void | null (statement &st) |
| Manipulator that binds null value. Used as: | |
| result | row (statement &st) |
| Manipulator that fetches a single row. Used as: | |
| template<typename T > | |
| T | parse_number (std::string const &s, std::istringstream &ss) |
| CPPDB_API std::tm | parse_time (char const *value) |
| parse a string as time value. | |
| CPPDB_API std::string | format_time (std::tm const &v) |
| format a string as time value. | |
| CPPDB_API std::tm | parse_time (std::string const &v) |
| parse a string as time value. | |
| CPPDB_API void | parse_connection_string (std::string const &cs, std::string &driver_name, std::map< std::string, std::string > &props) |
| Parse a connection string cs into driver name driver_name and list of properties props. | |
The namespace of all data related to the cppdb api
| typedef unspecified_class_type cppdb::once_functor |
Special object that can be constructed from generic function like object f.
So once_functor(f) can be created if f can be used like f(s) where s is cppdb::session
| enum cppdb::null_tag_type |
| void cppdb::exec | ( | statement & | st | ) | [inline] |
Manipulator that causes statement execution. Used as:
sql << "delete from test" << cppdb::exec;
| CPPDB_API std::string cppdb::format_time | ( | std::tm const & | v | ) |
format a string as time value.
Used by backend implementations;
| tags::into_tag<T> cppdb::into | ( | T & | value, |
| null_tag_type & | tag | ||
| ) |
Create a pair of value and tag for fetching a value from row.
The fetched value will be stored in value if the column is not null and the flag if the value is null or not saved in tag
| void cppdb::null | ( | statement & | st | ) | [inline] |
Manipulator that binds null value. Used as:
sql << "insert into foo values(?,?,?)" << x << cppdb::null << y << cppdb::exec;
| CPPDB_API void cppdb::parse_connection_string | ( | std::string const & | cs, |
| std::string & | driver_name, | ||
| std::map< std::string, std::string > & | props | ||
| ) |
Parse a connection string cs into driver name driver_name and list of properties props.
The connection string format is following:
driver:[key=value;]*
Where value can be either a sequence of characters (white space is trimmed) or it may be a general sequence encloded in a single quitation marks were double quote is used for insering a single quote value.
Key values starting with @ are reserved to be used as special cppdb keys For example:
mysql:username= root;password = 'asdf''5764dg';database=test;@use_prepared=off'
Where driver is "mysql", username is "root", password is "asdf'5764dg", database is "test" and special value "@use_prepared" is off - internal cppdb option.
| T cppdb::parse_number | ( | std::string const & | s, |
| std::istringstream & | ss | ||
| ) |
Small utility functions for backends, accepts - source string and stringstream with imbued std::locale it tries to case the value to T in best possible way.
For floating point string it casts it to the nearest ineger
| CPPDB_API std::tm cppdb::parse_time | ( | char const * | value | ) |
parse a string as time value.
Used by backend implementations;
| CPPDB_API std::tm cppdb::parse_time | ( | std::string const & | v | ) |
parse a string as time value.
Used by backend implementations;
| result cppdb::row | ( | statement & | st | ) | [inline] |
Manipulator that fetches a single row. Used as:
cppdb::result r = sql << "SELECT name where uid=?" << id << cppdb::row; if(!r.empty()) { ... }
Or:
sql << "SELECT name where uid=?" << id << cppdb::row >> name;
Which would throw empty_row_access exception on attempt to fetch name if the result is empty.
| CPPDB_API int cppdb::version_number | ( | ) |
Return CppDB version as a number as a sum A * 10000 + B * 100 + C where A is a major version number, B is a minor version number and C is patch version
| CPPDB_API char const* cppdb::version_string | ( | ) |
Get CppDB Version String. It consists of "A.B.C", where A is a major version number, B is a minor version number and C is patch version
1.7.6.1