|
vuser_init:
#include "lrd.h"
static LRD_INIT_INFO InitInfo = {LRD_INIT_INFO_EYECAT};
static LRD_VAR_DESC OBJECT_NAME_D1;
static LRD_DEFAULT_DB_VERSION DBTypeVersion[] =
{
{LRD_DBTYPE_NONE, LRD_DBVERSION_NONE}
};
static void FAR * OraEnv1;
static void FAR * OraSvc1;
static void FAR * OraStm1;
vuser_init()
{
lrd_init(&InitInfo, DBTypeVersion);
lrd_initialize_db(LRD_DBTYPE_ORACLE, 1, 0);
lrd_env_init(LRD_DBTYPE_ORACLE, &OraEnv1, 0, 0);
lrd_logon(OraEnv1, &OraSvc1, "jack", "123456", "TDSERVER", 0); //这是个ORACLE连接,连我自己的机器,服务是TDSERVER,用户是JACK,密码是123456
lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm1, 0);
return VUSER_OK;
}
action:
static void FAR * OraDef1;
unsigned long uliRowsProcessed;
Action()
{
lrd_ora8_stmt(OraStm1, "select * from user_objects\n", 1, 0, 0);//查user_objects表
lrd_ora8_exec(OraSvc1, OraStm1, 0, 0, &uliRowsProcessed, 0, 0, 0, 0, 0);
lrd_ora8_bind_col(OraStm1, &OraDef1,1, &OBJECT_NAME_D1, 0, 0);
//后面就开始使用OBJECT_NAME_D1这个变量。
return VUSER_OK;
} |
|