#include <sqlite3x.hpp>
Classes | |
class | table_generator_impl |
An internal implementation detail of table_generator. More... | |
Public Member Functions | |
table_generator (sqlite3_connection &con, std::string const &name) | |
Initializes the table generation process. | |
~table_generator () throw () | |
Frees up internal resources. | |
table_generator & | operator() (std::string const &field_name) |
Adds field_name as a field of this table. | |
void | create () |
Executes the 'create table' statements. |
A helper type for storing information on functions to register with sqlite. EXPERIMENTAL. EXPERIMENTAL. A helper class to generate db tables.
It is used like so:
table_generator( connection, "table_name" )( "field1" )( "field2" )("field3").create();
That creates the named table with the given fields. It throws if table_name already exists in the db or if creation of the table fails.
An arbitrary number of fields can be added using operator()(string), up to the internal limits set by sqlite3.
Definition at line 886 of file sqlite3x.hpp.
sqlite3x::table_generator::table_generator | ( | sqlite3_connection & | con, | |
std::string const & | name | |||
) | [explicit] |
Initializes the table generation process.
Throws if con contains a table with the same name.
Definition at line 372 of file sqlite3x_connection.cpp.
References sqlite3x::table_generator::table_generator_impl::db, sqlite3x::sqlite3_connection::executeint(), and sqlite3x::table_generator::table_generator_impl::name.
sqlite3x::table_generator::~table_generator | ( | ) | throw () |
void sqlite3x::table_generator::create | ( | ) |
Executes the 'create table' statements.
Throws on error.
Definition at line 396 of file sqlite3x_connection.cpp.
References sqlite3x::table_generator::table_generator_impl::db, sqlite3x::sqlite3_connection::executenonquery(), sqlite3x::table_generator::table_generator_impl::list, and sqlite3x::table_generator::table_generator_impl::name.
table_generator & sqlite3x::table_generator::operator() | ( | std::string const & | field_name | ) |
Adds field_name as a field of this table.
Checks for duplicate field names are deferred until create() is called.
Definition at line 390 of file sqlite3x_connection.cpp.
References sqlite3x::table_generator::table_generator_impl::list.