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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
19
* @brief Database Access Extension Module for Apache
21
* Overview of what this is and does:
22
* http://www.apache.org/~niq/dbd.html
24
* http://apache.webthing.com/database/
26
* @defgroup MOD_DBD mod_dbd
27
* @ingroup APACHE_MODS
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
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)
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)
56
#include <apr_optional.h>
61
const apr_dbd_driver_t *driver;
66
/* Export functions to access the database */
68
/* acquire a connection that MUST be explicitly closed.
69
* Returns NULL on error
71
DBD_DECLARE_NONSTD(ap_dbd_t*) ap_dbd_open(apr_pool_t*, server_rec*);
73
/* release a connection acquired with ap_dbd_open */
74
DBD_DECLARE_NONSTD(void) ap_dbd_close(server_rec*, ap_dbd_t*);
76
/* acquire a connection that will have the lifetime of a request
77
* and MUST NOT be explicitly closed. Return NULL on error.
78
* This is the preferred function for most applications.
80
DBD_DECLARE_NONSTD(ap_dbd_t*) ap_dbd_acquire(request_rec*);
82
/* acquire a connection that will have the lifetime of a connection
83
* and MUST NOT be explicitly closed. Return NULL on error.
84
* This is the preferred function for most applications.
86
DBD_DECLARE_NONSTD(ap_dbd_t*) ap_dbd_cacquire(conn_rec*);
88
/* Prepare a statement for use by a client module during
89
* the server startup/configuration phase. Can't be called
90
* after the server has created its children (use apr_dbd_*).
92
DBD_DECLARE_NONSTD(void) ap_dbd_prepare(server_rec*, const char*, const char*);
94
/* Also export them as optional functions for modules that prefer it */
95
APR_DECLARE_OPTIONAL_FN(ap_dbd_t*, ap_dbd_open, (apr_pool_t*, server_rec*));
96
APR_DECLARE_OPTIONAL_FN(void, ap_dbd_close, (server_rec*, ap_dbd_t*));
97
APR_DECLARE_OPTIONAL_FN(ap_dbd_t*, ap_dbd_acquire, (request_rec*));
98
APR_DECLARE_OPTIONAL_FN(ap_dbd_t*, ap_dbd_cacquire, (conn_rec*));
99
APR_DECLARE_OPTIONAL_FN(void, ap_dbd_prepare, (server_rec*, const char*, const char*));