LibrePCB Developers Documentation
SQLiteDatabase Class Referencefinal

The SQLiteDatabase class. More...

#include <sqlitedatabase.h>

Inherits QObject.

+ Collaboration diagram for SQLiteDatabase:

Classes

class  TransactionScopeGuard
 

Public Types

typedef QVector< std::pair< QString, QString > > Replacements
 

Public Member Functions

 SQLiteDatabase ()=delete
 
 SQLiteDatabase (const SQLiteDatabase &other)=delete
 
 SQLiteDatabase (const FilePath &filepath, QObject *parent=nullptr)
 
 ~SQLiteDatabase () noexcept
 
void beginTransaction ()
 
void commitTransaction ()
 
void rollbackTransaction ()
 
void clearTable (const QString &table)
 
QSqlQuery prepareQuery (QString query, const Replacements &replacements={}) const
 
int count (QSqlQuery &query)
 
int insert (QSqlQuery &query)
 
void exec (QSqlQuery &query)
 
void exec (const QString &query)
 
SQLiteDatabaseoperator= (const SQLiteDatabase &rhs)=delete
 

Private Member Functions

void enableSqliteWriteAheadLogging ()
 Enable the "Write-Ahead Logging" (WAL) feature of SQLite. More...
 
QHash< QString, QString > getSqliteCompileOptions ()
 Get compile options of the SQLite driver library. More...
 

Private Attributes

QSqlDatabase mDb
 

Detailed Description

The SQLiteDatabase class.

Member Typedef Documentation

◆ Replacements

typedef QVector<std::pair<QString, QString> > Replacements

Constructor & Destructor Documentation

◆ SQLiteDatabase() [1/3]

SQLiteDatabase ( )
delete

◆ SQLiteDatabase() [2/3]

SQLiteDatabase ( const SQLiteDatabase other)
delete

◆ SQLiteDatabase() [3/3]

SQLiteDatabase ( const FilePath filepath,
QObject *  parent = nullptr 
)
+ Here is the call graph for this function:

◆ ~SQLiteDatabase()

~SQLiteDatabase ( )
noexcept

Member Function Documentation

◆ beginTransaction()

void beginTransaction ( )
+ Here is the caller graph for this function:

◆ commitTransaction()

void commitTransaction ( )

◆ rollbackTransaction()

void rollbackTransaction ( )

◆ clearTable()

void clearTable ( const QString &  table)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareQuery()

QSqlQuery prepareQuery ( QString  query,
const Replacements replacements = {} 
) const
+ Here is the caller graph for this function:

◆ count()

int count ( QSqlQuery &  query)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert()

int insert ( QSqlQuery &  query)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exec() [1/2]

void exec ( QSqlQuery &  query)
+ Here is the caller graph for this function:

◆ exec() [2/2]

void exec ( const QString &  query)
+ Here is the call graph for this function:

◆ operator=()

SQLiteDatabase & operator= ( const SQLiteDatabase rhs)
delete

◆ enableSqliteWriteAheadLogging()

void enableSqliteWriteAheadLogging ( )
private

Enable the "Write-Ahead Logging" (WAL) feature of SQLite.

Note
LibrePCB requires to enable WAL to avoid blocking readers by writers. If not enabled, the library scanner would also block all read-only accesses to the library database.
See also
http://www.sqlite.org/wal.html
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSqliteCompileOptions()

QHash< QString, QString > getSqliteCompileOptions ( )
private

Get compile options of the SQLite driver library.

Returns
A hashmap of all compile options (without the "SQLITE_" prefix)
See also
https://sqlite.org/pragma.html#pragma_compile_options
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ mDb

QSqlDatabase mDb
private

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