Belle II Software development
Connection Class Reference

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

#include <sqlite.h>

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 310 of file sqlite.h.

Constructor & Destructor Documentation

◆ Connection()

Connection ( const std::string &  filename)
inlineexplicit

Create from filename.

Definition at line 313 of file sqlite.h.

314 {
315 detail::checkSQLiteError(sqlite3_open_v2(filename.c_str(), &m_connection, SQLITE_OPEN_READONLY, nullptr));
316 }
sqlite3 * m_connection
Pointer to the sqlite database object.
Definition: sqlite.h:326

◆ ~Connection()

~Connection ( )
inline

And clean up.

Definition at line 318 of file sqlite.h.

318{ 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 323 of file sqlite.h.

323{ return m_connection; }

◆ prepare()

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

Return a prepared statement for execution.

Definition at line 321 of file sqlite.h.

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

Member Data Documentation

◆ m_connection

sqlite3* m_connection
private

Pointer to the sqlite database object.

Definition at line 326 of file sqlite.h.


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