Home Libraries Author Links

DbSql: SQL Interface of Named Persistent Associative Containers
[SysToMath DbSql C++ Library]

Collaboration diagram for DbSql: SQL Interface of Named Persistent Associative Containers:

Detailed Description

Rudimentary SQL interface of named persistent associative containers with unique and equivalent keys.

The declarations of these utilities are all contained in the namespace stm::db::sql.


Files

file  dbsql.hpp
 Declarations for the SQL interface of named persistent associative containers with unique and equivalent keys.

Classes

struct  stm::db::sql::noconversion< T >
class  stm::db::sql::table
 Abstract base class representing a SQL database table. More...
class  stm::db::sql::table::field
struct  stm::db::sql::table::average< T >
struct  stm::db::sql::table::average< db::null_type >
struct  stm::db::sql::table::average< bool >
struct  stm::db::sql::table::average< std::string >
struct  stm::db::sql::table::average< std::vector< byte > >
struct  stm::db::sql::table::defcol< T, Flags, Convert >
struct  stm::db::sql::table::types< DefColSequence >
class  stm::db::sql::table::column
class  stm::db::sql::table::layout
class  stm::db::sql::table::descr
class  stm::db::sql::table::descrmap
class  stm::db::sql::table::locker
class  stm::db::sql::result
class  stm::db::sql::connection
 Class representing a SQL database connection. More...

Functions

 stm::db::sql::connection::~connection ()
const std::string & stm::db::sql::connection::path () const
 Returns the database connection path name..
bool stm::db::sql::connection::existsTable (const std::string &name) const throw ()
 Returns true, if the table name exists for this connection, else false.
void stm::db::sql::connection::createTable (const std::string &name, const std::string &type, const table::layout &columns) throw (std::runtime_error)
 If a table type is defined and a table name does not already exist, create a table named name of type type with layout columns for this connection, else throw.
template<class InputIterator>
void stm::db::sql::connection::createTable (const std::string &name, const std::string &type, InputIterator firstColumn, InputIterator lastColumn) throw (std::runtime_error)
 If a table type is defined and a table name does not already exist, create a table named name of type type with layout determined by the range [*firstColumn, *lastColumns) for this connection, else throw.
bool stm::db::sql::connection::deleteTable (const std::string &name, bool force=false)
 If a table named name exists for this connection, delete it, if it is not active or force is true (default: false).
bool stm::db::sql::connection::activateTable (const std::string &name, size_type cacheSizeKb=0) throw (std::runtime_error)
 If a table named name exists for this connection, activate it, if it is not already active.
bool stm::db::sql::connection::deactivateTable (const std::string &name)
 If a table named name exists for this connection, deactivate it, if it is active.
table & stm::db::sql::connection::getTable (const std::string &name) const throw (std::runtime_error)
const std::string & stm::db::sql::connection::getTableType (const std::string &name) const throw (std::runtime_error)
const table::descrmap & stm::db::sql::connection::tables () const
 Returns a constant reference to the table map which describes all tables of this connection.
table::descr * stm::db::sql::connection::getTableDescr (const std::string &name)
 Returns the address of the table descriptor of table name, if it exists, else the NULL pointer.
result * stm::db::sql::connection::execsql (const std::string &cmd) throw (std::runtime_error)
 Interpretes the SQL command cmd and returns a pointer to an according result object.
int stm::db::sql::connection::errorno () const
 Returns the numerical error status of the last SQL command execution.
const std::string & stm::db::sql::connection::errormsg () const
 Returns the textual error status of the last SQL command execution.

Variables

const size_type stm::db::sql::delayedsort = local::DelayedSortFlag
 Flag value for class template table::defcol indicating a sortable column whose index shall be constructed delayed, if applicable.
const size_type stm::db::sql::recnosort = local::DelayedSortFlag | local::RecnoFlag
 Flag value for class template table::defcol indicating a sortable column whose index shall be constructed delayed and support fast record based positioning, if applicable.
const size_type stm::db::sql::notsortable = local::NotSortableValue
 Flag value for class template table::defcol overwrites all other flags and indicates a not sortable column.


Function Documentation

stm::db::sql::connection::~connection (  )  [inherited]

const std::string& stm::db::sql::connection::path (  )  const [inherited]

Returns the database connection path name..

bool stm::db::sql::connection::existsTable ( const std::string &  name  )  const throw () [inherited]

Returns true, if the table name exists for this connection, else false.

void stm::db::sql::connection::createTable ( const std::string &  name,
const std::string &  type,
const table::layout columns 
) throw (std::runtime_error) [inherited]

If a table type is defined and a table name does not already exist, create a table named name of type type with layout columns for this connection, else throw.

Creation of a table does not mean the creation or opening of any database or index. This is done by activateTable().

template<class InputIterator>
void stm::db::sql::connection::createTable ( const std::string &  name,
const std::string &  type,
InputIterator  firstColumn,
InputIterator  lastColumn 
) throw (std::runtime_error) [inherited]

If a table type is defined and a table name does not already exist, create a table named name of type type with layout determined by the range [*firstColumn, *lastColumns) for this connection, else throw.

Creation of a table does not mean the creation or opening of any database or index. This is done by activateTable().

bool stm::db::sql::connection::deleteTable ( const std::string &  name,
bool  force = false 
) [inherited]

If a table named name exists for this connection, delete it, if it is not active or force is true (default: false).

If force is true and the table is active, it is deactivated before deletion. Deletion of a table does not mean the physical deletion of any database or index. This is has to be done by external means. Return true on success.

bool stm::db::sql::connection::activateTable ( const std::string &  name,
size_type  cacheSizeKb = 0 
) throw (std::runtime_error) [inherited]

If a table named name exists for this connection, activate it, if it is not already active.

Throw, if the table does not exist, or if its activation failed. Activation of a table means opening the corresponding database and its indexes, creating them, if they do not already exist. return true, if the table was activated, false, if it already had been activated.

bool stm::db::sql::connection::deactivateTable ( const std::string &  name  )  [inherited]

If a table named name exists for this connection, deactivate it, if it is active.

Dectivation of a table means closing of the corresponding database and its indexes. Return true on success.

table& stm::db::sql::connection::getTable ( const std::string &  name  )  const throw (std::runtime_error) [inherited]

const std::string& stm::db::sql::connection::getTableType ( const std::string &  name  )  const throw (std::runtime_error) [inherited]

const table::descrmap& stm::db::sql::connection::tables (  )  const [inherited]

Returns a constant reference to the table map which describes all tables of this connection.

table::descr* stm::db::sql::connection::getTableDescr ( const std::string &  name  )  [inherited]

Returns the address of the table descriptor of table name, if it exists, else the NULL pointer.

result* stm::db::sql::connection::execsql ( const std::string &  cmd  )  throw (std::runtime_error) [inherited]

Interpretes the SQL command cmd and returns a pointer to an according result object.

On return the error status has been updated.

int stm::db::sql::connection::errorno (  )  const [inherited]

Returns the numerical error status of the last SQL command execution.

const std::string& stm::db::sql::connection::errormsg (  )  const [inherited]

Returns the textual error status of the last SQL command execution.


Variable Documentation

const size_type stm::db::sql::delayedsort = local::DelayedSortFlag

Flag value for class template table::defcol indicating a sortable column whose index shall be constructed delayed, if applicable.

Definition at line 160 of file dbsql.hpp.

const size_type stm::db::sql::recnosort = local::DelayedSortFlag | local::RecnoFlag

Flag value for class template table::defcol indicating a sortable column whose index shall be constructed delayed and support fast record based positioning, if applicable.

Definition at line 167 of file dbsql.hpp.

const size_type stm::db::sql::notsortable = local::NotSortableValue

Flag value for class template table::defcol overwrites all other flags and indicates a not sortable column.

Definition at line 173 of file dbsql.hpp.


© Copyright Tom Michaelis 2002-2007

Distributed under the SysToMath Software License (See the accompanying file license.txt or a copy at www.SysToMath.com).