#include <mmsdbmysql.h>

Public Member Functions | |
| MMSDBMySQL (DataSource *datasource=NULL, bool autoreconnect=false) | |
| Constructor. | |
| virtual | ~MMSDBMySQL () |
| Destructor. | |
| void | connect () |
| Connects to the mysql database. | |
| void | disconnect () |
| Disconnects from a mysql database. | |
| void | startTransaction () |
| Starts a transaction. | |
| void | commitTransaction () |
| Commits a transaction. | |
| void | rollbackTransaction () |
| Does a rollback on the current transaction. | |
| int | query (string statement, MMSRecordSet *rs) |
| This function executes given database query and puts the results in MMSRecordSet. | |
| int | query (string statement) |
| This function executes given database query. | |
| int | getLastInsertedID () |
| Returns the ID of the last inserted record. | |
Private Attributes | |
| MYSQL | dbhandle |
| bool | autoreconnect |
Definition at line 58 of file mmsdbmysql.h.
| MMSDBMySQL::MMSDBMySQL | ( | DataSource * | _datasource = NULL, |
|
| bool | autoreconnect = false | |||
| ) |
Constructor.
It just sets the datasource and the reconnect parameters for later use in the connect() method.
| _datasource | [in] datasource object containing definitions for database connection | |
| autoreconnect | [in] if set to true, connection to the database server will be reestablished, if lost (needs mysql >= 5.0.13) |
| MMSError | No datasource given (Look at the exception message). |
Definition at line 65 of file mmsdbmysql.cpp.
| MMSDBMySQL::~MMSDBMySQL | ( | ) | [virtual] |
Destructor.
Handles disconnection from the mysql database.
Definition at line 79 of file mmsdbmysql.cpp.
| void MMSDBMySQL::connect | ( | ) | [virtual] |
Connects to the mysql database.
| MMSError | Error while trying to connect (Look at the exception message). |
Implements IMMSDB.
Definition at line 150 of file mmsdbmysql.cpp.
| void MMSDBMySQL::disconnect | ( | ) | [virtual] |
Disconnects from a mysql database.
Implements IMMSDB.
Definition at line 183 of file mmsdbmysql.cpp.
| void MMSDBMySQL::startTransaction | ( | ) | [virtual] |
Starts a transaction.
If you are using transaction based queries, call this method to start a transaction. To commit it, call commitTransaction().
| MMSError | Error while trying to start transaction (Look at the exception message). |
Implements IMMSDB.
Definition at line 95 of file mmsdbmysql.cpp.
| void MMSDBMySQL::commitTransaction | ( | ) | [virtual] |
Commits a transaction.
If you are using transaction based queries, call this method to commit a transaction. To start it, call startTransaction().
| MMSError | Error while trying to commit transaction (Look at the exception message). |
Implements IMMSDB.
Definition at line 112 of file mmsdbmysql.cpp.
| void MMSDBMySQL::rollbackTransaction | ( | ) | [virtual] |
Does a rollback on the current transaction.
If you are using transaction based queries, call this method to rollback a transaction.
| MMSError | Error while trying to rollback the transaction (Look at the exception message). |
Implements IMMSDB.
Definition at line 133 of file mmsdbmysql.cpp.
| int MMSDBMySQL::query | ( | string | statement, | |
| MMSRecordSet * | rs | |||
| ) | [virtual] |
This function executes given database query and puts the results in MMSRecordSet.
This method is used for select statements
| statement | [in] buffer with database query | |
| rs | [out] MMSRecordSet that holds the results |
| MMSError | Query couldn't be executed (Look at the exception message). |
Implements IMMSDB.
Definition at line 208 of file mmsdbmysql.cpp.
| int MMSDBMySQL::query | ( | string | statement | ) | [virtual] |
This function executes given database query.
This method is used for insert, update and delete statements
| statement | buffer with database query |
| MMSError | Query couldn't be executed (Look at the exception message). |
Implements IMMSDB.
Definition at line 261 of file mmsdbmysql.cpp.
| int MMSDBMySQL::getLastInsertedID | ( | ) | [virtual] |
Returns the ID of the last inserted record.
| MMSError | Couldn't fetch last ID (Look at the exception message). |
Implements IMMSDB.
Definition at line 293 of file mmsdbmysql.cpp.
MYSQL MMSDBMySQL::dbhandle [private] |
Definition at line 60 of file mmsdbmysql.h.
bool MMSDBMySQL::autoreconnect [private] |
Definition at line 61 of file mmsdbmysql.h.