Dependents:   TimeZoneDemo EthernetJackTestCode MMEx_Challenge ntp_mem ... more

Embed: (wiki syntax)

« Back to documentation index

MySQLClient Class Reference

MySQLClient Class Reference

A MySQL Client. More...

#include <MySQLClient.h>

Inherits NetService.

Public Member Functions

 MySQLClient ()
 Instantiates the MySQL client.
MySQLResult open (Host &host, const string &user, const string &password, const string &db, void(*pMethod)(MySQLResult))
 Opens a connection to a server.
template<class T >
MySQLResult open (Host &host, const string &user, const string &password, const string &db, T *pItem, void(T::*pMethod)(MySQLResult))
 Opens a connection to a server.
MySQLResult sql (string &sqlCommand)
 Executes an SQL command.
MySQLResult exit ()
 Closes the connection to the server.
void setTimeout (int ms)
 Setups timeout.
virtual void poll ()
 This method can be inherited so that it is called on each Net::poll() call.

Protected Member Functions

void close ()
 This flags the service as to be destructed if owned by the pool.

Detailed Description

A MySQL Client.

This MySQL client implements a limited subset of the MySQL internal client/server protocol (including authentication), for server versions 4.1 and newer.

Definition at line 64 of file MySQLClient.h.


Constructor & Destructor Documentation

MySQLClient (  )

Instantiates the MySQL client.

Definition at line 59 of file MySQLClient.cpp.


Member Function Documentation

void close (  ) [protected]

This flags the service as to be destructed if owned by the pool.

Reimplemented from NetService.

Definition at line 159 of file MySQLClient.cpp.

MySQLResult exit (  )

Closes the connection to the server.

Definition at line 101 of file MySQLClient.cpp.

MySQLResult open ( Host host,
const string &  user,
const string &  password,
const string &  db,
T *  pItem,
void(T::*)(MySQLResult pMethod 
)

Opens a connection to a server.

Opens a connection to the server host using the provided username, password passowrd and selecting database On completion of this call (and any further one), the callback set in parameter is fired with the result of that command in parameter

Parameters:
host: server
user: username
db: database to use
pItem: callback's class instance
pMethod: callback's method to call on each request completion

Definition at line 95 of file MySQLClient.h.

MySQLResult open ( Host host,
const string &  user,
const string &  password,
const string &  db,
void(*)(MySQLResult pMethod 
)

Opens a connection to a server.

Opens a connection to the server host using the provided username, password passowrd and selecting database On completion of this call (and any further one), the callback set in parameter is fired with the result of that command in parameter

Parameters:
host: server
user: username
db: database to use
pMethod: callback to call on each request completion

Definition at line 76 of file MySQLClient.cpp.

void poll (  ) [virtual]

This method can be inherited so that it is called on each Net::poll() call.

Reimplemented from NetService.

Definition at line 130 of file MySQLClient.cpp.

void setTimeout ( int  ms )

Setups timeout.

Parameters:
ms: time of connection inactivity in ms after which the request should timeout

Definition at line 125 of file MySQLClient.cpp.

MySQLResult sql ( string &  sqlCommand )

Executes an SQL command.

Executes an SQL request on the SQL server This is a non-blocking function On completion, the callback set in the open function is fired with the result of the command in parameter

Parameters:
sqlCommandSQL request to execute

Definition at line 93 of file MySQLClient.cpp.