Apache2
apr_dbd_internal.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /* Overview of what this is and does:
18  * http://www.apache.org/~niq/dbd.html
19  */
20 
21 #ifndef APR_DBD_INTERNAL_H
22 #define APR_DBD_INTERNAL_H
23 
24 #include <stdarg.h>
25 
26 #include "apr_dbd.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #define TXN_IGNORE_ERRORS(t) \
33  ((t) && ((t)->mode & APR_DBD_TRANSACTION_IGNORE_ERRORS))
34 #define TXN_NOTICE_ERRORS(t) \
35  ((t) && !((t)->mode & APR_DBD_TRANSACTION_IGNORE_ERRORS))
36 
37 #define TXN_DO_COMMIT(t) (!((t)->mode & APR_DBD_TRANSACTION_ROLLBACK))
38 #define TXN_DO_ROLLBACK(t) ((t)->mode & APR_DBD_TRANSACTION_ROLLBACK)
39 
40 #define TXN_MODE_BITS \
41  (APR_DBD_TRANSACTION_ROLLBACK|APR_DBD_TRANSACTION_IGNORE_ERRORS)
42 
45  const char *name;
46 
50  void (*init)(apr_pool_t *pool);
51 
57  void *(*native_handle)(apr_dbd_t *handle);
58 
69  apr_dbd_t *(*open)(apr_pool_t *pool, const char *params,
70  const char **error);
71 
79 
86 
94  int (*set_dbname)(apr_pool_t* pool, apr_dbd_t *handle, const char *name);
95 
104  apr_dbd_transaction_t **trans);
105 
114 
122  int (*query)(apr_dbd_t *handle, int *nrows, const char *statement);
123 
136  const char *statement, int random);
137 
144 
152 
163  apr_dbd_row_t **row, int rownum);
164 
172  const char* (*get_entry)(const apr_dbd_row_t *row, int col);
173 
181  const char *(*error)(apr_dbd_t *handle, int errnum);
182 
190  const char *(*escape)(apr_pool_t *pool, const char *string,
191  apr_dbd_t *handle);
192 
207  int (*prepare)(apr_pool_t *pool, apr_dbd_t *handle, const char *query,
208  const char *label, int nargs, int nvals,
209  apr_dbd_type_e *types, apr_dbd_prepared_t **statement);
210 
220  int (*pvquery)(apr_pool_t *pool, apr_dbd_t *handle, int *nrows,
221  apr_dbd_prepared_t *statement, va_list args);
222 
234  apr_dbd_results_t **res,
235  apr_dbd_prepared_t *statement, int random, va_list args);
236 
246  int (*pquery)(apr_pool_t *pool, apr_dbd_t *handle, int *nrows,
247  apr_dbd_prepared_t *statement, const char **args);
248 
260  apr_dbd_results_t **res, apr_dbd_prepared_t *statement,
261  int random, const char **args);
262 
263 
270  const char* (*get_name)(const apr_dbd_results_t *res, int col);
271 
278 
286 
288  const char *pformat;
289 
299  int (*pvbquery)(apr_pool_t *pool, apr_dbd_t *handle, int *nrows,
300  apr_dbd_prepared_t *statement, va_list args);
301 
313  apr_dbd_results_t **res,
314  apr_dbd_prepared_t *statement, int random, va_list args);
315 
325  int (*pbquery)(apr_pool_t *pool, apr_dbd_t *handle, int *nrows,
326  apr_dbd_prepared_t *statement,const void **args);
327 
339  apr_dbd_results_t **res, apr_dbd_prepared_t *statement,
340  int random, const void **args);
341 
350  apr_status_t (*datum_get)(const apr_dbd_row_t *row, int col,
351  apr_dbd_type_e type, void *data);
352 };
353 
354 /* Export mutex lock/unlock for drivers that need it
355  * deprecated; create a per-dbd mutex within the (*init) function
356  * to avoid blocking other providers running on other threads
357  */
360 
361 #ifdef __cplusplus
362 }
363 #endif
364 
365 #endif
APR-UTIL DBD library.
apr_status_t apr_dbd_mutex_unlock(void)
apr_status_t apr_dbd_mutex_lock(void)
apr_dbd_type_e
Definition: apr_dbd.h:55
struct apr_dbd_prepared_t apr_dbd_prepared_t
Definition: apr_dbd.h:87
struct apr_dbd_t apr_dbd_t
Definition: apr_dbd.h:83
struct apr_dbd_results_t apr_dbd_results_t
Definition: apr_dbd.h:85
struct apr_dbd_transaction_t apr_dbd_transaction_t
Definition: apr_dbd.h:84
struct apr_dbd_row_t apr_dbd_row_t
Definition: apr_dbd.h:86
apr_bucket_brigade ap_input_mode_t mode
Definition: mod_dav.h:2662
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:557
int
Definition: mod_proxy.h:674
int apr_status_t
Definition: apr_errno.h:44
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
#define APR_DECLARE(x)
Definition: macros.h:6
Definition: apr_dbd_internal.h:43
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
int(* transaction_mode_get)(apr_dbd_transaction_t *trans)
Definition: apr_dbd_internal.h:277
int(* set_dbname)(apr_pool_t *pool, apr_dbd_t *handle, const char *name)
Definition: apr_dbd_internal.h:94
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
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
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
int(* num_tuples)(apr_dbd_results_t *res)
Definition: apr_dbd_internal.h:151
int(* num_cols)(apr_dbd_results_t *res)
Definition: apr_dbd_internal.h:143
apr_status_t(* close)(apr_dbd_t *handle)
Definition: apr_dbd_internal.h:85
const char * name
Definition: apr_dbd_internal.h:45
apr_status_t(* check_conn)(apr_pool_t *pool, apr_dbd_t *handle)
Definition: apr_dbd_internal.h:78
int(* start_transaction)(apr_pool_t *pool, apr_dbd_t *handle, apr_dbd_transaction_t **trans)
Definition: apr_dbd_internal.h:103
int(* transaction_mode_set)(apr_dbd_transaction_t *trans, int mode)
Definition: apr_dbd_internal.h:285
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
int(* end_transaction)(apr_dbd_transaction_t *trans)
Definition: apr_dbd_internal.h:113
const char *(* error)(apr_dbd_t *handle, int errnum)
Definition: apr_dbd_internal.h:181
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
const char * pformat
Definition: apr_dbd_internal.h:288
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_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
void(* init)(apr_pool_t *pool)
Definition: apr_dbd_internal.h:50
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
int(* query)(apr_dbd_t *handle, int *nrows, const char *statement)
Definition: apr_dbd_internal.h:122
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
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
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