Linux 装配Libsqlora库函数

Linux 安装Libsqlora库函数
使用Linux下的OCI函数库必须先安装Libsqlora库函数。该库函数当前版本为libsqlora8-2.3.3可从http://www.poitschke.de/libsqlora8/index_noframe.html上下载libsqlora8-2.3.3.tar.gz源程序包。按以下步骤安装:

    #tar -xzvf libsqlora8-2.3.3.tar.gz  
    #cd libsqlora8-2.3.3  
    #LD_LIBRARY_PATH=$ORACLE_HOME/lib  
    #export LD_LIBRARY_PATH  
    #./configure  
    #make  
    #make install  

安装路径为 /usr/local/lib

Libsqlora8提供的关于Oracle操作的主要函数有:

int sqlo_init(int threaded_mode):初始化程序库接口,读出环境变量,设置相应的全局变量。当前,threaded_mode设为0。

int sqlo_connect(int * dbh, char * connect_str):连接数据库,dbh为数据库连接描述符,connect_str为用户名/口令字符串。

int sqlo_finish(int dbh):断开数据库连接。

int sqlo_open(int dbh, char * stmt, int argc, char *argv[]):打开由stmt确定的查询语句所返回的游标。Argc,argv为查询的参数,后面我们将用更清晰的方法传递参数。

int sqlo_close(int sth):关闭由上一个函数打开的游标。

int sqlo_fetch(int sth):从打开的游标中获取一条记录,并将之存入一个已分配内存空间中。

const char **sqlo_values(int sth, int *numbalues, int dostrip):从内存中返回上一次sqlo_fetch取得的值,是以字符串形式返回的。

int sqlo_prepare(int dbh, char const *stmt):返回一个打开的游标sth。

int sqlo_bind_by_name(int sth, const char * param_name, int param_type, const void * param_addr, unsigned int param_size, short * ind_arr, int is_array):将查询语句的传入参数,按照名字的形式与函数中的变量绑定。如果你使用数组,那么参数param_addr和ind_arr必须指向该数组。

int sqlo_bind_by_pos(int sth, int param_pos, int param_type, const void * param_addr, unsigned int param_size, short * ind_arr, int is_array):将查询语句的传出值,按照位置顺序与函数中的变量绑定。

int sqlo_execute(int sth, int iterations):执行查询语句。”Iterations”可设为”1″。

int sqlo_commit (int dbh):提交操作,

int sqlo_rollback(int dbh):回滚操作。

Linux 装配Libsqlora库函数

相关文章:

你感兴趣的文章:

标签云: