50 lines
992 B
C
50 lines
992 B
C
|
#pragma once
|
|||
|
#include <functional>
|
|||
|
#include <string>
|
|||
|
|
|||
|
class MySQLResult
|
|||
|
{
|
|||
|
public:
|
|||
|
MySQLResult();
|
|||
|
~MySQLResult();
|
|||
|
|
|||
|
/// <20><>ȡ<EFBFBD><C8A1><EFBFBD>ݱ<EFBFBD><DDB1>ı<EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
unsigned int getNumFields();
|
|||
|
uint64_t getNumRows();
|
|||
|
|
|||
|
/// <20><>ȡ<EFBFBD><C8A1><EFBFBD>ݱ<EFBFBD><DDB1>ı<EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>
|
|||
|
char* getFieldName(int Index);
|
|||
|
|
|||
|
/// <20><><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>func
|
|||
|
void stepRow(const std::function<void(char** RowPtr,unsigned long* FieldLength)>& func);
|
|||
|
|
|||
|
private:
|
|||
|
struct impl;
|
|||
|
impl* pimpl;
|
|||
|
|
|||
|
friend class MySQLConn;
|
|||
|
};
|
|||
|
|
|||
|
class MySQLConn
|
|||
|
{
|
|||
|
public:
|
|||
|
MySQLConn();
|
|||
|
~MySQLConn();
|
|||
|
|
|||
|
/// <20><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
int connect(const char* host,const char* user,const char* passwd,const char* db,unsigned int port);
|
|||
|
|
|||
|
/// ִ<><D6B4>SQL<51><4C><EFBFBD><EFBFBD>
|
|||
|
int exec(const std::string& SQLCommand,const std::function<void(MySQLResult&)>& res);
|
|||
|
|
|||
|
/// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
const char* getError();
|
|||
|
|
|||
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
unsigned int getFieldCount();
|
|||
|
uint64_t getAffectedRows();
|
|||
|
private:
|
|||
|
struct impl;
|
|||
|
impl* pimpl;
|
|||
|
};
|