change to VodafoneUSB Modem interface
Fork of MySQLClient by
Diff: LPC1768/services/mysql/MySQLClient.h
- Revision:
- 6:cb3bd3012d79
- Parent:
- 5:91c24a06d12c
--- a/LPC1768/services/mysql/MySQLClient.h Thu Aug 05 15:16:36 2010 +0000 +++ b/LPC1768/services/mysql/MySQLClient.h Fri Nov 22 07:38:25 2013 +0000 @@ -28,10 +28,7 @@ #ifndef MYSQL_CLIENT_H #define MYSQL_CLIENT_H -#include "core/net.h" -#include "core/netservice.h" -#include "api/TCPSocket.h" -#include "api/DNSRequest.h" +#include "Socket/TCPSocketConnection.h" #include "mbed.h" #include <string> @@ -61,7 +58,7 @@ /** This MySQL client implements a limited subset of the MySQL internal client/server protocol (including authentication), for server versions 4.1 and newer. */ -class MySQLClient : protected NetService +class MySQLClient { public: ///Instantiates the MySQL client @@ -79,27 +76,9 @@ @param db : database to use @param pMethod : callback to call on each request completion */ - MySQLResult open(Host& host, const string& user, const string& password, const string& db, void (*pMethod)(MySQLResult)); //Non blocking + MySQLResult open(const string& host, int port, const string& user, const string& password, const string& db, void (*pMethod)(MySQLResult)); //Non blocking - ///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 - @param host : server - @param user : username - @param db : database to use - @param pItem : callback's class instance - @param pMethod : callback's method to call on each request completion - */ - template<class T> - MySQLResult open(Host& host, const string& user, const string& password, const string& db, T* pItem, void (T::*pMethod)(MySQLResult)) //Non blocking - { - setOnResult(pItem, pMethod); - setup(host, user, password, db); - return MYSQL_PROCESSING; - } - - + ///Executes an SQL command /** Executes an SQL request on the SQL server @@ -136,7 +115,7 @@ void init(); void close(); - void setup(Host& host, const string& user, const string& password, const string& db); //Setup connection, make DNS Req if necessary + void setup(const string& host, int port, const string& user, const string& password, const string& db); //Setup connection, make DNS Req if necessary void connect(); //Start Connection void handleHandshake(); @@ -150,9 +129,10 @@ void readData(); //Copy to buf void writeData(); //Copy from buf - +#if 0 void onTCPSocketEvent(TCPSocketEvent e); void onDNSReply(DNSReply r); +#endif void onResult(MySQLResult r); //Called when exchange completed or on failure void onTimeout(); //Connection has timed out @@ -161,13 +141,17 @@ void (CDummy::*m_pCbMeth)(MySQLResult); void (*m_pCb)(MySQLResult); - + +#if 0 TCPSocket* m_pTCPSocket; - +#endif + TCPSocketConnection* m_pTCPSocket; Timer m_watchdog; int m_timeout; - + +#if 0 DNSRequest* m_pDnsReq; +#endif bool m_closed; @@ -181,8 +165,8 @@ }; //Parameters - Host m_host; - + string m_host; + int m_port; string m_user; string m_password; string m_db;