📄 oraopt.h
字号:
/*
****************************************************************************
** 版权所有: (C) Copyright 2006 - 2030, PM
** ALL RIGHTS RESERVED
** 文件名 : oraopt.h
** 作者 : chenqy
** 完成日期: 2006-03-30
** 描述 : 本文件中包含了oracle的数据库接口连接和游标
** 数据结构:
** 编写说明:
** 修改记录:
** 1. Date:
** Author: cqy
** Modification: Create this file
******************************************************************************
*/
#ifndef ORAOPT_H
#define ORAOPT_H
extern "C"
{
#include <string.h>
#include "oratypes.h"
#include "ocidfn.h"
#include "ocidem.h"
#include <netinet/in.h>
}
#include "mymutex.h"
/* oparse flags */
#define DEFER_PARSE 1
#define NATIVE 1
#define VERSION_7 2
/* Class forward declarations */
//class connection;
//class cursor;
/*
* This class represents a connection to ORACLE database.
*
* NOTE: This connection class is just given as an example and all possible
* operations on a connection have not been defined.
*/
class CConnection
{
friend class CCursor;
public:
CConnection();
~CConnection();
sword Connect(const char *UserName, const char *PassWord,const char * DBName);
sword DisConnect(void);
void Display_Error() ;
public:
unsigned char g_szDBErrorSTR[512];
int g_nErrorCode ;
int static ConnectNum;
enum Conn_State
{
NOT_CONNECTED,
CONNECTED
};
Conn_State State;
private:
unsigned int static ulNum ;
Lda_Def lda;
ub1 hda[HDA_SIZE];
};
/*
* This class represents an ORACLE cursor.
*
* NOTE: This cursor class is just given as an example and all possible
* operations on a cursor have not been defined.
*/
class CCursor
{
public:
CCursor();
~CCursor();
sword OpenCursor(CConnection *Conn_Param);
sword Close();
sword ParseCursor(const text *stmt);
/* bind an input variable */
sword Bind_By_Position(
sword SqlvNum,
ub1 *Progvar,
sword ProgVarLen,
sword DataType,
sword Scale,
sb2 *Indicator
);
/* define an output variable */
sword Define_By_Position(sword Position,
ub1 *Buf,
sword Bufl,
sword DataType,
sword Scale,
sb2 *Indicator,
ub2 *rLen,
ub2 *rCode
);
sword ExecuteSQL();
sword FetchData();
sword SetAutoCommit();
sword AutoCommit();
sword Get_Error_Code() const;
void Display_Error() ;
unsigned char g_szDBErrorSTR[512];
int g_nErrorCode ;
private:
static int CursorNum;
Cda_Def cda;
CConnection *conn;
enum Cursor_State
{
NOT_OPENED,
OPENED
};
Cursor_State State;
};
/*
* Error number macros
*/
#define DB_OK 0
#define DB_ERROR -1
#define CONERR_ALRCON -1 /* already connected */
#define CONERR_NOTCON -2 /* not connected */
#define CURERR_ALROPN -3 /* cursor is already open */
#define CURERR_NOTOPN 0 /* cursor is not opened */
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -