Main  /  Edit version 2  /  Edit version 3  /   /  Users Area

Difference "dbixx::session" ver. 2 versus ver. 3

Content:

## Description
This is general class that hold connection with database. It provides C++ interface for `dbi_conn` -- [connection infrastructure](http://libdbi.sourceforge.net/docs/programmers-guide/reference-conn.html) of libdbi.
## Connection Management
## Session Management
### Constructor
session();
session(std::string const &backend);
Create connection object and optionaly load database driver (see, [dbi\_conn\_new](http://libdbi.sourceforge.net/docs/programmers-guide/reference-conn.html#DBI-CONN-NEW))
This object is non-copyable.
### Configuration Member Functions
void driver(std::string const &backend);
void param(std::string const &par,std::string const &val);
void param(std::string const &par,int);
`driver(...)` function provides an ability to load driver if it is not specified in construction.
`param(...)` overloaded function allows to setup different
backend parameters. They represent [dbi\_conn\_set\_option](http://libdbi.sourceforge.net/docs/programmers-guide/reference-conn.html#DBI-CONN-SET-OPTION) and [dbi\_conn\_set\_option\_numeric](http://libdbi.sourceforge.net/docs/programmers-guide/reference-conn.html#DBI-CONN-SET-OPTION-NUMERIC) . You should refer to [libdbi-drivers documentation](http://libdbi-drivers.sourceforge.net/docs.html) for specific parameters.
### Connection
void connect();
void reconnect();
void close();
These member functions are used for connecting, reconnecting and disconnecting configured backend to database.
For example:
session sql;
sql.driver("sqlite3");
sql.param("dbname","test.db");
sql.param("sqlite3_dbdir","./");
sql.connect();
## Preparing a query
void query(std::string const &query);
session &operator<<(std::string const &query);
Function `query` is used for assignment of the next query for execution. Operator `<<` is syntactic sugar for calling `query()`.
sql<<"SELECT name,value FROM options";

About

CppCMS is a web development framework for performance demanding applications.

Support This Project

SourceForge.net Logo

Поддержать проект

CppCMS needs You


Navigation

Main Page


Valid CSS | Valid XHTML 1.0