libsqlite3x  2007.10.18
Classes | Public Member Functions | List of all members
sqlite3x::table_generator Class Reference





EXPERIMENTAL. More...

#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. More...
 
 ~table_generator () throw ()
 Frees up internal resources. More...
 
table_generatoroperator() (std::string const &field_name)
 Adds field_name as a field of this table. More...
 
void create ()
 Executes the 'create table' statements. More...
 

Detailed Description





EXPERIMENTAL.

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.

Constructor & Destructor Documentation

◆ table_generator()

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::sqlite3_connection::executeint().

◆ ~table_generator()

sqlite3x::table_generator::~table_generator ( )
throw (
)

Frees up internal resources.

Definition at line 385 of file sqlite3x_connection.cpp.

Member Function Documentation

◆ create()

void sqlite3x::table_generator::create ( )

Executes the 'create table' statements.

Throws on error.

Definition at line 396 of file sqlite3x_connection.cpp.

References sqlite3x::sqlite3_connection::executenonquery().

◆ operator()()

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.


The documentation for this class was generated from the following files: