db.h

来自「网络泡泡被.net管理」· C头文件 代码 · 共 49 行

H
49
字号
// DB.h: interface for the DB_mySQL class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_DB_H__833ACD9A_E893_4407_B98B_B01DEB7CC04D__INCLUDED_)
#define AFX_DB_H__833ACD9A_E893_4407_B98B_B01DEB7CC04D__INCLUDED_

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

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define DEFAULT_SQL_CMD_SIZE	1024

class NET_LIB_API DB_mySQL  
{
public:
	uint32 GetInsertId();
	long  GetAffectedRows();
	bool  Query(const char *sql,int len=0);
	bool  Query(const char *format,...);
	bool  Connect(const char *host,int port,const char *name,const char *pwd,const char *db);
	void  Close();
	int   GetFieldCount();
	bool  GetField(int idx,char *field,int *type,char **value);
	bool  GetFieldContent(int nIdx , int *pnType , char **ppValue);
	int   GetFieldInfo(int nIdx, char *pszName);
	char *GetField(char *fname,int *len = NULL);
    int   GetRowCount();
    bool  GetRow();

	void  ShowError();

	DB_mySQL();
	virtual ~DB_mySQL();

protected:
	MYSQL		*m_handle;
	MYSQL_RES	*m_res;
	MYSQL_ROW	 m_row;
	MYSQL_FIELD *m_fields;
	int          m_fieldCnt;
	
	char		m_strCMD[DEFAULT_SQL_CMD_SIZE];
};

#endif // !defined(AFX_DB_H__833ACD9A_E893_4407_B98B_B01DEB7CC04D__INCLUDED_)

⌨️ 快捷键说明

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