自已封装c api mysql--connection.hpp(初步)
来源:互联网 发布:固高运动控制卡编程 编辑:程序博客网 时间:2024/05/16 17:59
#ifndef CONNECTION_HPP
#define CONNECTION_HPP
#include <mysql/mysql.h>
#include <string>
#include <map>
#include <vector>
#include "sqlerror.hpp"
#include "table.hpp"
namespace sqlpp
{
class Connection
{
public:
Connection();
Connection(const std::string& database, const std::string& server, const std::string& user, const std::string& password);
Connection(const char* database, const char* server, const char* user, const char* password);
virtual ~Connection();
void connect()throw(sqlerror);
void connect(const std::string& database, const std::string& server, const std::string& user, const std::string& password)throw(sqlerror);
void connect(const char* database, const char* server, const char* user, const char* password)throw(sqlerror);
bool is_open(void)throw();
void close(void)throw();
std::string get_client_info(void) throw(sqlerror);
unsigned long get_client_version(void) throw(sqlerror);
std::string get_host_info(void) throw(sqlerror);
unsigned int get_protocol_version(void) throw(sqlerror);
std::string get_server_info(void) throw(sqlerror);
unsigned long get_server_version(void) throw(sqlerror);
void download(Table& target) throw(sqlerror);
void online_start(std::map<int,std::string>& row, const std::string& cmd) throw(sqlerror);
void online_next(std::map<int,std::string>& row)throw(sqlerror);
bool online_is_eof(void)throw();
unsigned long exceute(const std::string& cmd)throw(sqlerror);
const std::string& get_user(void)const throw();
const std::string& get_database(void)const throw();
const std::string& get_server(void)const throw();
const std::string& get_password(void)const throw();
void set_user(const std::string& user)throw();
void set_database(const std::string& database)throw();
void set_server(const std::string& server)throw();
void set_password(const std::string& password)throw();
protected:
private:
//forbid copy construct
Connection(const Connection& rh);
//forbid assign
const Connection& operator=(const Connection& rh);
void check_exception(void) throw(sqlerror);
std::string _user;
std::string _database;
std::string _password;
std::string _server;
//for online assess
unsigned int _num_fields;
MYSQL_RES* _ptr_result;
bool _is_open;
MYSQL _mysql;
};
};
#endif
#define CONNECTION_HPP
#include <mysql/mysql.h>
#include <string>
#include <map>
#include <vector>
#include "sqlerror.hpp"
#include "table.hpp"
namespace sqlpp
{
class Connection
{
public:
Connection();
Connection(const std::string& database, const std::string& server, const std::string& user, const std::string& password);
Connection(const char* database, const char* server, const char* user, const char* password);
virtual ~Connection();
void connect()throw(sqlerror);
void connect(const std::string& database, const std::string& server, const std::string& user, const std::string& password)throw(sqlerror);
void connect(const char* database, const char* server, const char* user, const char* password)throw(sqlerror);
bool is_open(void)throw();
void close(void)throw();
std::string get_client_info(void) throw(sqlerror);
unsigned long get_client_version(void) throw(sqlerror);
std::string get_host_info(void) throw(sqlerror);
unsigned int get_protocol_version(void) throw(sqlerror);
std::string get_server_info(void) throw(sqlerror);
unsigned long get_server_version(void) throw(sqlerror);
void download(Table& target) throw(sqlerror);
void online_start(std::map<int,std::string>& row, const std::string& cmd) throw(sqlerror);
void online_next(std::map<int,std::string>& row)throw(sqlerror);
bool online_is_eof(void)throw();
unsigned long exceute(const std::string& cmd)throw(sqlerror);
const std::string& get_user(void)const throw();
const std::string& get_database(void)const throw();
const std::string& get_server(void)const throw();
const std::string& get_password(void)const throw();
void set_user(const std::string& user)throw();
void set_database(const std::string& database)throw();
void set_server(const std::string& server)throw();
void set_password(const std::string& password)throw();
protected:
private:
//forbid copy construct
Connection(const Connection& rh);
//forbid assign
const Connection& operator=(const Connection& rh);
void check_exception(void) throw(sqlerror);
std::string _user;
std::string _database;
std::string _password;
std::string _server;
//for online assess
unsigned int _num_fields;
MYSQL_RES* _ptr_result;
bool _is_open;
MYSQL _mysql;
};
};
#endif
- 自已封装c api mysql--connection.hpp(初步)
- Linux mysql c API封装
- C++封装MySQL C API
- 封装MySQL C API 基本操作
- C++封装MySQL预处理C API
- connection类--初步修改
- connection类--初步修改cpp
- MYSQL C API 封装和MYSQL连接池
- zlib.hpp封装
- 简单易用的mysql c api 封装类
- C++封装 mysql C api遇到的问题
- java的mysql api封装
- MySQLWrapper(推荐一款MySQL C API封装类库)v.0.4
- Mysql数据库学习(四):常用Mysql C API 介绍和使用、封装一个访问Mysql数据库的类MysqlDB
- Mysql C api
- MYSQL C API
- MySQL C API
- MySQL C API
- 为Exchange设置internet邮件网关
- 用一句SQL取出第 m 条到第 n 条记录的方法-更新
- Mysql 工具
- JScript 正则表达式语法表
- Fujitsu在欧洲推出Amilo 3540
- 自已封装c api mysql--connection.hpp(初步)
- 暴风影音2008Beta1 最新远程溢出 0day 分析
- 信息的社会层面
- 支持IE7的XmlHttpRequest创建方法
- Mysql 数据类型转换
- 续--connection.cpp
- 我上传的图片去哪里了?
- 续--table.hpp
- Delphi 正则表达式语法