Synchronous C API Functions

See Also

“hc_pstmt_create” on page 100

hc_pstmt_set_date

Adds a date binding to a “hc_pstmt_t” on page 49.

Synopsis

#include <time.h>

hcerr_t hc_pstmt_set_date(hc_pstmt_t *pstmt, int which,

struct tm *value);

Description

This function binds a date in the form of the POSIX struct to one of the variables in a prepared statement. The variable must be of the appropriate type in the database. Errors in binding and type are returned when the “hc_pstmt_t” on page 49 is used to query the server.

The struct tm fields are as defined in the POSIX standard and interpreted by mktime(3C). All fields are ignored except:

int tm_mday; /* day of the month - [1, 31] */ int tm_mon; /* months since January - [0, 11] */ int tm_year; /* years since 1900 */

Parameters

pstmt

Prepared statement to add the binding to. which

IN: Variable (”?’) in the prepared statement, numbered from 1. value

IN: struct tm (time.h) value to bind.

Return Codes

HCERR_OK

HCERR_OOM

Chapter 3 • Sun StorageTek 5800 System C Client API

105

Page 105
Image 105
Sun Microsystems 5800 manual Hcpstmtsetdate