Apache HTTPD
mod_dbd.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
31#ifndef DBD_H
32#define DBD_H
33
34/* Create a set of DBD_DECLARE(type), DBD_DECLARE_NONSTD(type) and
35 * DBD_DECLARE_DATA with appropriate export and import tags for the platform
36 */
37#if !defined(WIN32)
38#define DBD_DECLARE(type) type
39#define DBD_DECLARE_NONSTD(type) type
40#define DBD_DECLARE_DATA
41#elif defined(DBD_DECLARE_STATIC)
42#define DBD_DECLARE(type) type __stdcall
43#define DBD_DECLARE_NONSTD(type) type
44#define DBD_DECLARE_DATA
45#elif defined(DBD_DECLARE_EXPORT)
46#define DBD_DECLARE(type) __declspec(dllexport) type __stdcall
47#define DBD_DECLARE_NONSTD(type) __declspec(dllexport) type
48#define DBD_DECLARE_DATA __declspec(dllexport)
49#else
50#define DBD_DECLARE(type) __declspec(dllimport) type __stdcall
51#define DBD_DECLARE_NONSTD(type) __declspec(dllimport) type
52#define DBD_DECLARE_DATA __declspec(dllimport)
53#endif
54
55#include <httpd.h>
56#include <apr_optional.h>
57#include <apr_hash.h>
58#include <apr_hooks.h>
59
60typedef struct {
62 const char *name;
63 const char *params;
65#if APR_HAS_THREADS
66 int nmin;
67 int nkeep;
68 int nmax;
69 int exptime;
70 int set;
71#endif
74} dbd_cfg_t;
75
82
83/* Export functions to access the database */
84
85/* acquire a connection that MUST be explicitly closed.
86 * Returns NULL on error
87 */
89
90/* release a connection acquired with ap_dbd_open */
92
93/* acquire a connection that will have the lifetime of a request
94 * and MUST NOT be explicitly closed. Return NULL on error.
95 * This is the preferred function for most applications.
96 */
98
99/* acquire a connection that will have the lifetime of a connection
100 * and MUST NOT be explicitly closed. Return NULL on error.
101 * This is the preferred function for most applications.
102 */
104
105/* Prepare a statement for use by a client module during
106 * the server startup/configuration phase. Can't be called
107 * after the server has created its children (use apr_dbd_*).
108 */
109DBD_DECLARE_NONSTD(void) ap_dbd_prepare(server_rec*, const char*, const char*);
110
111/* Also export them as optional functions for modules that prefer it */
116APR_DECLARE_OPTIONAL_FN(void, ap_dbd_prepare, (server_rec*, const char*, const char*));
117
120
121#endif
APR Hash Tables.
Apache hook functions.
APR-UTIL registration of functions exported by modules.
struct apr_dbd_t apr_dbd_t
Definition apr_dbd.h:83
#define APR_DECLARE_EXTERNAL_HOOK(ns, link, ret, name, args)
Definition apr_hooks.h:118
#define APR_DECLARE_OPTIONAL_FN(ret, name, args)
#define DBD_DECLARE_NONSTD(type)
Definition mod_dbd.h:39
ap_dbd_t * ap_dbd_cacquire(conn_rec *)
Definition mod_dbd.c:953
ap_dbd_t * ap_dbd_acquire(request_rec *)
Definition mod_dbd.c:929
ap_dbd_t * ap_dbd_open(apr_pool_t *, server_rec *)
Definition mod_dbd.c:793
void ap_dbd_prepare(server_rec *, const char *, const char *)
Definition mod_dbd.c:313
void ap_dbd_close(server_rec *, ap_dbd_t *)
Definition mod_dbd.c:755
apr_size_t size
int apr_status_t
Definition apr_errno.h:44
HTTP Daemon routines.
apr_pool_t * pool
Definition mod_dbd.h:80
const apr_dbd_driver_t * driver
Definition mod_dbd.h:78
apr_hash_t * prepared
Definition mod_dbd.h:79
apr_dbd_t * handle
Definition mod_dbd.h:77
Structure to store things which are per connection.
Definition httpd.h:1152
int persist
Definition mod_dbd.h:64
const char * name
Definition mod_dbd.h:62
apr_hash_t * queries
Definition mod_dbd.h:72
server_rec * server
Definition mod_dbd.h:61
const char * params
Definition mod_dbd.h:63
apr_array_header_t * init_queries
Definition mod_dbd.h:73
A structure that represents the current request.
Definition httpd.h:845
A structure to store information for each virtual server.
Definition httpd.h:1322