apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Darroch <chr...@pearsoncmg.com>
Subject Re: sqlite3 dbd provider question
Date Mon, 19 May 2008 23:19:54 GMT
William A. Rowe, Jr. wrote:

>>  Are you referring to the Oracle dbd driver prepared-statement cache?
> 
> yes; my question is, even if we do construct a cache, is module lifetime
> appropriate?  When accessed by several different consumers at once?  (e.g.
> two libraries that rely on dbd, or several different httpd modules and
> applications which consume dbd?).

   This cache code has always been disabled, IIRC.  The
#define GLOBAL_PREPARED_STATEMENTS is commented out, I believe, and
personally I've never tried un-commenting it.  I suspect that (as Nick
Kew's comments indicate) it's not ready for use.

   One option, therefore, would be remove it and all the related
code, specifically the notion of a cache of prepared statements
(which has problems in a multiple-provider context, as you've pointed out).

   In a related fix, at a minimum, all the apr_dbd_mutex_unlock() calls
should be wrapped in #ifdef GLOBAL_PREPARED_STATEMENTS macros
(as things stand now).  See the patch below for line locations.
Or, if GLOBAL_PREPARED_STATEMENTS is being cut out entirely, these
calls should also be removed; they're not correct on their own.

   I have a few patches like this in the queue, in particular, I worked
through the hoops necessary to get proper Oracle-style UTF-8 handling
for LOBs.  Unfortunately that was with an earlier version (circa 1.2)
and it will take me a while to port them to the 1.3/trunk version;
it's on the to-do list for the next month but I shouldn't make any
promises.  I'll see if I can speed this up, though.

Chris.

=========================
--- apr_dbd_oracle.c.orig       2008-05-19 16:08:36.000000000 -0700
+++ apr_dbd_oracle.c    2008-04-09 15:17:32.000000000 -0700
@@ -982,9 +982,7 @@
     sql->status = OCIHandleAlloc(dbd_oracle_env, (dvoid**) &stmt->stmt,
                                  OCI_HTYPE_STMT, 0, NULL);
     if (sql->status != OCI_SUCCESS) {
-#ifdef GLOBAL_PREPARED_STATEMENTS
         apr_dbd_mutex_unlock();
-#endif
         return 1;
     }
 
@@ -992,9 +990,7 @@
                                  strlen(query), OCI_NTV_SYNTAX, OCI_DEFAULT);
     if (sql->status != OCI_SUCCESS) {
         OCIHandleFree(stmt->stmt, OCI_HTYPE_STMT);
-#ifdef GLOBAL_PREPARED_STATEMENTS
         apr_dbd_mutex_unlock();
-#endif
         return 1;
     }
 
@@ -1005,9 +1001,7 @@
     sql->status = OCIAttrGet(stmt->stmt, OCI_HTYPE_STMT, &stmt->type, 0,
                              OCI_ATTR_STMT_TYPE, sql->err);
     if (sql->status != OCI_SUCCESS) {
-#ifdef GLOBAL_PREPARED_STATEMENTS
         apr_dbd_mutex_unlock();
-#endif
         return 1;
     }
 
@@ -1017,9 +1011,7 @@
                              sizeof(prefetch_size), OCI_ATTR_PREFETCH_MEMORY,
                              sql->err);
     if (sql->status != OCI_SUCCESS) {
-#ifdef GLOBAL_PREPARED_STATEMENTS
         apr_dbd_mutex_unlock();
-#endif
         return 1;
     }
 #endif


Mime
View raw message