⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sqlbase.h

📁 PDA通讯网关服务器源码程序
💻 H
字号:

/******************* 描述说明 ***********************
要使用此类,请将如下3个文件增加到工程中:
SQLBase.h
SQLBase.cpp


并在工程中作如下设置:
在"Project"->"Setting"中增加如下内容
1.在"C/C++"页中的Preprocessor definitions:
DBNTWIN32

2.在"Link"中的Object/library modules:
odbc32.lib odbccp32.lib ntwdblib.lib
*****************************************************/
/******************* 使用说明 ***********************
1.使用DBInit()登录数据库;
2.使用ExecSql()操作数据库;
3.使用DBClose()关闭连接数据库;
*****************************************************/

// SQLBase.h: interface for the CSqlServer class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_PROCSQLSERVER_H__9BA76FFC_18B6_4F7F_98ED_A9AB82DD73F5__INCLUDED_)
#define AFX_PROCSQLSERVER_H__9BA76FFC_18B6_4F7F_98ED_A9AB82DD73F5__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#if defined(DBNTWIN32)
	#include <windows.h>
#endif

//#include <afxdb.h>
#include <stdio.h>      // include standard header
#include <sqlfront.h>   // include dblib macro/manifest defines
#include <sqldb.h>      // include dblib datatype, prottypes, etc
#include <string.h>     // include for string functions
#include <malloc.h>     // include for malloc and free
#include "DbBaseST.h"

class CSqlDB
{
public:
	CSqlDB();
	virtual ~CSqlDB();
public:
	int OnIsAvailConnect(char *pchOutMsg);
	int OnGetLeaveRecord(st_Rec *pstRecord, bool &bLeaveRecord,char *chOutMsg);
	//连接登录数据库
	bool	OnDBInit(char *Server,char *UserID,char *Password,int  iInitTime, char *pchDbName,char *ErrMsg);
	//执行SQL语句
	int		OnExecSql(char *SqlCmd, st_Rec *pRec, bool &bLeaveRecord, char *OutMsg);
	//关闭连接数据库
	void	OnDBClose();

	//释放资源
	void	OnFreeRec( st_Rec  *pRec);	
	RETCODE OnPrintHeaders(DBPROCESS *dbproc);
private:
	int		OnDetermineRowSize(DBPROCESS *dbproc, int col);
	RETCODE OnOutputRow(DBPROCESS *dbproc, char *Output);
	
protected:
	LOGINREC*   login;      // login rec pointer
    DBPROCESS*  dbproc;     // SQL Server connection structure pointer	
    int         x;			// command line counter
    STATUS      retc;       // return code	
    const char* m_chSQLVersion; // pointer for version string
};

#endif // !defined(AFX_PROCSQLSERVER_H__9BA76FFC_18B6_4F7F_98ED_A9AB82DD73F5__INCLUDED_)

⌨️ 快捷键说明

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