|
Csilk 0.2.1
A lightweight, high-performance C HTTP web framework
|
Virtual function table implemented by each database driver. More...
#include <db.h>
Data Fields | |
| const char * | name |
| int(* | connect )(csilk_db_pool_t *pool, const char *dsn) |
| Open a connection to the database. | |
| int(* | disconnect )(csilk_db_pool_t *pool) |
| Close the database connection. | |
| int(* | query )(csilk_db_pool_t *pool, const char *sql, csilk_db_result_t *result) |
| Execute a SELECT query and produce a result set. | |
| int(* | exec )(csilk_db_pool_t *pool, const char *sql) |
| Execute a statement that returns no result rows. | |
| int(* | transaction_begin )(csilk_db_pool_t *pool) |
| Begin a database transaction. | |
| int(* | transaction_commit )(csilk_db_pool_t *pool) |
| Commit the current transaction. | |
| int(* | transaction_rollback )(csilk_db_pool_t *pool) |
| Roll back the current transaction. | |
| void(* | free_result )(csilk_db_result_t *result) |
| Free a result set and all associated memory. | |
Virtual function table implemented by each database driver.
Opaque database driver interface.
All function pointers must be non-NULL except where noted.
Each supported database backend implements the function table in csilk_db_driver_s and registers itself with csilk_db_register_driver.
| int(* csilk_db_driver_t::connect) (csilk_db_pool_t *pool, const char *dsn) |
Open a connection to the database.
| pool | Pool whose connection field should be populated. |
| dsn | Driver-specific data source name. |
| int(* csilk_db_driver_t::disconnect) (csilk_db_pool_t *pool) |
Close the database connection.
| pool | Pool whose connection should be closed and freed. |
| int(* csilk_db_driver_t::exec) (csilk_db_pool_t *pool, const char *sql) |
Execute a statement that returns no result rows.
| pool | Connection pool (mutex is held by the caller). |
| sql | SQL statement (INSERT, UPDATE, DELETE, DDL, etc.). |
| void(* csilk_db_driver_t::free_result) (csilk_db_result_t *result) |
Free a result set and all associated memory.
| result | Result set to free (must not be NULL). |
| const char* csilk_db_driver_t::name |
Driver identifier string (e.g., "sqlite", "postgres"). Matches the name passed to csilk_db_pool_new.
| int(* csilk_db_driver_t::query) (csilk_db_pool_t *pool, const char *sql, csilk_db_result_t *result) |
Execute a SELECT query and produce a result set.
| pool | Connection pool (mutex is held by the caller). | |
| sql | SQL query string. | |
| [out] | result | Caller-allocated csilk_db_result_t to populate. Set to zero-initialised (the driver allocates rows + strings internally). |
| int(* csilk_db_driver_t::transaction_begin) (csilk_db_pool_t *pool) |
Begin a database transaction.
| pool | Connection pool (mutex is held by the caller). |
| int(* csilk_db_driver_t::transaction_commit) (csilk_db_pool_t *pool) |
Commit the current transaction.
| pool | Connection pool (mutex is held by the caller). |
| int(* csilk_db_driver_t::transaction_rollback) (csilk_db_pool_t *pool) |
Roll back the current transaction.
| pool | Connection pool (mutex is held by the caller). |