Wt  3.7.1
Public Types | Public Member Functions | List of all members
Wt::Dbo::backend::Sqlite3 Class Reference

An SQLite3 connection. More...

#include <Wt/Dbo/backend/Sqlite3>

Inheritance diagram for Wt::Dbo::backend::Sqlite3:
Inheritance graph
[legend]

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. More...
 
 Sqlite3 (const Sqlite3 &other)
 Copies an SQLite3 connection.
 
 ~Sqlite3 ()
 Destructor. More...
 
virtual Sqlite3clone () const
 Clones the connection. More...
 
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. More...
 
DateTimeStorage dateTimeStorage (SqlDateTimeType type) const
 Returns the date time storage.
 
virtual void startTransaction ()
 Starts a transaction. More...
 
virtual void commitTransaction ()
 Commits a transaction. More...
 
virtual void rollbackTransaction ()
 Rolls back a transaction. More...
 
virtual SqlStatementprepareStatement (const std::string &sql)
 Prepares a statement. More...
 
Methods that return dialect information
virtual std::string autoincrementSql () const
 Returns the 'autoincrement' SQL type modifier. More...
 
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. More...
 
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. More...
 
virtual std::string autoincrementType () const
 Returns the 'autoincrement' SQL type. More...
 
virtual std::string autoincrementInsertSuffix (const std::string &id) const
 Returns the suffix for an 'autoincrement' insert statement. More...
 
virtual const char * dateTimeType (SqlDateTimeType type) const
 Returns the date/time type. More...
 
virtual const char * blobType () const
 Returns the blob type. More...
 
virtual bool supportDeferrableFKConstraint () const
 Returns true if the backend supports "deferrable initially deferred" foreign key constraints. More...
 
- Public Member Functions inherited from Wt::Dbo::SqlConnection
virtual ~SqlConnection ()
 Destructor.
 
virtual void executeSql (const std::string &sql)
 Executes an SQL statement. More...
 
virtual void executeSqlStateful (const std::string &sql)
 Executes a connection-stateful SQL statement. More...
 
virtual SqlStatementgetStatement (const std::string &id)
 Returns the statement with the given id. More...
 
virtual void saveStatement (const std::string &id, SqlStatement *statement)
 Saves a statement with the given id. More...
 
void setProperty (const std::string &name, const std::string &value)
 Sets a property. More...
 
std::string property (const std::string &name) const
 Returns a property. More...
 
virtual std::string autoincrementInsertInfix (const std::string &id) const
 Returns the infix for an 'autoincrement' insert statement. More...
 
virtual void prepareForDropTables ()
 Execute code before dropping the tables. More...
 
virtual std::string textType (int size) const
 Returns the text type. More...
 
virtual std::string longLongType () const
 Returns the 64-bit integer type. More...
 
virtual const char * booleanType () const
 Returns the boolean type. More...
 
virtual bool supportUpdateCascade () const
 Returns true if the database supports Update Cascade. More...
 
virtual bool requireSubqueryAlias () const
 Returns the true if the database require subquery alias. More...
 
virtual LimitQuery limitQueryMethod () const
 
virtual bool usesRowsFromTo () const
 Returns whether the SQL dialect uses 'ROWS ? TO ?', limit or rownum for partial select results. More...
 
virtual bool supportAlterTable () const
 Returns true if the backend support Alter Table. More...
 
virtual const char * alterTableConstraintString () const
 Returns the command used in alter table .. drop constraint .. More...
 

Detailed Description

An SQLite3 connection.

This class provides the backend implementation for SQLite3 databases.

Member Enumeration Documentation

◆ DateTimeStorage

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.

Enumerator
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.

Constructor & Destructor Documentation

◆ Sqlite3()

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().

◆ ~Sqlite3()

Wt::Dbo::backend::Sqlite3::~Sqlite3 ( )

Destructor.

Closes the connection.

Member Function Documentation

◆ autoincrementCreateSequenceSql()

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.

◆ autoincrementDropSequenceSql()

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.

◆ autoincrementInsertSuffix()

std::string Wt::Dbo::backend::Sqlite3::autoincrementInsertSuffix ( const std::string &  id) 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.

◆ autoincrementSql()

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.

◆ autoincrementType()

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.

◆ blobType()

const char * Wt::Dbo::backend::Sqlite3::blobType ( ) const
virtual

◆ clone()

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.

◆ commitTransaction()

void Wt::Dbo::backend::Sqlite3::commitTransaction ( )
virtual

Commits a transaction.

This function commits a transaction.

Implements Wt::Dbo::SqlConnection.

◆ dateTimeType()

const char * Wt::Dbo::backend::Sqlite3::dateTimeType ( SqlDateTimeType  type) const
virtual

◆ prepareStatement()

SqlStatement * Wt::Dbo::backend::Sqlite3::prepareStatement ( const std::string &  sql)
virtual

Prepares a statement.

Returns the prepared statement.

Implements Wt::Dbo::SqlConnection.

◆ rollbackTransaction()

void Wt::Dbo::backend::Sqlite3::rollbackTransaction ( )
virtual

Rolls back a transaction.

This function rolls back a transaction.

Implements Wt::Dbo::SqlConnection.

◆ setDateTimeStorage()

void Wt::Dbo::backend::Sqlite3::setDateTimeStorage ( SqlDateTimeType  type,
DateTimeStorage  format 
)

Configures how to store date or date time.

The default format is ISO8601AsText.

◆ startTransaction()

void Wt::Dbo::backend::Sqlite3::startTransaction ( )
virtual

Starts a transaction.

This function starts a transaction.

Implements Wt::Dbo::SqlConnection.

◆ supportDeferrableFKConstraint()

bool Wt::Dbo::backend::Sqlite3::supportDeferrableFKConstraint ( ) const
virtual

Returns true if the backend supports "deferrable initially deferred" foreign key constraints.

This method will return false by default.

Reimplemented from Wt::Dbo::SqlConnection.


Generated on Tue Dec 15 2020 for the C++ Web Toolkit (Wt) by doxygen 1.8.13