Return codes, See also, Querying with a prepared statement – Sun Microsystems Sun StorageTek 5800 User Manual
Page 110

Return Codes
HCERR_OK
HCERR_OOM
HCERR_BAD_REQUEST
HCERR_NULL_SESSION
HCERR_INVALID_SESSION
HCERR_ILLEGAL_ARGUMENT
See Also
Querying With a Prepared Statement
The following code is an example of querying with a prepared statement. Error handling is
omitted. Two metadata fields are used with the definitions from the schema:
<field name=
"test_date" type="date">
<field name=
"test_status" type="string">
hcerr_t res;
time_t t;
struct tm *date;
hc_pstmt_t *pstmt;
hc_query_result_set_t *rset;
hc_string_t selects[] = {
"test_status" };
// get today
’s date
time(&t);
date = gmtime(&t);
// list all OIDs with today
’s date
res = hc_pstmt_create(session,
"test_date = ?", &pstmt);
res = hc_pstmt_set_date(pstmt, 1, date);
res = hc_pstmt_query_ez(pstmt, NULL, 0, 2000, &rset);
while (1) {
hc_oid oid;
int finished;
res = hc_qrs_next_ez(rset, &oid, NULL, &finished);
if (finished)
break;
printf(
"today’s oid: %s\n", oid);
}
res = hc_qrs_free(rset);
Querying With a Prepared Statement
Sun StorageTek 5800 System Client API Reference Manual • June 2008
110