cp_db_connection_execute_statement(3)

cp_dbms(3) cp_dbms cp_dbms(3)

NAME

cp_db_connection_execute_statement, cp_db_connection_execute_statement_args - execute a prepared statement

SYNOPSIS

#include <cprops/db.h>

int cp_db_connection_execute_statement(cp_db_connection *connection, cp_db_statement *statement, cp_vector *prm, cp_result_set **results);

int cp_db_connection_execute_statement_args(cp_db_connection *connection, cp_db_statement *statement, cp_result_set **results, ...);

DESCRIPTION

cp_db_connection_execute_statement executes the prepared statement statement on the connection connection. Parameter lengths creates a prepared statement with prm_count parameters of the types given by prm_types for the query query on the connection connection. Parameters are specified as '?' in the query string; implementations may support other formats in addition. The parameters in the prm vector should correspond to the parameter types specified on statement creation. Parameter types map as follows:

	CP_FIELD_TYPE_BOOLEAN     --   short
	CP_FIELD_TYPE_CHAR        --   char *
	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     --   char *
	CP_FIELD_TYPE_BLOB        --   cp_string
	CP_FIELD_TYPE_DATE        --   cp_timestampz
	CP_FIELD_TYPE_TIME        --   cp_timestampz
	CP_FIELD_TYPE_TIMESTAMP   --   cp_timestampz

Notice the asymmetry with cp_db_connection_select in that CP_FIELD_TYPE_CHAR and CP_FIELD_TYPE_VARCHAR type fields are passed as char * rather than cp_string.

If the statements returns results and the results parameter is not NULL, it is set to point to the created result set.

cp_db_connection_execute_statement_args allows specifying parameters as elipsis parameters rather than in a cp_vector structure.

RETURN VALUE

zero on success or non-zero on failure.

SEE ALSO

cp_db_connection_select(3), cp_string(3), cp_vector(3)

MARCH 2006 libcprops