SqlClient.h
Go to the documentation of this file.
00001 
00011 #ifndef SPATIAL_TEMPORAL_LEARNING_WORLDLIB_REMOTE_SQL_CLIENT_H_
00012 #define SPATIAL_TEMPORAL_LEARNING_WORLDLIB_REMOTE_SQL_CLIENT_H_
00013 
00014 // worldlib
00015 #include "Client.h"
00016 
00017 // MySQL
00018 #include <mysql/mysql.h>
00019 
00020 namespace rail
00021 {
00022 namespace spatial_temporal_learning
00023 {
00024 namespace worldlib
00025 {
00026 namespace remote
00027 {
00028 
00035 class SqlClient : public Client
00036 {
00037 public:
00039   static const unsigned int DEFAULT_PORT = 3306;
00040 
00048   SqlClient(const SqlClient &client);
00049 
00061   SqlClient(const std::string &host, const uint16_t port, const std::string &user, const std::string &password,
00062       const std::string &database);
00063 
00069   virtual ~SqlClient();
00070 
00078   const std::string &getUser() const;
00079 
00087   const std::string &getPassword() const;
00088 
00096   const std::string &getDatabase() const;
00097 
00105   bool connected() const;
00106 
00114   virtual bool connect();
00115 
00121   virtual void disconnect();
00122 
00123 protected:
00133   MYSQL_RES *query(const std::string &query) const;
00134 
00140   void printSqlError() const;
00141 
00142 private:
00144   const std::string user_, password_, database_;
00146   bool connected_;
00148   MYSQL *connection_;
00149 };
00150 
00151 }
00152 }
00153 }
00154 }
00155 
00156 #endif


worldlib
Author(s): Russell Toris
autogenerated on Fri Feb 12 2016 00:24:19