Retrieve the declared column types for a prepared statement
#include <qdb/qdb.h>
int qdb_stmt_decltypes( qdb_hdl_t *db,
int stmtid,
char **buf,
ssize_t bufsize,
ssize_t *required_size );
qdb
This function retrieves the declared column types for a prepared statement. The behavior of this function depends on how the arguments are set:
When this function returns, the beginning of buf is an array of pointers to strings, which are also stored in the buffer.
Return values greater than zero indicate either the number of columns in the statement or the number of valid declared column types, depending on the arguments. See Description for more information.
The function returns -1 when an error occurred (errno is set).
The following code sample demonstrates how you can call qdb_stmt_decltypes() once to determine the required buffer size and again to retrieve the declared column types:
char **pp; ssize_t required_size, bufsize = 0; int cols, i; if ((cols = qdb_stmt_decltypes(db, stmtid, NULL, 0, &required_size)) > 0) { pp = malloc(required_size); if (pp) { bufsize = required_size; cols = qdb_stmt_decltypes(db, stmtid, pp, pp, bufsize, &required_size); for (i=0; i<cols; i++) printf("column %d: %s\n", i, pp[i]); free(pp); } }
QNX Neutrino
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | Yes |