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

📄 odbcfunc.h

📁 电信的97接口程序,用于把话单入库。这里是采用FTP方式采集话单
💻 H
字号:
/*+============================================================================
File:        odbcFunc.h
Summary:     The class for connect database with ODBC
History:
2002/01/08	V2.0 
	Start it. (zoohoo@163.com)
============================================================================+*/
#ifndef   _ODBC_FUNC_H
#define   _ODBC_FUNC_H

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

#include <windows.h>
#include <sql.h>
#include <sqlucode.h>
#include "global.h"

#define DEBUGODBC
#define VALUE_LEN	255
#define	MAXQUERY	10

class VariousType
{
public:
	char column[VALUE_LEN];
	int type;	// 1:short int
				// 2:long int
				// 3:char
				// 4:float
				// 5:double
				// 6:date
				// 7:time
				// 8:timestamp
				// 9:binary

	static int ConvertType(int type);
};

class COdbcFunc
{
private:
	SQLHENV		henv;
	SQLHDBC		hdbc;
	SQLHSTMT	hstmt;
	SQLRETURN	retcode;

	SQLHSTMT	hstmtext[MAXQUERY];

	char *		dsn;
	char *		username;
	char *		password;

	int			m_logTimeout;	// login timeout(second);
	int			m_disconnect;	// alloc disconnect
	int			m_henv;			//alloc environment
	int			m_hdbc;
	int			m_hstmt;
	int			m_connect;

	int			m_hstmtext[MAXQUERY];

	int			GetExecInfo(SQLHSTMT hstmtIn, char *state, char *message, int, int);
public:
	COdbcFunc();
	~COdbcFunc();

	int			Connect(char* dsn, char* username, char* password);
	void		Disconnect();

	int			ExecSQL(char * sql);
	int			ExecSQL(char * sql, int i);
	int			Next();
	void		GetFieldValue(int col, char * value, int size);
	void		GetFieldValue(int col, int * value);
	int			GetFieldValue(int col, struct tm* datetime);
	
	// cancels the processing on a statement
	void		AbortQuery();

	int			AddResult(int i);
	int			FreeResult(int i);
	int			CancelResult(int i);
	int			Next(int i);
	int			AbortQuery(int i);
	int			GetFieldValue(int col, char * value, int size, int handle);
	int			GetFieldValue(int col, int * value, int handle);
	int			GetFieldValue(int col, struct tm* datetime, int handle);

	void		InsertSQL(char *table, VariousType * variousType, int size, char *sWhere = "");
//	int			GetAffectRowCount();
//	int			GetColCount();
	int			SetAutoCommit(bool);
};

#endif /*_ODBC_FUNC_H*/

⌨️ 快捷键说明

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