cp_db_connection_select(3)
| cp_dbms(3) | cp_dbms | cp_dbms(3) |
NAME
cp_db_connection_select - perform a SELECT query on a database connection
SYNOPSIS
#include <cprops/db.h>
cp_result_set * cp_db_connection_select(cp_db_connection *connection, char *query);
DESCRIPTION
cp_db_connection_select performs the query query on the connection described by connection and returns a cp_result_set with the results. Result rows are retrieved with cp_result_set_next(3) and should be released by calling cp_result_set_release_row(3). The rows may contain results in text or in binary format, depending on the underlying implementation's behavior. Call cp_result_set_is_binary(3) to check what format the results are in. In text format, column values are represented by cp_string(3) objects. In binary format, results are represented as follows:
CP_FIELD_TYPE_BOOLEAN -- short CP_FIELD_TYPE_CHAR -- cp_string CP_FIELD_TYPE_SHORT -- short CP_FIELD_TYPE_INT -- int CP_FIELD_TYPE_LONG -- long CP_FIELD_TYPE_LONG_LONG -- long long CP_FIELD_TYPE_FLOAT -- float CP_FIELD_TYPE_DOUBLE -- double CP_FIELD_TYPE_VARCHAR -- cp_string CP_FIELD_TYPE_BLOB -- cp_string CP_FIELD_TYPE_DATE -- cp_timestampz CP_FIELD_TYPE_TIME -- cp_timestampz CP_FIELD_TYPE_TIMESTAMP -- cp_timestampz
Results should be released with cp_result_set_destroy(3).
for more on result set usage, see cp_result_set(3).
RETURN VALUE
cp_db_connection_select returns a result set representing the query results on success or NULL on failure.
SEE ALSO
| MARCH 2006 | libcprops |
