Belle II Software light-2406-ragdoll
Connection Class Reference

Simple wrapper for a SQLite database connection. More...

#include <sqlite.h>

Collaboration diagram for Connection:

Public Member Functions

 Connection (const std::string &filename)
 Create from filename.
 
 ~Connection ()
 And clean up.
 
template<class ... Columns>
Statement< Columns... > prepare (const std::string &query, bool persistent=false)
 Return a prepared statement for execution.
 
 operator sqlite3 * () const
 Convert to raw sqlite3 pointer to allow initialization of statements without calling prepare.
 

Private Attributes

sqlite3 * m_connection
 Pointer to the sqlite database object.
 

Detailed Description

Simple wrapper for a SQLite database connection.

Definition at line 294 of file sqlite.h.

Constructor & Destructor Documentation

◆ Connection()

Connection ( const std::string &  filename)
inlineexplicit

Create from filename.

Definition at line 297 of file sqlite.h.

298 {
299 detail::checkSQLiteError(sqlite3_open_v2(filename.c_str(), &m_connection, SQLITE_OPEN_READONLY, nullptr));
300 }
sqlite3 * m_connection
Pointer to the sqlite database object.
Definition: sqlite.h:310

◆ ~Connection()

~Connection ( )
inline

And clean up.

Definition at line 302 of file sqlite.h.

302{ if (m_connection) sqlite3_close_v2(m_connection); }

Member Function Documentation

◆ operator sqlite3 *()

operator sqlite3 * ( ) const
inline

Convert to raw sqlite3 pointer to allow initialization of statements without calling prepare.

Definition at line 307 of file sqlite.h.

307{ return m_connection; }

◆ prepare()

Statement< Columns... > prepare ( const std::string &  query,
bool  persistent = false 
)
inline

Return a prepared statement for execution.

Definition at line 305 of file sqlite.h.

305{ return Statement<Columns...>(m_connection, query, persistent); }
ObjectStatement< std::tuple< Columns... >, Columns... > Statement
Basic Statement returning a tuple of columns.
Definition: sqlite.h:289

Member Data Documentation

◆ m_connection

sqlite3* m_connection
private

Pointer to the sqlite database object.

Definition at line 310 of file sqlite.h.


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