Database functions
Functions |
apr_pool_t * | rxv_spin_db_pool (rxv_spin_db_t *db) |
char * | rxv_spin_db_cinfo (rxv_spin_db_t *db) |
const apr_dbd_driver_t * | rxv_spin_db_driver (rxv_spin_db_t *db) |
apr_dbd_t * | rxv_spin_db_handle (rxv_spin_db_t *db) |
apr_dbd_transaction_t * | rxv_spin_db_txn (rxv_spin_db_txn_t *txn) |
rxv_spin_db_t * | rxv_spin_db_open (rxv_spin_ctx_t *ctx, const char *conninfo) |
apr_status_t | rxv_spin_db_close (rxv_spin_ctx_t *ctx, rxv_spin_db_t *db) |
apr_status_t | rxv_spin_db_status (rxv_spin_ctx_t *ctx, rxv_spin_db_t *db) |
rxv_spin_data_t * | rxv_spin_db_data (apr_pool_t *pool, rxv_spin_db_t *db, apr_dbd_results_t *dbdres) |
rxv_spin_data_t * | rxv_spin_db_select (apr_pool_t *pool, rxv_spin_db_t *db, const char *query) |
int | rxv_spin_db_query (apr_pool_t *pool, rxv_spin_db_t *db, const char *query) |
rxv_spin_data_t * | rxv_spin_db_pselect (apr_pool_t *pool, rxv_spin_db_t *db, const char *query,...) |
int | rxv_spin_db_pquery (apr_pool_t *pool, rxv_spin_db_t *db, const char *query,...) |
rxv_spin_db_txn_t * | rxv_spin_db_start (apr_pool_t *pool, rxv_spin_db_t *db) |
apr_status_t | rxv_spin_db_end (rxv_spin_db_txn_t *txn) |
Detailed Description
Database functions (mod_spin API)
Function Documentation
Retrieve database specific pool.
- Parameters:
-
- Returns:
- pointer to database specific pool, NULL on error
- Example:
-
Retrieve database connection information.
- Parameters:
-
- Returns:
- pointer to connection information, NULL on error
- Example:
-
const apr_dbd_driver_t* rxv_spin_db_driver |
( |
rxv_spin_db_t * |
db |
) |
|
Retrieve database driver.
- Parameters:
-
- Returns:
- pointer to database driver, NULL on error
- Example:
-
Retrieve database handle.
- Parameters:
-
- Returns:
- pointer to database handle, NULL on error
- Example:
-
Retrieve database transaction.
- Parameters:
-
- Returns:
- pointer to database transaction, NULL on error
- Example:
-
Connect to a database and optionally pool the connection.
- Parameters:
-
| ctx | Context |
| conninfo | Connection string |
- Returns:
- pointer to a database connection, NULL on error
- Example:
-
Close a database connection.
- Parameters:
-
| ctx | Context |
| db | Pointer to a database connection |
- Returns:
- APR_SUCCESS on success, otherwise an error
- Example:
-
Get the status of the connection.
- Parameters:
-
| ctx | Context |
| db | Database connection |
- Returns:
- APR_SUCCESS if OK, otherwise an error
- Example:
-
Convert APR DBD SQL result set to mod_spin database result.
- Parameters:
-
| pool | Pool used for memory allocation |
| db | Database connection |
| dbdres | APR DBD results |
- Returns:
- Valid rxv_spin_data_t pointer, NULL on error
- Example:
-
Execute a database query that returns a result set (i.e. SELECT).
- Parameters:
-
| pool | Pool used for memory allocation |
| db | Database connection |
| query | SQL query to be performed |
- Returns:
- Valid rxv_spin_data_t pointer, NULL on error
- Example:
-
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.
- Parameters:
-
| pool | Pool used for memory allocation |
| db | Database connection |
| query | SQL query to be performed |
- Returns:
- Number of rows affected, -1 on error
- Example:
-
Prepare and execute database that returns a result set (i.e. SELECT)
- Parameters:
-
| 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) |
- Returns:
- Valid rxv_spin_data_t pointer, NULL on error
- Example:
-
- Warning:
- Make sure you use %s where the replaced parameter is supposed to go. This is the official Apache Portable Runtime DBD way :-).
-
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.
- Parameters:
-
| 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) |
- Returns:
- Number of rows affected, -1 on error
- Example:
-
- Warning:
- Make sure you use %s where the replaced parameter is supposed to go. This is the official Apache Portable Runtime DBD way :-).
-
The last parameter in the list should be NULL and it has to be specified even when there are no other parameters.
Start a transaction.
- Parameters:
-
| pool | Pool used for memory allocation |
| db | Database connection |
- Returns:
- Pointer to a valid transaction, NULL on error
- Example:
-
End a transaction.
- Parameters:
-
- Returns:
- APR_SUCCESS on success, otherwise an error
- Example:
-