VSQLite++ 0.3
Loading...
Searching...
No Matches
sqlite::connection Struct Reference

connection is used to open, close, attach and detach a database. Further it has to be passed to all classes since it represents the connection to the database and contains the internal needed handle, so you can see a connection object as handle to the database An object of this class is not copyable More...

#include <connection.hpp>

Inheritance diagram for sqlite::connection:
Inheritance graph
Collaboration diagram for sqlite::connection:
Collaboration graph

Public Member Functions

 connection (std::string const &db)
 constructor opens the database
 ~connection ()
 destructor closes the database automatically
void attach (std::string const &db, std::string const &database_alias)
 attaches another database file to the database represented by the object of this class. It is possible to attach up to 10 times the same database file with different aliases
void detach (std::string const &database_alias)
 detaches a database via alias, if the same database was attached with several names they will be still present

Private Member Functions

void open (std::string const &db)
void close ()
void access_check ()

Private Attributes

sqlite3 * handle

Friends

struct private_accessor

Detailed Description

connection is used to open, close, attach and detach a database. Further it has to be passed to all classes since it represents the connection to the database and contains the internal needed handle, so you can see a connection object as handle to the database An object of this class is not copyable

Definition at line 45 of file connection.hpp.

Constructor & Destructor Documentation

◆ connection()

sqlite::connection::connection ( std::string const & db)

constructor opens the database

Parameters
dbfilename of the database file if the given file already exists the file will be opened as database. If the file does not exist a new database will be created

◆ ~connection()

sqlite::connection::~connection ( )

destructor closes the database automatically

Member Function Documentation

◆ access_check()

void sqlite::connection::access_check ( )
private

◆ attach()

void sqlite::connection::attach ( std::string const & db,
std::string const & database_alias )

attaches another database file to the database represented by the object of this class. It is possible to attach up to 10 times the same database file with different aliases

Parameters
dbdatabase filename of the database should be attached
database_aliasalias which should be used

◆ close()

void sqlite::connection::close ( )
private

◆ detach()

void sqlite::connection::detach ( std::string const & database_alias)

detaches a database via alias, if the same database was attached with several names they will be still present

Parameters
database_aliasof the database (must be the same alias which was passed in the attach() call)

◆ open()

void sqlite::connection::open ( std::string const & db)
private

◆ private_accessor

friend struct private_accessor
friend

Definition at line 74 of file connection.hpp.

References private_accessor.

Referenced by private_accessor.

Member Data Documentation

◆ handle

sqlite3* sqlite::connection::handle
private

Definition at line 80 of file connection.hpp.

Referenced by sqlite::private_accessor::get_handle().


The documentation for this struct was generated from the following file: