apr_dbd_driver_t Struct Reference

Data Fields

const char * name
void(* init )(apr_pool_t *pool)
void *(* native_handle )(apr_dbd_t *handle)
apr_dbd_t *(* open )(apr_pool_t *pool, const char *params, const char **error)
apr_status_t(* check_conn )(apr_pool_t *pool, apr_dbd_t *handle)
apr_status_t(* close )(apr_dbd_t *handle)
int(* set_dbname )(apr_pool_t *pool, apr_dbd_t *handle, const char *name)
int(* start_transaction )(apr_pool_t *pool, apr_dbd_t *handle, apr_dbd_transaction_t **trans)
int(* end_transaction )(apr_dbd_transaction_t *trans)
int(* query )(apr_dbd_t *handle, int *nrows, const char *statement)
int(* select )(apr_pool_t *pool, apr_dbd_t *handle, apr_dbd_results_t **res, const char *statement, int random)
int(* num_cols )(apr_dbd_results_t *res)
int(* num_tuples )(apr_dbd_results_t *res)
int(* get_row )(apr_pool_t *pool, apr_dbd_results_t *res, apr_dbd_row_t **row, int rownum)
const char *(* get_entry )(const apr_dbd_row_t *row, int col)
const char *(* error )(apr_dbd_t *handle, int errnum)
const char *(* escape )(apr_pool_t *pool, const char *string, apr_dbd_t *handle)
int(* prepare )(apr_pool_t *pool, apr_dbd_t *handle, const char *query, const char *label, int nargs, int nvals, apr_dbd_type_e *types, apr_dbd_prepared_t **statement)
int(* pvquery )(apr_pool_t *pool, apr_dbd_t *handle, int *nrows, apr_dbd_prepared_t *statement, va_list args)
int(* pvselect )(apr_pool_t *pool, apr_dbd_t *handle, apr_dbd_results_t **res, apr_dbd_prepared_t *statement, int random, va_list args)
int(* pquery )(apr_pool_t *pool, apr_dbd_t *handle, int *nrows, apr_dbd_prepared_t *statement, const char **args)
int(* pselect )(apr_pool_t *pool, apr_dbd_t *handle, apr_dbd_results_t **res, apr_dbd_prepared_t *statement, int random, const char **args)
const char *(* get_name )(const apr_dbd_results_t *res, int col)
int(* transaction_mode_get )(apr_dbd_transaction_t *trans)
int(* transaction_mode_set )(apr_dbd_transaction_t *trans, int mode)
const char * pformat
int(* pvbquery )(apr_pool_t *pool, apr_dbd_t *handle, int *nrows, apr_dbd_prepared_t *statement, va_list args)
int(* pvbselect )(apr_pool_t *pool, apr_dbd_t *handle, apr_dbd_results_t **res, apr_dbd_prepared_t *statement, int random, va_list args)
int(* pbquery )(apr_pool_t *pool, apr_dbd_t *handle, int *nrows, apr_dbd_prepared_t *statement, const void **args)
int(* pbselect )(apr_pool_t *pool, apr_dbd_t *handle, apr_dbd_results_t **res, apr_dbd_prepared_t *statement, int random, const void **args)
apr_status_t(* datum_get )(const apr_dbd_row_t *row, int col, apr_dbd_type_e type, void *data)

Field Documentation

apr_status_t(* apr_dbd_driver_t::check_conn)(apr_pool_t *pool, apr_dbd_t *handle)

check_conn: check status of a database connection

Parameters:
pool - a pool to use for error messages (if any).
handle - the connection to check
Returns:
APR_SUCCESS or error
apr_status_t(* apr_dbd_driver_t::close)(apr_dbd_t *handle)

close: close/release a connection obtained from open()

Parameters:
handle - the connection to release
Returns:
APR_SUCCESS or error
apr_status_t(* apr_dbd_driver_t::datum_get)(const apr_dbd_row_t *row, int col, apr_dbd_type_e type, void *data)

datum_get: get a binary entry from a row

Parameters:
row - row pointer
col - entry number
type - type of data to get
data - pointer to data, allocated by the caller
Returns:
APR_SUCCESS, an error code on error or if col is out of bounds
int(* apr_dbd_driver_t::end_transaction)(apr_dbd_transaction_t *trans)

end_transaction: end a transaction (commit on success, rollback on error). May be a no-op.

Parameters:
trans - the transaction.
Returns:
0 for success or error code
const char*(* apr_dbd_driver_t::error)(apr_dbd_t *handle, int errnum)

error: get current error message (if any)

Parameters:
handle - the connection
errnum - error code from operation that returned an error
Returns:
the database current error message, or message for errnum (implementation-dependent whether errnum is ignored)
const char*(* apr_dbd_driver_t::escape)(apr_pool_t *pool, const char *string, apr_dbd_t *handle)

escape: escape a string so it is safe for use in query/select

Parameters:
pool - pool to alloc the result from
string - the string to escape
handle - the connection
Returns:
the escaped, safe string
const char*(* apr_dbd_driver_t::get_entry)(const apr_dbd_row_t *row, int col)

get_entry: get an entry from a row

Parameters:
row - row pointer
col - entry number
val - entry to fill
Returns:
0 for success, -1 for no data, +1 for general error
const char*(* apr_dbd_driver_t::get_name)(const apr_dbd_results_t *res, int col)

get_name: get a column title from a result set

Parameters:
res - result set pointer
col - entry number
Returns:
param name, or NULL if col is out of bounds.
int(* apr_dbd_driver_t::get_row)(apr_pool_t *pool, apr_dbd_results_t *res, apr_dbd_row_t **row, int rownum)

get_row: get a row from a result set

Parameters:
pool - pool to allocate the row
res - result set pointer
row - pointer to row pointer. May point to NULL on entry
rownum - row number, or -1 for "next row". Ignored if random access is not supported.
Returns:
0 for success, -1 for rownum out of range or data finished
void(* apr_dbd_driver_t::init)(apr_pool_t *pool)

init: allow driver to perform once-only initialisation. Called once only. May be NULL

name

void*(* apr_dbd_driver_t::native_handle)(apr_dbd_t *handle)

native_handle: return the native database handle of the underlying db

Parameters:
handle - apr_dbd handle
Returns:
- native handle
int(* apr_dbd_driver_t::num_cols)(apr_dbd_results_t *res)

num_cols: get the number of columns in a results set

Parameters:
res - result set.
Returns:
number of columns
int(* apr_dbd_driver_t::num_tuples)(apr_dbd_results_t *res)

num_tuples: get the number of rows in a results set of a synchronous select

Parameters:
res - result set.
Returns:
number of rows, or -1 if the results are asynchronous
apr_dbd_t*(* apr_dbd_driver_t::open)(apr_pool_t *pool, const char *params, const char **error)

open: obtain a database connection from the server rec. Must be explicitly closed when you're finished with it. WARNING: only use this when you need a connection with a lifetime other than a request

Parameters:
pool - a pool to use for error messages (if any).
params - connection parameters.
error - descriptive error.
Returns:
database handle, or NULL on error.
int(* apr_dbd_driver_t::pbquery)(apr_pool_t *pool, apr_dbd_t *handle, int *nrows, apr_dbd_prepared_t *statement, const void **args)

pbquery: query using a prepared statement + binary args

Parameters:
pool - working pool
handle - the connection
nrows - number of rows affected.
statement - the prepared statement to execute
args - binary args to prepared statement
Returns:
0 for success or error code
int(* apr_dbd_driver_t::pbselect)(apr_pool_t *pool, apr_dbd_t *handle, apr_dbd_results_t **res, apr_dbd_prepared_t *statement, int random, const void **args)

pbselect: select using a prepared statement + binary args

Parameters:
pool - working pool
handle - the connection
res - pointer to query results. May point to NULL on entry
statement - the prepared statement to execute
random - Whether to support random-access to results
args - binary args to prepared statement
Returns:
0 for success or error code

format of prepared statement parameters

int(* apr_dbd_driver_t::pquery)(apr_pool_t *pool, apr_dbd_t *handle, int *nrows, apr_dbd_prepared_t *statement, const char **args)

pquery: query using a prepared statement + args

Parameters:
pool - working pool
handle - the connection
nrows - number of rows affected.
statement - the prepared statement to execute
args - args to prepared statement
Returns:
0 for success or error code
int(* apr_dbd_driver_t::prepare)(apr_pool_t *pool, apr_dbd_t *handle, const char *query, const char *label, int nargs, int nvals, apr_dbd_type_e *types, apr_dbd_prepared_t **statement)

prepare: prepare a statement

Parameters:
pool - pool to alloc the result from
handle - the connection
query - the SQL query
label - A label for the prepared statement. use NULL for temporary prepared statements (eg within a Request in httpd)
nargs - number of parameters in the query
nvals - number of values passed in p[b]query/select
types - pointer to an array with types of parameters
statement - statement to prepare. May point to null on entry.
Returns:
0 for success or error code
int(* apr_dbd_driver_t::pselect)(apr_pool_t *pool, apr_dbd_t *handle, apr_dbd_results_t **res, apr_dbd_prepared_t *statement, int random, const char **args)

pselect: select using a prepared statement + args

Parameters:
pool - working pool
handle - the connection
res - pointer to query results. May point to NULL on entry
statement - the prepared statement to execute
random - Whether to support random-access to results
args - args to prepared statement
Returns:
0 for success or error code
int(* apr_dbd_driver_t::pvbquery)(apr_pool_t *pool, apr_dbd_t *handle, int *nrows, apr_dbd_prepared_t *statement, va_list args)

pvbquery: query using a prepared statement + binary args

Parameters:
pool - working pool
handle - the connection
nrows - number of rows affected.
statement - the prepared statement to execute
args - binary args to prepared statement
Returns:
0 for success or error code
int(* apr_dbd_driver_t::pvbselect)(apr_pool_t *pool, apr_dbd_t *handle, apr_dbd_results_t **res, apr_dbd_prepared_t *statement, int random, va_list args)

pvbselect: select using a prepared statement + binary args

Parameters:
pool - working pool
handle - the connection
res - pointer to query results. May point to NULL on entry
statement - the prepared statement to execute
random - Whether to support random-access to results
args - binary args to prepared statement
Returns:
0 for success or error code
int(* apr_dbd_driver_t::pvquery)(apr_pool_t *pool, apr_dbd_t *handle, int *nrows, apr_dbd_prepared_t *statement, va_list args)

pvquery: query using a prepared statement + args

Parameters:
pool - working pool
handle - the connection
nrows - number of rows affected.
statement - the prepared statement to execute
args - args to prepared statement
Returns:
0 for success or error code
int(* apr_dbd_driver_t::pvselect)(apr_pool_t *pool, apr_dbd_t *handle, apr_dbd_results_t **res, apr_dbd_prepared_t *statement, int random, va_list args)

pvselect: select using a prepared statement + args

Parameters:
pool - working pool
handle - the connection
res - pointer to query results. May point to NULL on entry
statement - the prepared statement to execute
random - Whether to support random-access to results
args - args to prepared statement
Returns:
0 for success or error code
int(* apr_dbd_driver_t::query)(apr_dbd_t *handle, int *nrows, const char *statement)

query: execute an SQL query that doesn't return a result set

Parameters:
handle - the connection
nrows - number of rows affected.
statement - the SQL statement to execute
Returns:
0 for success or error code
int(* apr_dbd_driver_t::select)(apr_pool_t *pool, apr_dbd_t *handle, apr_dbd_results_t **res, const char *statement, int random)

select: execute an SQL query that returns a result set

Parameters:
pool - pool to allocate the result set
handle - the connection
res - pointer to result set pointer. May point to NULL on entry
statement - the SQL statement to execute
random - 1 to support random access to results (seek any row); 0 to support only looping through results in order (async access - faster)
Returns:
0 for success or error code
int(* apr_dbd_driver_t::set_dbname)(apr_pool_t *pool, apr_dbd_t *handle, const char *name)

set_dbname: select database name. May be a no-op if not supported.

Parameters:
pool - working pool
handle - the connection
name - the database to select
Returns:
0 for success or error code
int(* apr_dbd_driver_t::start_transaction)(apr_pool_t *pool, apr_dbd_t *handle, apr_dbd_transaction_t **trans)

transaction: start a transaction. May be a no-op.

Parameters:
pool - a pool to use for error messages (if any).
handle - the connection
trans - ptr to a transaction. May be null on entry
Returns:
0 for success or error code
int(* apr_dbd_driver_t::transaction_mode_get)(apr_dbd_transaction_t *trans)

transaction_mode_get: get the mode of transaction

Parameters:
trans - the transaction.
Returns:
mode of transaction
int(* apr_dbd_driver_t::transaction_mode_set)(apr_dbd_transaction_t *trans, int mode)

transaction_mode_set: get the mode of transaction

Parameters:
trans - the transaction.
mode - new mode of the transaction
Returns:
the mode of transaction in force after the call

The documentation for this struct was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on 19 Jun 2014 for Apache Portable Runtime Utility Library by  doxygen 1.6.1