Wt  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Types | Public Member Functions
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]

List of all members.

Public Types

enum  DateTimeStorage { ISO8601AsText, 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 Sqlite3clone () 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 SqlStatementprepareStatement (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.
- Public Member Functions inherited from Wt::Dbo::SqlConnection
virtual ~SqlConnection ()
 Destructor.
virtual void executeSql (const std::string &sql)
 Executes an SQL statement.
virtual SqlStatementgetStatement (const std::string &id) const
 Returns the statement with the given id.
virtual void saveStatement (const std::string &id, SqlStatement *statement)
 Saves a statement with the given id.
void setProperty (const std::string &name, const std::string &value)
 Sets a property.
std::string property (const std::string &name) const
 Returns a property.
virtual void prepareForDropTables ()
 Execute code before dropping the tables.
virtual const char * textType () const
 Returns the text type.
virtual const char * booleanType () const
 Returns the boolean type.
virtual bool usesRowsFromTo () const
 Returns whether the SQL dialect uses 'ROWS ? TO ?' for partial select results.

Detailed Description

An SQLite3 connection.

This class provides the backend implementation for SQLite3 databases.


Member Enumeration Documentation

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.

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

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.


Member Function Documentation

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

Commits a transaction.

This function commits a transaction.

Implements Wt::Dbo::SqlConnection.

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

Prepares a statement.

Returns the prepared statement.

Implements Wt::Dbo::SqlConnection.

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

Starts a transaction.

This function starts a transaction.

Implements Wt::Dbo::SqlConnection.


Generated on Wed Jun 13 2012 for the C++ Web Toolkit (Wt) by doxygen 1.8.1