ORACLE数据库API接口函数设计说明.docVIP

  • 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 *

文档评论(0)

1亿VIP精品文档

相关文档