4,018
社区成员




int OCI_TOOLS::ORA_BindArrayWithupdatead(char *buff, float qvalue[], char q_id[][45],char qq_flag[][2],int maxiter)
{
text *sqltext;
int i;
sword ret1,ret2,ret3,ret4;
text msgbuf[512];
/* bind handles will be implicitly allocated in the bind calls */
/* need to initialize them to null prior to first usage in bind calls */
OCIBind *bnd1p = (OCIBind *) 0; /* the first bind handle */
OCIBind *bnd2p = (OCIBind *) 0; /* the second bind handle */
OCIBind *bnd3p = (OCIBind *) 0; /* the third bind handle */
text *sqlstmt = (text *)buff;
if (OCIStmtPrepare(stmthp, errhp, sqlstmt, (ub4)strlen((char *)sqlstmt),
(ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT))
{
(void) printf("FAILED: OCIStmtPrepare() update\n");
//report_error(errhp);
return OCI_ERROR;
}
ret1=OCIBindByPos(stmthp, &bnd1p,errhp, (ub4) 1,
(dvoid *) qvalue, (sb4) 4, SQLT_FLT,
(dvoid *) 0, (ub2 *)0, (ub2 *)0,
(ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT);
ret3=OCIBindByPos(stmthp, &bnd3p,errhp, (ub4) 3,
(dvoid *) q_id, (sb4) 45, SQLT_CHR,
(dvoid *) 0, (ub2 *)0, (ub2 *)0,
(ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT);
ret2=OCIBindByPos(stmthp, &bnd2p,errhp, (ub4) 2,
(dvoid *) qq_flag, (sb4) 2, SQLT_CHR,
(dvoid *) 0, (ub2 *)0, (ub2 *)0,
(ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT);
if (ret1||ret2||ret3)
{
(void) printf("FAILED: OCIBindArrayOfStruct()\n");
//report_error(errhp);
return OCI_ERROR;
}
ret1=OCIBindArrayOfStruct(bnd1p,errhp, 4, 0, 0, 0);
ret3=OCIBindArrayOfStruct(bnd3p,errhp, 45, 0, 0, 0);
ret2=OCIBindArrayOfStruct(bnd2p,errhp, 2, 0, 0, 0);
if (ret1||ret2||ret3)
{
(void) printf("FAILED: OCIBindArrayOfStruct()\n");
//report_error(errhp);
return OCI_ERROR;
}
if (OCIStmtExecute(svchp, stmthp,errhp, (ub4) maxiter, (ub4) 0,
(CONST OCISnapshot*) 0, (OCISnapshot*) 0,
(ub4) OCI_COMMIT_ON_SUCCESS))
{
(void) printf("FAILED: OCIStmtExecute() update ccbase\n");
//report_error(errhp);
sb4 errcode = 0;
(void) OCIErrorGet((dvoid *) errhp, (ub4) 1, (text *) NULL, &errcode,
msgbuf, (ub4) sizeof(msgbuf), (ub4) OCI_HTYPE_ERROR);
(void) printf("ERROR CODE = %d\n", errcode);
(void) printf("%.*s\n", 512, msgbuf);
return OCI_ERROR;
}
status=OCITransCommit(svchp,errhp,0);
if(status!=OCI_SUCCESS)
{
error_proc(errhp,status);
return OCI_FAIL;
}
return OCI_SUCCESS;
}