Files | |
| file | db.h |
| file | db_mysql.h |
| file | db_postgres.h |
Data Structures | |
| struct | _cp_timestampz |
| struct | _cp_db_connection_parameters |
| struct | _cp_db_connection |
| struct | _cp_db_statement |
| struct | _cp_result_set |
| struct | _cp_db_actions |
| struct | _cp_dbms_driver_descriptor |
| struct | _cp_data_source |
| struct | _cp_db_connection_pool |
| struct | _cp_mysql_connection_parameters |
| struct | _cp_pgsql_connection_parameters |
Typedefs | |
|
typedef CPROPS_DLL struct _cp_timestampz | cp_timestampz |
| typedef CPROPS_DLL struct _cp_db_connection_parameters | cp_db_connection_parameters |
| typedef CPROPS_DLL struct _cp_db_connection | cp_db_connection |
|
typedef CPROPS_DLL struct _cp_db_statement | cp_db_statement |
| typedef CPROPS_DLL struct _cp_result_set | cp_result_set |
| typedef cp_db_connection *(* | cp_db_open_fn )(struct _cp_data_source *) |
| typedef cp_result_set *(* | cp_db_select_fn )(cp_db_connection *conn, char *query) |
| typedef int(* | cp_db_fetch_metadata_fn )(cp_result_set *rs) |
| typedef int(* | cp_db_fetch_next_fn )(cp_result_set *rs) |
| typedef int(* | cp_db_release_result_set_fn )(cp_result_set *rs) |
| typedef int(* | cp_db_update_fn )(cp_db_connection *conn, char *query) |
| typedef int(* | cp_db_close_fn )(cp_db_connection *conn) |
| typedef char *(* | cp_db_escape_string_fn )(cp_db_connection *conn, char *src, int len) |
| typedef char *(* | cp_db_escape_binary_fn )(cp_db_connection *conn, char *src, int src_len, int *res_len) |
| typedef cp_string *(* | cp_db_unescape_binary_fn )(cp_db_connection *conn, char *src) |
| typedef cp_db_statement *(* | cp_db_prepare_statement_fn )(cp_db_connection *conn, int prm_count, cp_field_type *prm_types, char *query) |
| typedef int(* | cp_db_execute_statement_fn )(cp_db_connection *conn, cp_db_statement *stmt, cp_result_set **results, int *lengths, void **prm) |
| typedef void(* | cp_db_release_statement_fn )(cp_db_statement *stmt) |
| typedef void(* | cp_db_set_autocommit_fn )(cp_db_connection *conn, int state) |
| typedef int(* | cp_db_commit_fn )(cp_db_connection *conn) |
| typedef int(* | cp_db_rollback_fn )(cp_db_connection *conn) |
| typedef CPROPS_DLL struct _cp_db_actions | cp_db_actions |
| typedef _cp_data_source *(* | cp_db_get_data_source_fn )(char *host, int port, char *user, char *passwd, char *dbname) |
| typedef _cp_data_source *(* | cp_db_get_data_source_prm_fn )(char *host, int port, char *user, char *passwd, char *dbname, cp_hashtable *prm) |
|
typedef CPROPS_DLL struct _cp_dbms_driver_descriptor | cp_dbms_driver_descriptor |
| typedef CPROPS_DLL struct _cp_data_source | cp_data_source |
| typedef CPROPS_DLL struct _cp_db_connection_pool | cp_db_connection_pool |
|
typedef CPROPS_DLL struct _cp_mysql_connection_parameters | cp_mysql_connection_parameters |
|
typedef CPROPS_DLL struct _cp_pgsql_connection_parameters | cp_pgsql_connection_parameters |
Enumerations | |
| enum | { CP_FIELD_TYPE_BOOLEAN, CP_FIELD_TYPE_CHAR, CP_FIELD_TYPE_SHORT, CP_FIELD_TYPE_INT, CP_FIELD_TYPE_LONG, CP_FIELD_TYPE_LONG_LONG, CP_FIELD_TYPE_FLOAT, CP_FIELD_TYPE_DOUBLE, CP_FIELD_TYPE_VARCHAR, CP_FIELD_TYPE_BLOB, CP_FIELD_TYPE_DATE, CP_FIELD_TYPE_TIME, CP_FIELD_TYPE_TIMESTAMP } |
Functions | |
| CPROPS_DLL int | cp_db_init () |
| CPROPS_DLL int | cp_db_register_dbms (char *dbms_name, void(*shutdown_call)()) |
| CPROPS_DLL int | cp_db_shutdown () |
| CPROPS_DLL cp_timestampz * | cp_timestampz_create (struct timeval *tm, int minuteswest) |
| CPROPS_DLL cp_timestampz * | cp_timestampz_create_prm (int sec_since_epoch, int microsec, int minwest) |
| CPROPS_DLL void | cp_timestampz_destroy (cp_timestampz *tm) |
| CPROPS_DLL struct tm * | cp_timestampz_localtime (cp_timestampz *tm, struct tm *res) |
| CPROPS_DLL void | cp_db_connection_parameters_destroy (cp_db_connection_parameters *prm) |
| CPROPS_DLL cp_db_statement * | cp_db_statement_instantiate (cp_db_connection *connection, int prm_count, cp_field_type *types, void *source) |
| CPROPS_DLL void | cp_db_statement_set_binary (cp_db_statement *stmt, int binary) |
| CPROPS_DLL void | cp_db_statement_destroy (cp_db_statement *statement) |
| CPROPS_DLL cp_vector * | cp_result_set_get_headers (cp_result_set *result_set) |
| CPROPS_DLL cp_vector * | cp_result_set_get_field_types (cp_result_set *result_set) |
| CPROPS_DLL int | cp_result_set_field_count (cp_result_set *result_set) |
| CPROPS_DLL int | cp_result_set_row_count (cp_result_set *result_set) |
| CPROPS_DLL char * | cp_result_set_get_header (cp_result_set *result_set, int column) |
| CPROPS_DLL cp_field_type | cp_result_set_get_field_type (cp_result_set *rs, int column) |
| CPROPS_DLL void | cp_result_set_autodispose (cp_result_set *rs, int mode) |
| CPROPS_DLL cp_vector * | cp_result_set_next (cp_result_set *result_set) |
| CPROPS_DLL void | cp_result_set_destroy (cp_result_set *result_set) |
| CPROPS_DLL void | cp_result_set_release_row (cp_result_set *result_set, cp_vector *row) |
| CPROPS_DLL int | cp_result_set_is_binary (cp_result_set *result_set) |
| CPROPS_DLL cp_result_set * | cp_db_connection_select (cp_db_connection *connection, char *query) |
| CPROPS_DLL int | cp_db_connection_update (cp_db_connection *connection, char *query) |
| CPROPS_DLL int | cp_db_connection_close (cp_db_connection *connection) |
| CPROPS_DLL void | cp_db_connection_destroy (cp_db_connection *connection) |
| CPROPS_DLL void | cp_db_connection_set_fetch_metadata (cp_db_connection *connection, int mode) |
| CPROPS_DLL void | cp_db_connection_set_read_result_set_at_once (cp_db_connection *connection, int mode) |
| CPROPS_DLL void | cp_db_connection_set_fetch_size (cp_db_connection *connection, int fetch_size) |
| CPROPS_DLL char * | cp_db_connection_escape_string (cp_db_connection *connection, char *src, int len) |
| CPROPS_DLL char * | cp_db_connection_escape_binary (cp_db_connection *connection, char *src, int src_len, int *res_len) |
| CPROPS_DLL cp_string * | cp_db_connection_unescape_binary (cp_db_connection *connection, char *src) |
| CPROPS_DLL cp_db_statement * | cp_db_connection_prepare_statement (cp_db_connection *connection, int prm_count, cp_field_type *prm_types, char *query) |
| CPROPS_DLL int | cp_db_connection_execute_statement (cp_db_connection *connection, cp_db_statement *statement, cp_vector *prm, cp_result_set **results) |
| CPROPS_DLL int | cp_db_connection_execute_statement_args (cp_db_connection *connection, cp_db_statement *statement, cp_result_set **results,...) |
| CPROPS_DLL void | cp_db_connection_close_statement (cp_db_connection *connection, cp_db_statement *statement) |
| CPROPS_DLL void | cp_db_connection_set_autocommit (cp_db_connection *conn, int state) |
| CPROPS_DLL int | cp_db_connection_commit (cp_db_connection *conn) |
| CPROPS_DLL int | cp_db_connection_rollback (cp_db_connection *conn) |
| CPROPS_DLL cp_db_actions * | cp_db_actions_create (int dbms, char *dbms_lit, cp_db_open_fn open, cp_db_select_fn select, cp_db_fetch_metadata_fn fetch_metadata, cp_db_fetch_next_fn fetch_next, cp_db_release_result_set_fn release_result_set, cp_db_update_fn update, cp_db_close_fn close, cp_db_escape_string_fn escape_string, cp_db_escape_binary_fn escape_binary, cp_db_unescape_binary_fn unescape_binary, cp_db_prepare_statement_fn prepare_statement, cp_db_execute_statement_fn execute_statement, cp_db_release_statement_fn release_statement, cp_db_set_autocommit_fn set_autocommit, cp_db_commit_fn commit, cp_db_rollback_fn rollback) |
| CPROPS_DLL void | cp_db_actions_destroy (cp_db_actions *actions) |
| CPROPS_DLL cp_data_source * | cp_dbms_get_data_source (char *driver, char *host, int port, char *user, char *passwd, char *dbname) |
| CPROPS_DLL cp_data_source * | cp_dbms_get_data_source_prm (char *driver, char *host, int port, char *user, char *passwd, char *dbname, cp_hashtable *prm) |
| CPROPS_DLL void | cp_data_source_destroy (cp_data_source *data_source) |
| CPROPS_DLL cp_db_connection * | cp_data_source_get_connection (cp_data_source *data_source) |
| CPROPS_DLL cp_db_connection_pool * | cp_db_connection_pool_create (cp_data_source *data_source, int min_size, int max_size, int initial_size) |
| CPROPS_DLL int | cp_db_connection_pool_shutdown (cp_db_connection_pool *pool) |
| CPROPS_DLL void | cp_db_connection_pool_destroy (cp_db_connection_pool *pool) |
| CPROPS_DLL void | cp_db_connection_pool_set_blocking (cp_db_connection_pool *pool, int block) |
| CPROPS_DLL cp_db_connection * | cp_db_connection_pool_get_connection (cp_db_connection_pool *pool) |
| CPROPS_DLL void | cp_db_connection_pool_release_connection (cp_db_connection_pool *pool, cp_db_connection *connection) |
| __BEGIN_DECLS CPROPS_DLL cp_data_source * | cp_mysql_data_source (char *host, char *login, char *password, char *db_name, unsigned int port, char *unix_socket, unsigned long client_flag) |
| CPROPS_DLL cp_data_source * | cp_dbms_mysql_get_data_source (char *host, int port, char *login, char *password, char *dbname) |
| CPROPS_DLL cp_data_source * | cp_dbms_mysql_get_data_source_prm (char *host, int port, char *login, char *password, char *dbname, cp_hashtable *prm) |
| __BEGIN_DECLS CPROPS_DLL cp_data_source * | cp_postgres_data_source (char *host, int port, char *login, char *password, char *db_name, char *options, char *sslmode, char *krbsrvname, char *service) |
| CPROPS_DLL cp_data_source * | cp_dbms_postgres_get_data_source (char *host, int port, char *login, char *password, char *dbname) |
| CPROPS_DLL cp_data_source * | cp_dbms_postgres_get_data_source_prm (char *host, int port, char *login, char *password, char *dbname, cp_hashtable *prm) |
Variables | |
|
__BEGIN_DECLS typedef CPROPS_DLL enum { ... } | cp_field_type |
|
|
dbms driver abstraction |
|
|
holder for implementation specific dbms access functions Referenced by cp_db_actions_create(). |
|
|
implemetations must define a function to close database connections |
|
|
implementations may define a function to perform a commit |
|
|
wrapper for dbms specific connection structure Referenced by cp_db_connection_pool_create(), cp_db_connection_pool_get_connection(), and cp_db_connection_pool_shutdown(). |
|
|
wrapper for dbms specific connection parameter descriptor |
|
|
connection pool structure Referenced by cp_db_connection_pool_create(). |
|
|
implementations may define a function to escape binary data for use in SQL queries |
|
|
implementations may define a function to escape strings for use in SQL queries |
|
|
implementations may define a function to execute a prepared statement |
|
|
implementations may define a function to retrieve metadata for a query result |
|
|
implementations may define a function to retrieve result rows by chunk |
|
|
implementations must define a function to open connections |
|
|
implementations may define a function to create a prepared statement |
|
|
implementations may define a function to close an open result set |
|
|
implementations may define a function to release implementation specific allocations made to instantiate a prepared statement |
|
|
implementations may define a function to perform a rollback |
|
|
implementations must define a function to perform SELECT queries |
|
|
implementations may define a function to set autocommit mode |
|
|
implementation may define a function to unescape binary data returned by an SQL query |
|
|
implemetations must define a function to perform INSERT, UPDATE or DELETE queries |
|
|
holder for SELECT query results |
|
|
deallocate a cp_data_source structure Definition at line 965 of file db.c. References cp_db_connection_parameters_destroy(). |
|
|
open a connection with the set connection parameters |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
convenience method to create a new implementation method holder Definition at line 745 of file db.c. References cp_db_actions. |
|
|
deallocate an implementation method holder |
|
|
close connection |
|
||||||||||||
|
release a statement Definition at line 472 of file db.c. References cp_db_statement_destroy(), and cp_error(). |
|
|
perform a commit Definition at line 500 of file db.c. References cp_error(). |
|
|
deallocate connection wrapper |
|
||||||||||||||||||||
|
escape binary data for use in an SQL query on this connection Definition at line 206 of file db.c. References cp_error(). |
|
||||||||||||||||
|
escape a string for use in an SQL query on this connection Definition at line 192 of file db.c. References cp_error(). |
|
||||||||||||||||||||
|
execute a prepared statement Definition at line 260 of file db.c. References cp_error(), cp_string, _cp_string::data, and _cp_string::len. |
|
||||||||||||||||||||
|
execute a prepared statement Definition at line 339 of file db.c. References cp_destructor_fn, cp_error(), and cp_string. |
|
|
destroy connection parameter descriptor Definition at line 124 of file db.c. Referenced by cp_data_source_destroy(). |
|
||||||||||||||||||||
|
create a new connection pool Definition at line 992 of file db.c. References COLLECTION_MODE_MULTIPLE_VALUES, COLLECTION_MODE_NOSYNC, cp_db_connection, cp_db_connection_pool, cp_db_connection_pool_destroy(), cp_error(), cp_list_append(), cp_list_create_list(), and _cp_vector::lock. |
|
|
deallocate a connection pool object Definition at line 1104 of file db.c. References cp_list_destroy(). Referenced by cp_db_connection_pool_create(). |
|
|
retrieve a connection from a connection pool Definition at line 1129 of file db.c. References cp_db_connection, and cp_list_remove_head(). |
|
||||||||||||
|
return a connection to the pool Definition at line 1152 of file db.c. References cp_list_insert(). |
|
||||||||||||
|
set connection pool to block until a connection is available when retrieving connections if no connection is available |
|
|
shut down a connection pool Definition at line 1069 of file db.c. References cp_db_connection, cp_list_item_count(), cp_list_remove_head(), and _cp_vector::size. |
|
||||||||||||||||||||
|
create a prepared statement for use with a connection Definition at line 241 of file db.c. References cp_error(). |
|
|
perform a rollback Definition at line 512 of file db.c. References cp_error(). |
|
||||||||||||
|
perform a SELECT query |
|
||||||||||||
|
set autocommit state Definition at line 487 of file db.c. References cp_error(). |
|
||||||||||||
|
auto fetch metadata |
|
||||||||||||
|
number of rows to fetch at a time Definition at line 180 of file db.c. References cp_error(). |
|
||||||||||||
|
fetch complete result set immediately Definition at line 167 of file db.c. References cp_error(). |
|
||||||||||||
|
unescape binary data returned by an SQL query on this connection Definition at line 226 of file db.c. References cp_error(), cp_string, and cp_string_create(). |
|
||||||||||||
|
perform an INSERT, UPDATE or DELETE query |
|
|
initialize persistence framework Definition at line 28 of file db.c. References cp_list_create(). |
|
||||||||||||
|
register a dbms driver with the persistence framework Definition at line 37 of file db.c. References cp_list_append(), and cp_list_item_count(). |
|
|
shutdown dbms framework Definition at line 60 of file db.c. References cp_hashtable_destroy(), and cp_list_destroy_custom(). |
|
|
internal function - do not call directly. to release a prepared statement use cp_db_connection_close_statement. Definition at line 561 of file db.c. Referenced by cp_db_connection_close_statement(). |
|
||||||||||||||||||||
|
convenience function for driver implementations - do not call directly. to create a prepared statement use cp_db_connection_prepare_statement. |
|
||||||||||||
|
set binary = 1 to request results in binary format |
|
||||||||||||
|
set auto disposal Definition at line 701 of file db.c. References cp_list_create(). |
|
|
close result set Definition at line 605 of file db.c. References cp_list_destroy(), cp_list_remove_head(), and cp_result_set_release_row(). |
|
|
get field count |
|
||||||||||||
|
get the type of a column Definition at line 683 of file db.c. References cp_result_set_get_field_types(). |
|
|
get a vector with field type codes - see cp_field_type Definition at line 649 of file db.c. References cp_error(). Referenced by cp_result_set_get_field_type(). |
|
||||||||||||
|
get a vector with field headers Definition at line 674 of file db.c. References cp_result_set_get_headers(). |
|
|
get a vector with field headers Definition at line 634 of file db.c. References cp_error(). Referenced by cp_result_set_get_header(). |
|
|
check whether rows are in binary format |
|
|
get next row Definition at line 576 of file db.c. References cp_error(), cp_list_append(), and cp_list_remove_head(). |
|
||||||||||||
|
free a row from a result set Definition at line 708 of file db.c. References cp_destructor_fn, and cp_string_destroy(). Referenced by cp_result_set_destroy(). |
|
|
get number of rows |
1.3.9.1