xvr2::SQL::Driver Class Reference

#include <Driver.h>

Inheritance diagram for xvr2::SQL::Driver:

Inheritance graph
[legend]

List of all members.


Detailed Description

Definition at line 28 of file Driver.h.


Public Member Functions

 Driver ()
virtual const SQL::DriverInfogetVersionInfo ()=0
 Use this function to retrieve version and/or vendor informaton for the driver.
virtual void * connect (const String &server, const String &__dbname, const String &user, const String &pass, int port=0)=0
 Attempts to make a connection the specified database server.
virtual void * connect (const String &dbsock, const String &_dbname, const String &_user, const String &_pass)=0
 Attempts to make a connection to a local database instance.
virtual void * open (const String &dbfile)=0
 Opens a connection to a local (embedded) database engine.
virtual ResultSetquery (void *__handle, const String &command)=0
 Use this method to send a command to the backend server.
virtual int execCommand (void *__handle, const String &command)=0
 Use this method to send a command to the backend server.
virtual bool disconnect (void *__handle)=0
 This method will disconnect you from the backend server if you are connected.
virtual void setAutoCommit (bool val=true)=0
 The use of this method will turn on autocommits, the idea is that if you issue an update or delete command this will call the commit command inmediately so there is no reason for you to call it manually everytime you need it.
virtual void commit (void *__handle)=0
 This will commit any transaction based command to the database, when you call commit every submitted delete or update they will execute each other in sequence.
virtual const int numRows (void *__res_handle)=0
 This will return the number of rows for the current result handle.
virtual const int numCols (void *__res_handle)=0
 This will return the number of columns for the current result handle.
virtual FieldfetchRow (void *__res_handle)=0
 This will fetch a row of data from a result obtained after issueing a query to the RDBMS.
virtual const bool freeResultSet (void *__res_handle)=0
 This will provide a means for clearing the memory used by the resultset, this method must be call to release that memory and avoid a memory leak.
virtual const bool bulkBegin (void *conn_handle, const char *tablename, const char *cols, const char *delim)=0
 Call this method to start a bulk loading process.
virtual const bool bulkAddData (void *conn_handle, const char *data, const char *delim)=0
 Use this method to actually load data during a bolk load process started by the bulkBegin method.
virtual const bool bulkEnd (void *conn_handle)=0
 Flushes all data sent by bulkAddData and tells the server to actually insert it into the table.
virtual char * quoteString (const char *str)=0
virtual String escapeString (const String &s)=0
virtual String escapeString (const String &s, void *conn_handle)=0
 Quotes a string to be passed in an SQL query this is neccesary since some chars can confuse the SQL command parser in the RDBMS, after calling this method you must free all memory allocated from the it.
virtual const char * errorMessage (void *conn_handle)=0
 Returns a specific error message returned by the latest operation executed at the connection level.
virtual const char * resultErrorMessage (void *res_handle)=0
 Returns a specific error message returned by the latest operation executed at the query's ResultSet level.
virtual const bool isConnected (void *conn_handle)=0
 Verifies wheter the connection is still live or not.
virtual const bool hasConnPolling ()=0
 Says if the driver's connection can be polled for connection or not.
virtual const char * getClassName ()
 Returns the name of the current class.
virtual std::string toString ()

Static Public Member Functions

static void debugmsg (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__)
 Will print a debug message to the screen.
static void debugmsgln (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__)

Public Attributes

bool conn_requires_lock
bool query_requires_lock
bool bulk_requires_specific_lock
bool resultset_requires_lock

Protected Attributes

std::string __cls_name

Friends

std::ostream & operator<< (std::ostream &stream, const Object &s)

Constructor & Destructor Documentation

xvr2::SQL::Driver::Driver (  ) 


Member Function Documentation

virtual const SQL::DriverInfo& xvr2::SQL::Driver::getVersionInfo (  )  [pure virtual]

Use this function to retrieve version and/or vendor informaton for the driver.

virtual void* xvr2::SQL::Driver::connect ( const String server,
const String __dbname,
const String user,
const String pass,
int  port = 0 
) [pure virtual]

Attempts to make a connection the specified database server.

Driver supplied database connection function, it will try to make a remote (networked) connection to the database server.

Parameters:
server Should be the server's IP address or hostname
__dbname Database name to connect to.
user Username to connect to the database as
pass User's login password
port Connection port, if 0, then the driver will use the default connection port for the specified database.
Returns:
A connection handler.

virtual void* xvr2::SQL::Driver::connect ( const String dbsock,
const String _dbname,
const String _user,
const String _pass 
) [pure virtual]

Attempts to make a connection to a local database instance.

Driver supplied database connection function, it will try to connect to a locally running database instance, commonly this is performed by connection to a FIFO file.

Parameters:
dbsock FIFO file to open for connection.
_dbname Database name to connect to.
_user Username to connect to the database as
_pass User's login password
Returns:
A connection handler.

virtual void* xvr2::SQL::Driver::open ( const String dbfile  )  [pure virtual]

Opens a connection to a local (embedded) database engine.

Driver supplied database connection function, this method will attempt to open a datafile as if it was a networked connection, this is very useful for embedded database engines which implement the SQL query language.

Parameters:
dbfile A path to the datafile to the opened.
Returns:
A connection handler.

virtual ResultSet* xvr2::SQL::Driver::query ( void *  __handle,
const String command 
) [pure virtual]

Use this method to send a command to the backend server.

Parameters:
__handle Connection handler as returned from connect
command The command to be send to the backend database

virtual int xvr2::SQL::Driver::execCommand ( void *  __handle,
const String command 
) [pure virtual]

Use this method to send a command to the backend server.

__handle is the connection handler and command is the command to be send to the backend database. The command is question must NOT return any rows, this method is intended to be used only for execution, commands like DELETE, UPDATE, INSERT, etc.

virtual bool xvr2::SQL::Driver::disconnect ( void *  __handle  )  [pure virtual]

This method will disconnect you from the backend server if you are connected.

virtual void xvr2::SQL::Driver::setAutoCommit ( bool  val = true  )  [pure virtual]

The use of this method will turn on autocommits, the idea is that if you issue an update or delete command this will call the commit command inmediately so there is no reason for you to call it manually everytime you need it.

virtual void xvr2::SQL::Driver::commit ( void *  __handle  )  [pure virtual]

This will commit any transaction based command to the database, when you call commit every submitted delete or update they will execute each other in sequence.

virtual const int xvr2::SQL::Driver::numRows ( void *  __res_handle  )  [pure virtual]

This will return the number of rows for the current result handle.

virtual const int xvr2::SQL::Driver::numCols ( void *  __res_handle  )  [pure virtual]

This will return the number of columns for the current result handle.

virtual Field* xvr2::SQL::Driver::fetchRow ( void *  __res_handle  )  [pure virtual]

This will fetch a row of data from a result obtained after issueing a query to the RDBMS.

virtual const bool xvr2::SQL::Driver::freeResultSet ( void *  __res_handle  )  [pure virtual]

This will provide a means for clearing the memory used by the resultset, this method must be call to release that memory and avoid a memory leak.

virtual const bool xvr2::SQL::Driver::bulkBegin ( void *  conn_handle,
const char *  tablename,
const char *  cols,
const char *  delim 
) [pure virtual]

Call this method to start a bulk loading process.

Bulk load is a process provided by many RDBMSs where you can load big amounts of data without requiring to perform a lot of insert commands, this method is usually faster and recommended in scenarios where you load data which is contained in files, like .csv stuff

Parameters:
conn_handle The connection handle
tablename The table where you want to upload your data
cols A comma delimited list of column names specifiying
delim The string used to separate every field which columns are to be affected by the operation.

virtual const bool xvr2::SQL::Driver::bulkAddData ( void *  conn_handle,
const char *  data,
const char *  delim 
) [pure virtual]

Use this method to actually load data during a bolk load process started by the bulkBegin method.

Parameters:
conn_handle Connection handle
data The data to be loaded, every field must be delimited
delim The string used to separate every field as previuosly specified during the bulkBegin method call.

virtual const bool xvr2::SQL::Driver::bulkEnd ( void *  conn_handle  )  [pure virtual]

Flushes all data sent by bulkAddData and tells the server to actually insert it into the table.

Parameters:
conn_handle The connection handle

virtual char* xvr2::SQL::Driver::quoteString ( const char *  str  )  [pure virtual]

Deprecated:
Please use String escapeString(const String &s, void *conn_handle); Quotes a string to be passed in an SQL query this is neccesary since some chars can confuse the SQL command parser in the RDBMS, after calling this method you must free all memory allocated from the it.
Parameters:
str The string to be escaped
Returns:
The escaped string, you must free this pointer after used

virtual String xvr2::SQL::Driver::escapeString ( const String s  )  [pure virtual]

Deprecated:
Please use String escapeString(const String &s, void *conn_handle); Quotes a string to be passed in an SQL query this is neccesary since some chars can confuse the SQL command parser in the RDBMS, after calling this method you must free all memory allocated from the it.
Parameters:
s The string to be escaped
Returns:
The escaped string, you must free this pointer after used

virtual String xvr2::SQL::Driver::escapeString ( const String s,
void *  conn_handle 
) [pure virtual]

Quotes a string to be passed in an SQL query this is neccesary since some chars can confuse the SQL command parser in the RDBMS, after calling this method you must free all memory allocated from the it.

Parameters:
s The string to be escaped
conn_handle The RDBMS connection from where you're connecting
Returns:
The escaped string, you must free this pointer after used

virtual const char* xvr2::SQL::Driver::errorMessage ( void *  conn_handle  )  [pure virtual]

Returns a specific error message returned by the latest operation executed at the connection level.

Parameters:
conn_handle The connection handle
Returns:
The error string

virtual const char* xvr2::SQL::Driver::resultErrorMessage ( void *  res_handle  )  [pure virtual]

Returns a specific error message returned by the latest operation executed at the query's ResultSet level.

Parameters:
res_handle The ResultSet handle
Returns:
The error string

virtual const bool xvr2::SQL::Driver::isConnected ( void *  conn_handle  )  [pure virtual]

Verifies wheter the connection is still live or not.

virtual const bool xvr2::SQL::Driver::hasConnPolling (  )  [pure virtual]

Says if the driver's connection can be polled for connection or not.

virtual const char* xvr2::Object::getClassName (  )  [virtual, inherited]

Returns the name of the current class.

static void xvr2::Object::debugmsg ( Object obj,
const char *  msg,
int  linenumber = __LINE__,
const char *  srcfile = __FILE__ 
) [static, inherited]

Will print a debug message to the screen.

static void xvr2::Object::debugmsgln ( Object obj,
const char *  msg,
int  linenumber = __LINE__,
const char *  srcfile = __FILE__ 
) [static, inherited]

virtual std::string xvr2::Object::toString (  )  [virtual, inherited]


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  stream,
const Object s 
) [friend, inherited]


Member Data Documentation

Definition at line 35 of file Driver.h.

Definition at line 38 of file Driver.h.

Definition at line 39 of file Driver.h.

Definition at line 40 of file Driver.h.

std::string xvr2::Object::__cls_name [protected, inherited]

Definition at line 30 of file Object.h.


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

Generated on Fri Jun 20 22:56:05 2008 for X-VR2 SDK by  doxygen 1.5.5