g_dbmysql.h

来自「mysql数据库的数据存储类的实现」· C头文件 代码 · 共 42 行

H
42
字号
/*
g_dbmysql.h: interface for the CG_DBMySql class.
*/

#ifndef __CG_DB_MYSQL_H__
#define __CG_DB_MYSQL_H__

#include "g_platform.h"
#include <mysql.h>

class CG_DBMySql  
{
public:
	unsigned long GetInsertId();
	long  GetAffectedRows();
	bool  Query(const char *sql,int len=0);
	bool  Connect(const char *host,int port,const char *name,const char *pwd,const char *db);
	bool  GetField(int idx,char *field,int *type,char **value);
	bool  GetFieldContent(int nIdx , int *pnType , char **ppValue);
    bool  GetRow();
	void  SetLog(bool log);
	void  ShowError();
	void  Close();
	int   GetFieldInfo(int nIdx, char *pszName);
    int   GetRowCount();
	int   GetFieldCount();
	char *GetField(char *fname,int *len = NULL);
    
	CG_DBMySql();
	virtual ~CG_DBMySql();
	
private:
	bool		 m_log;
	MYSQL		*m_handle;
	MYSQL_RES	*m_res;
	MYSQL_ROW	 m_row;
	MYSQL_FIELD *m_fields;
	int          m_fieldCnt;
};

#endif 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?