apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r168388 - in /apr/apr-util/trunk: CHANGES build/dbd.m4 configure.in dbd/apr_dbd.c include/apu.h.in test/testdbd.c
Date Thu, 05 May 2005 19:24:30 GMT
Author: pquerna
Date: Thu May  5 12:24:29 2005
New Revision: 168388

URL: http://svn.apache.org/viewcvs?rev=168388&view=rev
Log:
Add SQLite3 support for APR DBD.

I also added the SQLite3 driver to the test suite.  
I one test to allow drivers to optionally return a row count for async selects.

Submitted By: Rick Keiner <rick_keiner yahoo.com>

Modified:
    apr/apr-util/trunk/CHANGES
    apr/apr-util/trunk/build/dbd.m4
    apr/apr-util/trunk/configure.in
    apr/apr-util/trunk/dbd/apr_dbd.c
    apr/apr-util/trunk/include/apu.h.in
    apr/apr-util/trunk/test/testdbd.c

Modified: apr/apr-util/trunk/CHANGES
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/CHANGES?rev=168388&r1=168387&r2=168388&view=diff
==============================================================================
--- apr/apr-util/trunk/CHANGES (original)
+++ apr/apr-util/trunk/CHANGES Thu May  5 12:24:29 2005
@@ -1,5 +1,7 @@
 Changes with APR-util 1.2.0
 
+  *) Add sqlite3 support to APR DBD. [Rick Keiner <rick_keiner yahoo.com>]
+
   *) Fix build failure with non-threaded APR on AIX.  PR 34655.
      [Ryan Murray <rmurray+apache cyberhqz.com>]
 

Modified: apr/apr-util/trunk/build/dbd.m4
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/build/dbd.m4?rev=168388&r1=168387&r2=168388&view=diff
==============================================================================
--- apr/apr-util/trunk/build/dbd.m4 (original)
+++ apr/apr-util/trunk/build/dbd.m4 Thu May  5 12:24:29 2005
@@ -119,6 +119,44 @@
     APR_ADDTO(APRUTIL_LIBS,[-lmysqlclient_r])
   fi
 ])
+dnl
+AC_DEFUN([APU_CHECK_DBD_SQLITE3], [
+  apu_have_sqlite3=0
+
+  AC_ARG_WITH([sqlite3], [
+  --with-sqlite3=DIR         
+  ], [
+    apu_have_sqlite3=0
+    if test "$withval" = "yes"; then
+      AC_CHECK_HEADER(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
+    elif test "$withval" = "no"; then
+      apu_have_sqlite3=0
+    else
+      CPPFLAGS="-I$withval/include"
+      LIBS="-L$withval/lib "
+
+      AC_MSG_NOTICE(checking for sqlite3 in $withval)
+      AC_CHECK_HEADER(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
+      if test "$apu_have_sqlite3" != "0"; then
+        APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
+        APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
+      fi
+    fi
+  ], [
+    apu_have_sqlite3=0
+    AC_CHECK_HEADER(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
+  ])
+
+  AC_SUBST(apu_have_sqlite3)
+
+  dnl Since we have already done the AC_CHECK_LIB tests, if we have it, 
+  dnl we know the library is there.
+  if test "$apu_have_sqlite3" = "1"; then
+    APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lsqlite3])
+    APR_ADDTO(APRUTIL_LIBS,[-lsqlite3])
+  fi
+])
+dnl
 AC_DEFUN([APU_CHECK_DBD_SQLITE2], [
   apu_have_sqlite2=0
 

Modified: apr/apr-util/trunk/configure.in
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/configure.in?rev=168388&r1=168387&r2=168388&view=diff
==============================================================================
--- apr/apr-util/trunk/configure.in (original)
+++ apr/apr-util/trunk/configure.in Thu May  5 12:24:29 2005
@@ -120,6 +120,7 @@
 APU_CHECK_DBM
 APU_CHECK_DBD
 APU_CHECK_DBD_MYSQL
+APU_CHECK_DBD_SQLITE3
 APU_CHECK_DBD_SQLITE2
 APU_FIND_EXPAT
 APU_FIND_ICONV

Modified: apr/apr-util/trunk/dbd/apr_dbd.c
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/dbd/apr_dbd.c?rev=168388&r1=168387&r2=168388&view=diff
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd.c Thu May  5 12:24:29 2005
@@ -68,6 +68,9 @@
 #if APU_HAVE_PGSQL
     DRIVER_LOAD("pgsql", apr_dbd_pgsql_driver, pool);
 #endif
+#if APU_HAVE_SQLITE3
+    DRIVER_LOAD("sqlite3", apr_dbd_sqlite3_driver, pool);
+#endif
 #if APU_HAVE_SQLITE2
     DRIVER_LOAD("sqlite2", apr_dbd_sqlite2_driver, pool);
 #endif
@@ -135,6 +138,7 @@
                                        apr_pool_t *pool, const char *params,
                                        apr_dbd_t **handle)
 {
+
     *handle = driver->open(pool, params);
     if (*handle == NULL) {
         return APR_EGENERAL;

Modified: apr/apr-util/trunk/include/apu.h.in
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/include/apu.h.in?rev=168388&r1=168387&r2=168388&view=diff
==============================================================================
--- apr/apr-util/trunk/include/apu.h.in (original)
+++ apr/apr-util/trunk/include/apu.h.in Thu May  5 12:24:29 2005
@@ -79,6 +79,7 @@
 
 #define APU_HAVE_PGSQL         @apu_have_pgsql@
 #define APU_HAVE_MYSQL         @apu_have_mysql@
+#define APU_HAVE_SQLITE3       @apu_have_sqlite3@
 #define APU_HAVE_SQLITE2       @apu_have_sqlite2@
 
 #define APU_HAVE_APR_ICONV     @have_apr_iconv@

Modified: apr/apr-util/trunk/test/testdbd.c
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/test/testdbd.c?rev=168388&r1=168387&r2=168388&view=diff
==============================================================================
--- apr/apr-util/trunk/test/testdbd.c (original)
+++ apr/apr-util/trunk/test/testdbd.c Thu May  5 12:24:29 2005
@@ -99,9 +99,6 @@
     ABTS_ASSERT(tc, sql, rv == APR_SUCCESS);
     ABTS_PTR_NOTNULL(tc, res);
 
-    rv = apr_dbd_num_tuples(driver, res);
-    ABTS_ASSERT(tc, "no row counts for async selects", rv == -1);
-
     apr_pool_create(&tpool, pool);
     i = count;
     while (i > 0) {
@@ -183,14 +180,41 @@
 }
 #endif
 
+#if APU_HAVE_SQLITE3
+static void test_dbd_sqlite3(abts_case *tc, void *data)
+{
+    apr_pool_t *pool = p;
+    apr_status_t rv;
+    apr_dbd_driver_t* driver = NULL;
+    apr_dbd_t* handle = NULL;
+
+    rv = apr_dbd_get_driver(pool, "sqlite3", &driver);
+    ABTS_ASSERT(tc, "failed to fetch driver", rv == APR_SUCCESS);
+    ABTS_PTR_NOTNULL(tc, driver);
+
+    ABTS_STR_EQUAL(tc, apr_dbd_name(driver), "sqlite3");
+
+    rv = apr_dbd_open(driver, pool, "data/sqlite3.db", &handle);
+    ABTS_ASSERT(tc, "failed to open database", rv == APR_SUCCESS);
+    ABTS_PTR_NOTNULL(tc, handle);
+
+    test_dbd_generic(tc, handle, driver);
+}
+#endif
+
 abts_suite *testdbd(abts_suite *suite)
 {
     suite = ADD_SUITE(suite);
 
 
     abts_run_test(suite, test_dbd_init, NULL);
+
 #if APU_HAVE_SQLITE2
     abts_run_test(suite, test_dbd_sqlite2, NULL);
+#endif
+
+#if APU_HAVE_SQLITE3
+    abts_run_test(suite, test_dbd_sqlite3, NULL);
 #endif
     return suite;
 }



Mime
View raw message