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

📄 db2connection.h

📁 适合于Unix/Linux下的一个持久数据库连接池
💻 H
字号:
// Copyright (c) 2000-2001  David Muse// See the file COPYING for more information#ifndef DB2CCONNECTION_H#define DB2CCONNECTION_H#define FETCH_AT_ONCE		10#define MAX_SELECT_LIST_SIZE	256#define MAX_ITEM_BUFFER_SIZE	4096#define NUM_CONNECT_STRING_VARS 5#include <sqlrconnection.h>#include <sqlcli1.h>struct db2column {	char		name[MAX_ITEM_BUFFER_SIZE];	uint16_t	namelength;	// SQLColAttribute requires that these are signed, 32 bit integers	int32_t		type;	int32_t		length;	int32_t		precision;	int32_t		scale;	int32_t		nullable;	uint16_t	primarykey;	uint16_t	unique;	uint16_t	partofkey;	uint16_t	unsignednumber;	uint16_t	zerofill;	uint16_t	binary;	uint16_t	autoincrement;};class db2connection;class db2cursor : public sqlrcursor_svr {	friend class db2connection;	public:			db2cursor(sqlrconnection_svr *conn);			~db2cursor();	private:		bool		prepareQuery(const char *query,						uint32_t length);		bool		inputBindString(const char *variable, 						uint16_t variablesize,						const char *value, 						uint16_t valuesize,						int16_t *isnull);		bool		inputBindInteger(const char *variable, 						uint16_t variablesize,						int64_t *value);		bool		inputBindDouble(const char *variable, 						uint16_t variablesize,						double *value, 						uint32_t precision,						uint32_t scale);		bool		outputBindString(const char *variable, 						uint16_t variablesize,						char *value, 						uint16_t valuesize,						int16_t *isnull);		bool		outputBindInteger(const char *variable,						uint16_t variablesize,						int64_t *value,						int16_t *isnull);		bool		outputBindDouble(const char *variable,						uint16_t variablesize,						double *value,						uint32_t *precision,						uint32_t *scale,						int16_t *isnull);		bool		executeQuery(const char *query,						uint32_t length,						bool execute);		const char	*errorMessage(bool *liveconnection);		bool		knowsRowCount();		uint64_t	rowCount();		bool		knowsAffectedRows();		uint64_t	affectedRows();		uint32_t	colCount();		const char * const * columnNames();		uint16_t	columnTypeFormat();		void		returnColumnInfo();		bool		noRowsToReturn();		bool		skipRow();		bool		fetchRow();		void		returnRow();		SQLRETURN	erg;		SQLHSTMT	stmt;		SQLSMALLINT	ncols;		SQLINTEGER 	affectedrows;		char		field[MAX_SELECT_LIST_SIZE]					[FETCH_AT_ONCE]					[MAX_ITEM_BUFFER_SIZE];		SQLINTEGER	indicator[MAX_SELECT_LIST_SIZE]						[FETCH_AT_ONCE];#if (DB2VERSION>7)		SQLUSMALLINT	rowstat[FETCH_AT_ONCE];#endif		db2column	col[MAX_SELECT_LIST_SIZE];		char		*columnnames[MAX_SELECT_LIST_SIZE];		uint64_t	rowgroupindex;		uint64_t	totalinrowgroup;		uint64_t	totalrows;		uint64_t	rownumber;		stringbuffer	*errormsg;		db2connection	*db2conn;};class db2connection : public sqlrconnection_svr {	friend class db2cursor;	private:		uint16_t	getNumberOfConnectStringVars();		void	handleConnectString();		bool	logIn(bool printerrors);		sqlrcursor_svr	*initCursor();		void	deleteCursor(sqlrcursor_svr *curs);		void	logOut();		int16_t	nullBindValue();		bool	bindValueIsNull(int16_t isnull);		bool	autoCommitOn();		bool	autoCommitOff();		bool	commit();		bool	rollback();		const char	*pingQuery();		const char	*identify();		const char	*dbVersion();		const char	*bindFormat();		SQLHENV		env;		SQLRETURN	erg;		SQLHDBC		dbc;		const char	*server;		char		dbversion[512];};#endif

⌨️ 快捷键说明

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