SqlDatabase Class Reference

Base class, acts as a common interface for all SQL database types. More...

#include <sqldatabase.hpp>

Inheritance diagram for SqlDatabase:

MySqlContext PostgresContext Sqlite2Context Sqlite3Context List of all members.

Public Member Functions

 SqlDatabase (const string &dbName="", const string &user="", const string &passwd="", const string &host="localhost", const int port=0, const string &unixSocket="", const unsigned long clientFlag=0)
 Constructor.
virtual ~SqlDatabase ()
 Destructor.
virtual void close ()=0
 Close connection.
virtual string escapeString (const string &original) const=0
 Escape special characters.
virtual string version () const=0
 Version information.

Friends

SqlResult SqlQuery::operator() (const string &)

Detailed Description

Base class, acts as a common interface for all SQL database types.

Definition at line 40 of file sqldatabase.hpp.


Constructor & Destructor Documentation

SqlDatabase::SqlDatabase ( const string &  dbName = "",
const string &  user = "",
const string &  passwd = "",
const string &  host = "localhost",
const int  port = 0,
const string &  unixSocket = "",
const unsigned long  clientFlag = 0 
) [inline]

Constructor.

The constructor for creating a connection to the database. You must provide the arguments needed for connecting to the SQL engine you are using. For SQLite only dbName is used, for other backends you may need to get the values of the arguments from your system administrator.

Parameters:
dbName Name of the database.
user User name for authentication.
passwd Password for authentication.
host Host name to the database. Default is 'localhost'.
port The port used for connecting to the database.
unixSocket For local connections.
clientFlag Options to be sent to database server.

Definition at line 57 of file sqldatabase.hpp.

virtual SqlDatabase::~SqlDatabase (  )  [inline, virtual]

Destructor.

Definition at line 68 of file sqldatabase.hpp.


Member Function Documentation

virtual void SqlDatabase::close (  )  [pure virtual]

Close connection.

This will close and clean up the database connection, including freeing memory. Note: It does not delete the SqlDatabase object itself.

Implemented in MySqlContext, PostgresContext, Sqlite2Context, and Sqlite3Context.

virtual string SqlDatabase::escapeString ( const string &  original  )  const [pure virtual]

Escape special characters.

This function can be used to escape special characters (like single quotes) when building an SQL statement.

Parameters:
original The string that you want escaped.
Returns:
The escaped version.

virtual string SqlDatabase::version (  )  const [pure virtual]

Version information.

Get the version information of the underlying API library, not the version of SqlWrapperXX.

Returns:
The version as a string.

Implemented in MySqlContext, PostgresContext, Sqlite2Context, and Sqlite3Context.


Friends And Related Function Documentation

SqlResult SqlQuery::operator() ( const string &   )  [friend]


The documentation for this class was generated from the following file:
Generated on Sat Aug 18 16:21:45 2007 for SqlWrapperXX by  doxygen 1.5.0