#include <sqlite.hpp>
According to sqlite3_open documentation, only the thread that opened the database can safely access it. This restriction was relaxed, as described in the FAQ (the "Is SQLite threadsafe?" question), so we can use the library from multiple threads, but only if no more than one thread at a time accesses the database. This restriction is, in fact, beneficial if the database is used from a single application: by restricting access to a sigle thread at a time, we effectively avoid all deadlock issues.
This library goals are:
-DTHREADSAFE, since this is the default setup on UNIX architectures.
Public Types | |
| enum | Flags { existing = 1 } |
| Flags for the Sqlite constructor. More... | |
Public Member Functions | |
| Sqlite (std::string filename, int flags=0) | |
| Opens the database. | |
| ~Sqlite () | |
| Closes the database. | |
Protected Attributes | |
| std::string | filename |
| Filename the database was opened with; we need it to reopen the database on fork()s. | |
| ::sqlite3 * | handler |
| ::pthread_mutex_t | mutex |
Friends | |
| class | SqliteSession |
|
|
Flags for the Sqlite constructor.
|
|
||||||||||||
|
Opens the database.
|
|
|
Closes the database.
|
|
|
Filename the database was opened with; we need it to reopen the database on fork()s. std::string is used to avoid memory allocation issues. |
1.4.6