Loading...
Searching...
No Matches
apr_dbd_internal.h
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* Overview of what this is and does:
* http://www.apache.org/~niq/dbd.html
*/
#ifndef APR_DBD_INTERNAL_H
#define APR_DBD_INTERNAL_H
#include <stdarg.h>
#include "apr_dbd.h"
#ifdef __cplusplus
extern "C" {
#endif
#define TXN_IGNORE_ERRORS(t) \
((t) && ((t)->mode & APR_DBD_TRANSACTION_IGNORE_ERRORS))
#define TXN_NOTICE_ERRORS(t) \
((t) && !((t)->mode & APR_DBD_TRANSACTION_IGNORE_ERRORS))
#define TXN_DO_COMMIT(t) (!((t)->mode & APR_DBD_TRANSACTION_ROLLBACK))
#define TXN_DO_ROLLBACK(t) ((t)->mode & APR_DBD_TRANSACTION_ROLLBACK)
#define TXN_MODE_BITS \
(APR_DBD_TRANSACTION_ROLLBACK|APR_DBD_TRANSACTION_IGNORE_ERRORS)
struct apr_dbd_driver_t {
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);
};
/* Export mutex lock/unlock for drivers that need it
* deprecated; create a per-dbd mutex within the (*init) function
* to avoid blocking other providers running on other threads
*/
APU_DECLARE(apr_status_t) apr_dbd_mutex_lock(void);
APU_DECLARE(apr_status_t) apr_dbd_mutex_unlock(void);
#ifdef __cplusplus
}
#endif
#endif
apr_dbd.h
APR-UTIL DBD library.
apr_dbd_type_e
apr_dbd_type_e
Definition apr_dbd.h:55
apr_dbd_driver_t
Definition apr_dbd_internal.h:43
apr_dbd_driver_t::pvbselect
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)
Definition apr_dbd_internal.h:312
apr_dbd_driver_t::transaction_mode_get
int(* transaction_mode_get)(apr_dbd_transaction_t *trans)
Definition apr_dbd_internal.h:277
apr_dbd_driver_t::set_dbname
int(* set_dbname)(apr_pool_t *pool, apr_dbd_t *handle, const char *name)
Definition apr_dbd_internal.h:94
apr_dbd_driver_t::pselect
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)
Definition apr_dbd_internal.h:259
apr_dbd_driver_t::select
int(* select)(apr_pool_t *pool, apr_dbd_t *handle, apr_dbd_results_t **res, const char *statement, int random)
Definition apr_dbd_internal.h:135
apr_dbd_driver_t::prepare
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)
Definition apr_dbd_internal.h:207
apr_dbd_driver_t::num_tuples
int(* num_tuples)(apr_dbd_results_t *res)
Definition apr_dbd_internal.h:151
apr_dbd_driver_t::num_cols
int(* num_cols)(apr_dbd_results_t *res)
Definition apr_dbd_internal.h:143
apr_dbd_driver_t::close
apr_status_t(* close)(apr_dbd_t *handle)
Definition apr_dbd_internal.h:85
apr_dbd_driver_t::name
const char * name
Definition apr_dbd_internal.h:45
apr_dbd_driver_t::check_conn
apr_status_t(* check_conn)(apr_pool_t *pool, apr_dbd_t *handle)
Definition apr_dbd_internal.h:78
apr_dbd_driver_t::start_transaction
int(* start_transaction)(apr_pool_t *pool, apr_dbd_t *handle, apr_dbd_transaction_t **trans)
Definition apr_dbd_internal.h:103
apr_dbd_driver_t::transaction_mode_set
int(* transaction_mode_set)(apr_dbd_transaction_t *trans, int mode)
Definition apr_dbd_internal.h:285
apr_dbd_driver_t::pquery
int(* pquery)(apr_pool_t *pool, apr_dbd_t *handle, int *nrows, apr_dbd_prepared_t *statement, const char **args)
Definition apr_dbd_internal.h:246
apr_dbd_driver_t::end_transaction
int(* end_transaction)(apr_dbd_transaction_t *trans)
Definition apr_dbd_internal.h:113
apr_dbd_driver_t::error
const char *(* error)(apr_dbd_t *handle, int errnum)
Definition apr_dbd_internal.h:181
apr_dbd_driver_t::pvbquery
int(* pvbquery)(apr_pool_t *pool, apr_dbd_t *handle, int *nrows, apr_dbd_prepared_t *statement, va_list args)
Definition apr_dbd_internal.h:299
apr_dbd_driver_t::pformat
const char * pformat
Definition apr_dbd_internal.h:288
apr_dbd_driver_t::pvquery
int(* pvquery)(apr_pool_t *pool, apr_dbd_t *handle, int *nrows, apr_dbd_prepared_t *statement, va_list args)
Definition apr_dbd_internal.h:220
apr_dbd_driver_t::datum_get
apr_status_t(* datum_get)(const apr_dbd_row_t *row, int col, apr_dbd_type_e type, void *data)
Definition apr_dbd_internal.h:350
apr_dbd_driver_t::init
void(* init)(apr_pool_t *pool)
Definition apr_dbd_internal.h:50
apr_dbd_driver_t::pbselect
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)
Definition apr_dbd_internal.h:338
apr_dbd_driver_t::query
int(* query)(apr_dbd_t *handle, int *nrows, const char *statement)
Definition apr_dbd_internal.h:122
apr_dbd_driver_t::pvselect
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)
Definition apr_dbd_internal.h:233
apr_dbd_driver_t::get_row
int(* get_row)(apr_pool_t *pool, apr_dbd_results_t *res, apr_dbd_row_t **row, int rownum)
Definition apr_dbd_internal.h:162
apr_dbd_driver_t::pbquery
int(* pbquery)(apr_pool_t *pool, apr_dbd_t *handle, int *nrows, apr_dbd_prepared_t *statement, const void **args)
Definition apr_dbd_internal.h:325