diff options
author | Graham Leggett <minfrin@apache.org> | 2006-10-22 13:31:25 +0000 |
---|---|---|
committer | Graham Leggett <minfrin@apache.org> | 2006-10-22 13:31:25 +0000 |
commit | 1edf74155f0d7bff05077c01eeec98f58e5740fa (patch) | |
tree | a275b2e0005d797b48252d8575466369371d4bbf /modules/database | |
parent | 9c4d3003b7a10a7b19096d823e5bc4e4f392fde8 (diff) | |
download | httpd-1edf74155f0d7bff05077c01eeec98f58e5740fa.tar.gz |
mod_dbd: Key the storage of prepared statements on the hex string
value of server_rec, rather than the server name, as the server name
may change (eg when the server name is set) at any time, causing
weird behaviour in modules dependent on mod_dbd.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@466641 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/database')
-rw-r--r-- | modules/database/mod_dbd.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/modules/database/mod_dbd.c b/modules/database/mod_dbd.c index af404d494e..624869c2b7 100644 --- a/modules/database/mod_dbd.c +++ b/modules/database/mod_dbd.c @@ -68,7 +68,6 @@ typedef enum { cmd_name, cmd_params, cmd_persist, } cmd_parts; static apr_hash_t *dbd_prepared_defns; -static const char *const default_hostname = "*"; /* a default DBDriver value that'll generate meaningful error messages */ static const char *const no_dbdriver = "[DBDriver unset]"; @@ -148,12 +147,7 @@ DBD_DECLARE_NONSTD(void) ap_dbd_prepare(server_rec *s, const char *query, const char *label) { dbd_prepared *prepared = apr_pcalloc(s->process->pool, sizeof(dbd_prepared)); - const char *key = s->server_hostname; - if (key == NULL) { - key = default_hostname; - ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, - "DBD: ServerName should be set before declaring any prepared statements"); - } + const char *key = apr_psprintf(s->process->pool, "%pp", s); prepared->label = label; prepared->query = query; prepared->next = apr_hash_get(dbd_prepared_defns, key, APR_HASH_KEY_STRING); @@ -623,10 +617,7 @@ static int dbd_post_config(apr_pool_t *pconf, apr_pool_t *plog, svr_cfg *svr; server_rec *sp; for (sp = s; sp; sp = sp->next) { - const char *key = s->server_hostname; - if (key == NULL) { - key = default_hostname; - } + const char *key = apr_psprintf(s->process->pool, "%pp", s); svr = ap_get_module_config(sp->module_config, &dbd_module); svr->prepared = apr_hash_get(dbd_prepared_defns, key, APR_HASH_KEY_STRING); |