MMSDBFreeTDS Class Reference

Implementation of database access using FreeTDS (http://www.freetds.org). More...

#include <mmsdbfreetds.h>

Inheritance diagram for MMSDBFreeTDS:

List of all members.


Public Member Functions

 MMSDBFreeTDS (DataSource *datasource)
 Constructor which only saves a reference to the given DataSource object.
virtual ~MMSDBFreeTDS ()
 Destructor which disconnects from the database.
void connect ()
 Opens connection to the database.
void disconnect ()
 Close connection to database if a connection was established before.
void startTransaction ()
 Method not implemented since the FreeTDS implementation does not support transactions.
void commitTransaction ()
 Method not implemented since the FreeTDS implementation does not support transactions.
void rollbackTransaction ()
 Method not implemented since the FreeTDS implementation does not support transactions.
int query (string statement, MMSRecordSet *rs)
 This function executes the given database query and puts the results in MMSRecordSet.
int query (string statement)
 This function executes given database query.
int executeSP (string spName, MMSDB_SP_ARGLIST argList, MMSRecordSet *rs)
 This function executes given stored procedure and puts the results in MMSRecordSet.
int executeSP (string spName, MMSDB_SP_ARGLIST argList)
 This function executes a stored procedure.
int getLastInsertedID ()
 This method is not supported by the FreeTDS implementation.

Private Member Functions

int query (string statement, SQLHSTMT &hstmt, bool finishStatement=true)
 Internal function to execute a given database query.

Private Attributes

SQLHDBC * dbhandle
 Database handle retrieved in connect().
SQLHENV henv
 Database environment handle retrieved in connect().
DataSourcedatasource
 Database configuration.

Detailed Description

Implementation of database access using FreeTDS (http://www.freetds.org).

This allows usage of Microsoft SQL Server and Sybase database backends. MMSDBFreeTDS implementes the IMMSDB interface, which should be used in your application to provide simple database backend exchange by only changing the configuration in your XML-configuration file.

See also:
MMSDBMySQL

MMSDBSQLite

Definition at line 73 of file mmsdbfreetds.h.


Constructor & Destructor Documentation

MMSDBFreeTDS::MMSDBFreeTDS ( DataSource datasource  ) 

Constructor which only saves a reference to the given DataSource object.

Parameters:
datasource Database configuration to use.
Exceptions:
MMSError datasource was NULL
See also:
~MMSDBFreeTDS()

Definition at line 48 of file mmsdbfreetds.cpp.

MMSDBFreeTDS::~MMSDBFreeTDS (  )  [virtual]

Destructor which disconnects from the database.

See also:
MMSDBFreeTDS()

disconnect()

Definition at line 58 of file mmsdbfreetds.cpp.


Member Function Documentation

void MMSDBFreeTDS::connect (  )  [virtual]

Opens connection to the database.

The database settings have to be given to the constructor before.

Exceptions:
MMSError Connection to SQL database could not be established (for detailed information use MMSError::getMessage())
See also:
MMSDBFreeTDS()

disconnect()

Implements IMMSDB.

Definition at line 89 of file mmsdbfreetds.cpp.

void MMSDBFreeTDS::disconnect (  )  [virtual]

Close connection to database if a connection was established before.

See also:
connect()

Implements IMMSDB.

Definition at line 135 of file mmsdbfreetds.cpp.

void MMSDBFreeTDS::startTransaction (  )  [inline, virtual]

Method not implemented since the FreeTDS implementation does not support transactions.

Implements IMMSDB.

Definition at line 118 of file mmsdbfreetds.h.

void MMSDBFreeTDS::commitTransaction (  )  [inline, virtual]

Method not implemented since the FreeTDS implementation does not support transactions.

Implements IMMSDB.

Definition at line 124 of file mmsdbfreetds.h.

void MMSDBFreeTDS::rollbackTransaction (  )  [inline, virtual]

Method not implemented since the FreeTDS implementation does not support transactions.

Implements IMMSDB.

Definition at line 130 of file mmsdbfreetds.h.

int MMSDBFreeTDS::query ( string  statement,
MMSRecordSet rs 
) [virtual]

This function executes the given database query and puts the results in MMSRecordSet.

This method is used for select statements.

Parameters:
statement buffer with database query
rs recordset containing result of query
Returns:
Returns the number of affected rows.
Exceptions:
MMSError SQL query could not be executed (for detailed information use MMSError::getMessage())
See also:
MMSRecordSet

Implements IMMSDB.

Definition at line 151 of file mmsdbfreetds.cpp.

int MMSDBFreeTDS::query ( string  statement  )  [virtual]

This function executes given database query.

This method is used for insert, update and delete statements.

Parameters:
statement buffer with database query
Exceptions:
MMSError SQL query could not be executed (for detailed information use MMSError::getMessage())
Returns:
Returns the number of affected rows

Implements IMMSDB.

Definition at line 207 of file mmsdbfreetds.cpp.

int MMSDBFreeTDS::executeSP ( string  spName,
MMSDB_SP_ARGLIST  argList,
MMSRecordSet rs 
)

This function executes given stored procedure and puts the results in MMSRecordSet.

This method is used for insert, update and delete statements

Parameters:
spName name of stored procedure
argList arguments for stored procedure
rs recordset containing result
Returns:
Returns the number of affected rows

Definition at line 239 of file mmsdbfreetds.cpp.

int MMSDBFreeTDS::executeSP ( string  spName,
MMSDB_SP_ARGLIST  argList 
)

This function executes a stored procedure.

This method is used for insert, update and delete statements

Parameters:
spName name of stored procedure
argList arguments for stored procedure
Returns:
Returns the number of affected rows

Definition at line 258 of file mmsdbfreetds.cpp.

int MMSDBFreeTDS::getLastInsertedID (  )  [inline, virtual]

This method is not supported by the FreeTDS implementation.

Returns:
Returns always 0.

Implements IMMSDB.

Definition at line 194 of file mmsdbfreetds.h.

int MMSDBFreeTDS::query ( string  statement,
SQLHSTMT &  hstmt,
bool  finishStatement = true 
) [private]

Internal function to execute a given database query.

This method is used by the public query() methods.

Parameters:
statement buffer with database query
hstmt reference to SQL statement handle
finishStatement if false query cursor stays open i.e. to call SqlFetch() afterwards
Exceptions:
MMSError SQL query could not be executed (for detailed information use MMSError::getMessage())
Returns:
Returns the number of affected rows

Definition at line 213 of file mmsdbfreetds.cpp.


Member Data Documentation

SQLHDBC* MMSDBFreeTDS::dbhandle [private]

Database handle retrieved in connect().

Definition at line 197 of file mmsdbfreetds.h.

SQLHENV MMSDBFreeTDS::henv [private]

Database environment handle retrieved in connect().

Definition at line 198 of file mmsdbfreetds.h.

Database configuration.

Reimplemented from IMMSDB.

Definition at line 199 of file mmsdbfreetds.h.


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