WORM 0.2
A C++ DAL/ORM code generation framework
Public Member Functions

WSql::WSqliteDriver Class Reference

#include <wsqlitedriver.h>

Inheritance diagram for WSql::WSqliteDriver:

List of all members.

Public Member Functions

 WSqliteDriver (WSqlDatabase *db)
 ~WSqliteDriver ()
bool open ()
void close ()
bool query (std::string sql)
 Send the query sql to the database.
WSqlResultresult (bool iscached=true)
std::vector< std::string > tableNames ()
WSqlTable tableMetaData (const std::string &tableName)

Detailed Description

driver for SQlite3 databases This class provides a driver for SQlite3 databases.

DANGER: USE AT YOUR OWN RISK!! NOT RECOMMENDED.

Todo:
This driver is unfinished. Basic functionality is there but it is not, ah, elegant. Metadata is incomplete, all results are cached locally and there may be strange behavior. Basically I have done enough to get sufficient metadata for the ORM generator (except indices still) and query() will perform the query and return a result via getResult(). tableNames() works and tableMetaData() works as well (with the above caveats). Transactions are not supported and I seriously doubt that this is thread safe. It quite is crude at the moment - your milage may vary. It _might_ work for you but at this point I don't recommend it for production (10/10/2011)

(at a minimum) :

See also:
WSqlDriver WSqlMysqlDriver

Definition at line 33 of file wsqlitedriver.h.


Constructor & Destructor Documentation

WSql::WSqliteDriver::WSqliteDriver ( WSqlDatabase db)

Definition at line 212 of file wsqlitedriver.cpp.

WSql::WSqliteDriver::~WSqliteDriver ( )

Definition at line 217 of file wsqlitedriver.cpp.


Member Function Documentation

void WSql::WSqliteDriver::close ( ) [virtual]

Derived classes must reimplement this pure virtual function in order to close the database connection. Return true on success, false on failure.

See also:
open(), setOpen()

Implements WSql::WSqlDriver.

Definition at line 262 of file wsqlitedriver.cpp.

bool WSql::WSqliteDriver::open ( ) [virtual]

Derived classes must reimplement this pure virtual function to open a database connection on the database

The function must return true on success and false on failure.

See also:
setOpen()

Implements WSql::WSqlDriver.

Definition at line 241 of file wsqlitedriver.cpp.

bool WSql::WSqliteDriver::query ( std::string  sql) [virtual]

Send the query sql to the database.

Todo:
refactor this using metadata to construct a proper result set .. sqlite doesn't return things in orderly fashion - if a field is empty (i.e. NULL) it just doesn't include it in the results (ARG!), i _think_ and other strange random behavior is observed ..- so, we need to construct a skeleton result set from metadata and then fill it leaving the appropriate gaps such that the field name will _always_ be there. We can't simply refer to tableMetaData as it may be a join or such - which would mean parsing the query, etc..ugly The problem is that we cannot rely on sqlite to return metadata if, for instance, the query returns no results.. Consider using sqlite3_column_metadata. Also, some of this might be better moved to getResult()
Parameters:
std::stringsql containing the query string
Return values:
bool

Implements WSql::WSqlDriver.

Definition at line 292 of file wsqlitedriver.cpp.

WSqlResult * WSql::WSqliteDriver::result ( bool  iscached = true) [virtual]

Reimplemented from WSql::WSqlDriver.

Definition at line 352 of file wsqlitedriver.cpp.

WSqlTable WSql::WSqliteDriver::tableMetaData ( const std::string &  tableName) [virtual]

Implements WSql::WSqlDriver.

Definition at line 384 of file wsqlitedriver.cpp.

std::vector< std::string > WSql::WSqliteDriver::tableNames ( ) [virtual]
Todo:
support table type flag .. views, information schema

Implements WSql::WSqlDriver.

Definition at line 360 of file wsqlitedriver.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Defines