MySQL Database. More...

#include <rdbmysql.h>

Inheritance diagram for RDbMySQL:
[legend]
Collaboration diagram for RDbMySQL:
[legend]

Public Member Functions

 RDbMySQL (const RString &db, const RString &host, const RString &user, const RString &pwd, const RCString &coding="latin1")
 
virtual size_t GetLastInsertId (void)
 
virtual void * InitQuery (const RString &sql, size_raw &nbcols)
 
virtual void ReleaseQuery (void *data)
 
virtual bool EndQuery (const void *data)
 
virtual void StartQuery (void *data)
 
virtual void NextQuery (void *data)
 
virtual RString GetField (const void *data, size_t index)
 
virtual ~RDbMySQL (void)
 
- Public Member Functions inherited from RDb
 RDb (Db type)
 
Db GetType (void) const
 
virtual void CreateTransactionTable (const RString &name, size_t nb,...)
 
void RunSQLFile (const RURI &file, bool coutit=false)
 
virtual ~RDb (void)
 

Static Public Member Functions

static void Create (const RString &db, const RString &host, const RString &user, const RString &pwd)
 

Protected Attributes

void * Db
 
RTextEncodingCoding
 
- Protected Attributes inherited from RDb
Db Type
 

Additional Inherited Members

- Public Types inherited from RDb
enum  Db { MySQL, SQLite, PostgreSQL }
 

Detailed Description

MySQL Database.

The RDbMySQL class provides a representation of connection to a MySQL database.

See also
RQuery

Constructor & Destructor Documentation

RDbMySQL ( const RString db,
const RString host,
const RString user,
const RString pwd,
const RCString coding = "latin1" 
)

Construct a connection to the MySQL database.

Parameters
dbName of the database.
hostHost.
userUser.
pwdPassword.
codingName of the coding used.
virtual ~RDbMySQL ( void  )
virtual

Destruct the connection to the database.

Member Function Documentation

static void Create ( const RString db,
const RString host,
const RString user,
const RString pwd 
)
static

Create an empty MySQL database.

Parameters
dbName of the database.
hostHost.
userUser.
pwdPassword.
virtual size_t GetLastInsertId ( void  )
virtual

Get the last auto-increment identifier inserted.

Implements RDb.

virtual void* InitQuery ( const RString sql,
size_raw nbcols 
)
virtual

Initialize a query.

Parameters
sqlSQL query.
nbcolsNumber of columns of the query (assigned by the method).
Returns
Pointer to a structure allocated by the database.

Implements RDb.

virtual void ReleaseQuery ( void *  data)
virtual

Release a query.

Parameters
dataData to release (must be cast).

Implements RDb.

virtual bool EndQuery ( const void *  data)
virtual
Parameters
dataDatabase-dependent data.
Returns
true if all the rows of a query are treated.

Implements RDb.

virtual void StartQuery ( void *  data)
virtual

Start a query.

Parameters
dataDatabase-dependent data.

Implements RDb.

virtual void NextQuery ( void *  data)
virtual

Read the next row of the query.

Parameters
dataDatabase-dependent data.

Implements RDb.

virtual RString GetField ( const void *  data,
size_t  index 
)
virtual

Return a specific field of the current row.

Parameters
dataDatabase-dependent data.
indexIndex of the field in the query.

Implements RDb.

Field Documentation

void* Db
protected

Database.

RTextEncoding* Coding
protected

Coding used to read/write to MySQL.