Wt
3.2.3
|
An SQLite3 connection. More...
#include <Wt/Dbo/backend/Sqlite3>
Public Types | |
enum | DateTimeStorage { ISO8601AsText, PseudoISO8601AsText, JulianDaysAsReal, UnixTimeAsInteger } |
Configuration of date time storage. More... | |
Public Member Functions | |
Sqlite3 (const std::string &db) | |
Opens a new SQLite3 backend connection. | |
Sqlite3 (const Sqlite3 &other) | |
Copies an SQLite3 connection. | |
~Sqlite3 () | |
Destructor. | |
virtual Sqlite3 * | clone () const |
Clones the connection. | |
sqlite3 * | connection () |
Returns the underlying connection. | |
std::string | connectionString () |
Returns the underlying connection string. | |
void | setDateTimeStorage (SqlDateTimeType type, DateTimeStorage format) |
Configures how to store date or date time. | |
DateTimeStorage | dateTimeStorage (SqlDateTimeType type) const |
Returns the date time storage. | |
virtual void | startTransaction () |
Starts a transaction. | |
virtual void | commitTransaction () |
Commits a transaction. | |
virtual void | rollbackTransaction () |
Rolls back a transaction. | |
virtual SqlStatement * | prepareStatement (const std::string &sql) |
Prepares a statement. | |
Methods that return dialect information | |
virtual std::string | autoincrementSql () const |
Returns the 'autoincrement' SQL type modifier. | |
virtual std::vector< std::string > | autoincrementCreateSequenceSql (const std::string &table, const std::string &id) const |
Returns the SQL statement(s) required to create an id sequence. | |
virtual std::vector< std::string > | autoincrementDropSequenceSql (const std::string &table, const std::string &id) const |
Returns the SQL statement(s) required to drop an id sequence. | |
virtual std::string | autoincrementType () const |
Returns the 'autoincrement' SQL type. | |
virtual std::string | autoincrementInsertSuffix () const |
Returns the suffix for an 'autoincrement' insert statement. | |
virtual const char * | dateTimeType (SqlDateTimeType type) const |
Returns the date/time type. | |
virtual const char * | blobType () const |
Returns the blob type. |
An SQLite3 connection.
This class provides the backend implementation for SQLite3 databases.
Configuration of date time storage.
SQlite3 does not provide real type support for date time. Instead, it offers 3 choices for storing a date time, each of these compatible with the use of the built-in arithmetic functions.
ISO8601AsText |
As 'text' in ISO8601 format. This also interprets correctly dates stored in the database using the PseudoISO8601AsText format. |
PseudoISO8601AsText |
As 'text' in ISO8601-like format, but using a space (' ') instead of 'T' as a separator character between date and time. This is the behaviour of Wt::Dbo prior to Wt 3.2.3. This also interprets correctly dates stored in the database using the ISO8601AsText format. |
JulianDaysAsReal |
As 'real', the number of julian days. Note that this does not support second accuracy for a date time, but is the preferred format for a plain date. |
UnixTimeAsInteger |
As 'integer', number of seconds since UNIX Epoch. |
Wt::Dbo::backend::Sqlite3::Sqlite3 | ( | const std::string & | db | ) |
Opens a new SQLite3 backend connection.
The db
may be any of the values supported by sqlite3_open().
Wt::Dbo::backend::Sqlite3::~Sqlite3 | ( | ) |
Destructor.
Closes the connection.
std::vector< std::string > Wt::Dbo::backend::Sqlite3::autoincrementCreateSequenceSql | ( | const std::string & | table, |
const std::string & | id | ||
) | const [virtual] |
Returns the SQL statement(s) required to create an id sequence.
This is used by Session::createTables() to create the id sequence for a table. The table's name and primary key are passed as arguments to this function and can be used to construct an SQL sequence that is unique for the table.
Implements Wt::Dbo::SqlConnection.
std::vector< std::string > Wt::Dbo::backend::Sqlite3::autoincrementDropSequenceSql | ( | const std::string & | table, |
const std::string & | id | ||
) | const [virtual] |
Returns the SQL statement(s) required to drop an id sequence.
This is used by Session::dropTables() to drop the id sequence for a table. The table's name and primary key are passed as arguments to this function and can be used to construct an SQL sequence that is unique for the table.
Implements Wt::Dbo::SqlConnection.
std::string Wt::Dbo::backend::Sqlite3::autoincrementInsertSuffix | ( | ) | const [virtual] |
Returns the suffix for an 'autoincrement' insert statement.
This is appended to the insert
statement, since some back-ends need to be indicated that they should return the autoincrement id.
Implements Wt::Dbo::SqlConnection.
std::string Wt::Dbo::backend::Sqlite3::autoincrementSql | ( | ) | const [virtual] |
Returns the 'autoincrement' SQL type modifier.
This is used by Session::createTables() to create the id column.
Implements Wt::Dbo::SqlConnection.
std::string Wt::Dbo::backend::Sqlite3::autoincrementType | ( | ) | const [virtual] |
Returns the 'autoincrement' SQL type.
This is used by Session::createTables() to create the id column.
Implements Wt::Dbo::SqlConnection.
const char * Wt::Dbo::backend::Sqlite3::blobType | ( | ) | const [virtual] |
Returns the blob type.
Implements Wt::Dbo::SqlConnection.
Sqlite3 * Wt::Dbo::backend::Sqlite3::clone | ( | ) | const [virtual] |
Clones the connection.
Returns a new connection object that is configured like this object. This is used by connection pool implementations to create its connections.
Implements Wt::Dbo::SqlConnection.
void Wt::Dbo::backend::Sqlite3::commitTransaction | ( | ) | [virtual] |
const char * Wt::Dbo::backend::Sqlite3::dateTimeType | ( | SqlDateTimeType | type | ) | const [virtual] |
Returns the date/time type.
Implements Wt::Dbo::SqlConnection.
SqlStatement * Wt::Dbo::backend::Sqlite3::prepareStatement | ( | const std::string & | sql | ) | [virtual] |
void Wt::Dbo::backend::Sqlite3::rollbackTransaction | ( | ) | [virtual] |
Rolls back a transaction.
This function rolls back a transaction.
Implements Wt::Dbo::SqlConnection.
void Wt::Dbo::backend::Sqlite3::setDateTimeStorage | ( | SqlDateTimeType | type, |
DateTimeStorage | format | ||
) |
Configures how to store date or date time.
The default format is ISO8601AsText.
void Wt::Dbo::backend::Sqlite3::startTransaction | ( | ) | [virtual] |