ub4 mode //=OCI_DEFAULT
);
eg:
char sSQL[1024];
sprintf(sSQL, “select table_name from user_tables”);
swResult = OCIStmtPrepare(stmtp errhp, (CONST OraText*)sSQL, strlen(sSQL), OCI_NTV_SYNTAX, OCI_DEFAULT);
if(swResult != OCI_SUCCESS && swResult != OCI_SUCCESS_WITH_INFO)
return FALSE;
8. 绑定输入参数
OCIBindArrayOfStruct() Set skip parameters for static array bind ,数组绑定,一般用于批量操作
OCIBindByName() Bind by name 按名绑定
OCIBindByPos() Bind by position 按位置绑定,建议一般按此方式绑定
OCIBindDynamic() Sets additional attributes after bind with OCI_DATA_AT_EXEC mode
OCIBindObject() Set additional attributes for bind of named data type
注:
OCIBindArrayOfStruct必须先用OCIBindByPos初始化,然后在OCIBindArrayOfStruct中定义每个参数所跳过的字节数。
如:
存储方式:
第一条记录第二条记录 N
SkipPara(实际就是结构体长度,即本次所有列的长度和)
sword OCIBindByName (
OCIStmt *stmtp, //语句句柄
OCIBind **bindpp,//结合句柄,=NULL
OCIError *errhp,
CONST text *placeholder,//占位符名称
sb4 placeh_len, //占位符长度
dvoid *valuep, //绑定的变量名
sb4 value_sz, //绑定的变量名长度
ub2 dty, //绑定的类型
dvoid *indp, //指示符变量指针(sb2类型),单条绑定时为NULL,
ub2 *alenp, //说明执行前后被结合的数组变量中各元素数据实际的长度,单条绑定时为NULL
共16页 第1页 第2页 第3页 第4页 第5页 第6页 第7页 第8页 第9页 第10页 第11页 第12页 第13页 第14页 第15页 第16页






