|
<< Click to Display Table of Contents >> C Examples: DbiSetProp |
![]() ![]()
|
Execute a SQL statement and return a live cursor (if possible).
Note: If a live cursor cannot be created, the SQL statement will not be executed. This example uses the following input:
fDbiSetProp1("SELECT * FROM 'CUST.DBF'", hDb, &hTmpCur)
DBIResult fDbiSetProp1(pCHAR QryStr, hDBIDb hTmpDb, phDBICur phTmpCur)
{
DBIResult rslt;
hDBIStmt hStmt;
rslt = Chk(DbiQAlloc(hTmpDb, qrylangSQL, &hStmt));
if (rslt != DBIERR_NONE)
return rslt;
rslt = Chk(DbiQPrepare(hStmt, QryStr));
if (rslt != DBIERR_NONE)
{
Chk(DbiQFree(&hStmt));
return rslt;
}
rslt = Chk(DbiSetProp(hStmt, stmtLIVENESS, (UINT32)wantLIVE));
if (rslt != DBIERR_NONE)
{
Chk(DbiQFree(&hStmt));
return rslt;
}
rslt = Chk(DbiQExec(hStmt, phTmpCur));
Chk(DbiQFree(&hStmt));
return rslt;
}