- 8
- 0
- 约3.59千字
- 约 7页
- 2017-06-12 发布于北京
- 举报
ORACLE数据库API接口函数设计说明
API接口函数使用示例:
参见程序OCIDEMO.DSW
//工程中不用在连接ociw32.lib只用xjoci.lib就行了。
假定:
工程文件为newocidemo,所在目录为c:\newocidemo,newocidemo.exe位于c:\newocidemo\debug下面
使用步骤:
1、将MyConnection.h;oratypes.h;ocidem.h;ocidfn.h;xioci.lib复制到c:\newocidemo下面
2、将xioci.dll复制到c:\newocidemo\debug下面
3、设置project 下的 settings 下面的link 中的 object/library modules: 为xjoci.lib
4、在file中添加MyConnection.h,从而在class中会出现connection,cursor两个新类
API接口函数类设计:
CONNECTION类
class connection
{
friend class cursor;
public:
BOOL IsConnected();
connection();
~connection();
BOOL connect(char *username, char *password,char *sername);
BOOL disconnect();
void display_error() const;
private:
Lda_Def lda;
ub1 hda[HDA_SIZE];
enum conn_state
{
not_connected,
connected
};
conn_state state;
};
BOOL connect(char *username, char *password,char *sername);
函数用途:connect函数建立OCI程序与ORACLE数据库的连接
参数说明:char *username,--用户名
char *password,--口令
char *sername—主机字符串(数据库别名)。
返回值:连接成功返回TRUE,不成功返回FALSE
BOOL disconnect();
函数用途:disconnect函数断开与数据库的连接
参数说明:
返回值:断开成功返回TRUE,不成功返回FALSE
BOOL IsConnected ();
函数用途:IsConnected函数判断是否与数据库建立了连接。
参数说明:
返回值:有连接存在返回值为TRUE,没有连接返回值为FALSE
void display_error() const;
函数用途:display_error当各个函数返回值为FALSE时,调用此函数可以显示错误信息。
返回值:
CURSOR类
class cursor
{
public:
BOOL IsOpened();
BOOL ExecuteSQL(char * stmt);
cursor();
~cursor();
BOOL open(connection *conn_param);
BOOL close();
BOOL parse(const char *stmt);
/* 绑定输入 */
BOOL bind_by_position(int sqlvnum, void *progvar,int progvarlen, int datatype,short *indicator);
/* 定义输出 */
BOOL define_by_position(int position, void *buf,int bufl, int datatype);
//取得列描述信息
BOOL describe(int position, long *dbsize, int *dbtype,
void *cbuf, int *cbufl, long *dsize, int *prec,
int *scale, int *nullok);
BOOL execute();
BOOL fetch();
void display_error();
private:
int get_error_code();
Cda_Def cda;
connection *
您可能关注的文档
最近下载
- 内镜粘膜下剥离术ESD.doc VIP
- 省级优秀幼儿园教案小班绘本活动《这是谁的蛋》.docx VIP
- 2024海康威视门禁一体机用户手册.docx
- 2025秉法立世 智启未来律师事务所开业庆典活动方案.pptx
- 《老年活动策划与组织》教学设计——项目五 老年社区活动策划与组织.docx VIP
- Gene X ppt(Gene10 基因十)--Chapter10课件.ppt VIP
- 《老年活动策划与组织》教学设计——项目四 老年小组活动策划与组织.docx VIP
- 2025届福建省莆田市高三下学期第二次质量检测地理试题(解析版).pdf VIP
- 《老年活动策划与组织》教学设计——项目三 老年个别活动策划与组织..docx VIP
- 圆通速递网点智能调度.pptx
原创力文档

文档评论(0)