| apr_pool_t* rxv_spin_db_pool | ( | rxv_spin_db_t * | db | ) |
Retrieve database specific pool.
| db | Database connection |
rxv_spin_db_pool(db);
| char* rxv_spin_db_cinfo | ( | rxv_spin_db_t * | db | ) |
Retrieve database connection information.
| db | Database connection |
rxv_spin_db_cinfo(db);
| const apr_dbd_driver_t* rxv_spin_db_driver | ( | rxv_spin_db_t * | db | ) |
Retrieve database driver.
| db | Database connection |
rxv_spin_db_driver(db);
| apr_dbd_t* rxv_spin_db_handle | ( | rxv_spin_db_t * | db | ) |
Retrieve database handle.
| db | Database connection |
rxv_spin_db_handle(db);
| apr_dbd_transaction_t* rxv_spin_db_txn | ( | rxv_spin_db_txn_t * | txn | ) |
Retrieve database transaction.
| txn | Database transaction |
rxv_spin_db_txn(txn);
| rxv_spin_db_t* rxv_spin_db_open | ( | rxv_spin_ctx_t * | ctx, | |
| const char * | conninfo | |||
| ) |
Connect to a database and optionally pool the connection.
| ctx | Context | |
| conninfo | Connection string |
rxv_spin_db_open(ctx,"pgsql:dbname=spintest");
Connections will be pooled by using connection string as a key into the hash. So, if a connection string differs in the amount of white space or case, this will open a new connection.
Cleanup will be registered with the context pool.
| apr_status_t rxv_spin_db_close | ( | rxv_spin_ctx_t * | ctx, | |
| rxv_spin_db_t * | db | |||
| ) |
Close a database connection.
| ctx | Context | |
| db | Pointer to a database connection |
rxv_spin_db_close(ctx,db);
| apr_status_t rxv_spin_db_status | ( | rxv_spin_ctx_t * | ctx, | |
| rxv_spin_db_t * | db | |||
| ) |
Get the status of the connection.
| ctx | Context | |
| db | Database connection |
if(rxv_spin_db_status(ctx,db)!=APR_SUCCESS){ ... }
| rxv_spin_data_t* rxv_spin_db_data | ( | apr_pool_t * | pool, | |
| rxv_spin_db_t * | db, | |||
| apr_dbd_results_t * | dbdres | |||
| ) |
Convert APR DBD SQL result set to mod_spin database result.
| pool | Pool used for memory allocation | |
| db | Database connection | |
| dbdres | APR DBD results |
rxv_spin_db_data(pool,conn,db,dbdres);
| rxv_spin_data_t* rxv_spin_db_select | ( | apr_pool_t * | pool, | |
| rxv_spin_db_t * | db, | |||
| const char * | query | |||
| ) |
Execute a database query that returns a result set (i.e. SELECT).
| pool | Pool used for memory allocation | |
| db | Database connection | |
| query | SQL query to be performed |
result=rxv_spin_db_select(pool,db,"select * from spintest");
| int rxv_spin_db_query | ( | apr_pool_t * | pool, | |
| rxv_spin_db_t * | db, | |||
| const char * | query | |||
| ) |
Execute a database query that doesn't return a result set.
| pool | Pool used for memory allocation | |
| db | Database connection | |
| query | SQL query to be performed |
nrows=rxv_spin_db_query(pool,db,"delete from spintest");
| rxv_spin_data_t* rxv_spin_db_pselect | ( | apr_pool_t * | pool, | |
| rxv_spin_db_t * | db, | |||
| const char * | query, | |||
| ... | ||||
| ) |
Prepare and execute database that returns a result set (i.e. SELECT)
| pool | Pool used for memory allocation | |
| db | Database connection | |
| query | SQL query to be prepared and executed | |
| ... | Parameters for prepared statement, (constant pointer to nul terminated string) |
result=rxv_spin_db_pselect(pool,db,"select * from names where name = %s", "Dude",NULL);
The last parameter in the list should be NULL and it has to be specified even when there are no other parameters.
| int rxv_spin_db_pquery | ( | apr_pool_t * | pool, | |
| rxv_spin_db_t * | db, | |||
| const char * | query, | |||
| ... | ||||
| ) |
Prepare and execute database that doesn't return a result set.
| pool | Pool used for memory allocation | |
| db | Database connection | |
| query | SQL query to be prepared and executed | |
| ... | Parameters for prepared statement, (constant pointer to nul terminated string) |
nrows=rxv_spin_db_pquery(pool,db,"delete from names where name = %s", "Dude",NULL);
The last parameter in the list should be NULL and it has to be specified even when there are no other parameters.
| rxv_spin_db_txn_t* rxv_spin_db_start | ( | apr_pool_t * | pool, | |
| rxv_spin_db_t * | db | |||
| ) |
Start a transaction.
| pool | Pool used for memory allocation | |
| db | Database connection |
txn=rxv_spin_db_start(pool,db);
| apr_status_t rxv_spin_db_end | ( | rxv_spin_db_txn_t * | txn | ) |
End a transaction.
| txn | Database transaction |
rxv_spin_db_end(txn);
1.5.7.1