apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r189574 - /apr/apr-util/trunk/dbd/apr_dbd.c /apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c
Date Wed, 08 Jun 2005 11:26:42 GMT
Author: niq
Date: Wed Jun  8 04:26:42 2005
New Revision: 189574

URL: http://svn.apache.org/viewcvs?rev=189574&view=rev
Log:
SQLite3 transaction patch (submitted by Rick Keiner)

Modified:
    apr/apr-util/trunk/dbd/apr_dbd.c
    apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c

Modified: apr/apr-util/trunk/dbd/apr_dbd.c
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/dbd/apr_dbd.c?rev=189574&r1=189573&r2=189574&view=diff
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd.c Wed Jun  8 04:26:42 2005
@@ -107,7 +107,11 @@
     }
 #endif
 
+#ifdef WIN32
+    sprintf(path, "apr_dbd_%s.dll", name);
+#else
     sprintf(path, "apr_dbd_%s.so", name);
+#endif
     rv = apr_dso_load(&dlhandle, path, pool);
     if (rv != APR_SUCCESS) { /* APR_EDSOOPEN */
         goto unlock;

Modified: apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c?rev=189574&r1=189573&r2=189574&view=diff
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c Wed Jun  8 04:26:42 2005
@@ -95,6 +95,10 @@
 
     char *hold = NULL;
 
+    if (sql->trans && sql->trans->errnum) {
+        return sql->trans->errnum;
+    }
+
     apr_thread_mutex_lock(sql->mutex);
 
     ret = sqlite3_prepare(sql->conn, query, strlen(query), &stmt, &tail);
@@ -174,6 +178,10 @@
     }
     ret = sqlite3_finalize(stmt);
     apr_thread_mutex_unlock(sql->mutex);
+
+    if (sql->trans) {
+        sql->trans->errnum = ret;
+    }
     return ret;
 }
 
@@ -228,8 +236,13 @@
     apr_status_t res;
     apr_pool_t *pool;
 
+    if (sql->trans && sql->trans->errnum) {
+        return sql->trans->errnum;
+    }
+
     res = apr_pool_create(&pool, sql->pool);
     if (res != APR_SUCCESS) {
+        sql->trans->errnum = res;
         return SQLITE_ERROR;
     }
     length = strlen(query);
@@ -239,8 +252,7 @@
         ret = sqlite3_prepare(sql->conn, query, length, &stmt, &tail);
         if (ret != SQLITE_OK) {
             sqlite3_finalize(stmt);
-            apr_thread_mutex_unlock(sql->mutex);
-            return ret;
+            break;
         }
 
         ret = sqlite3_step(stmt);
@@ -251,11 +263,14 @@
     } while (length > 0);
 
     if (dbd_sqlite3_is_success(ret)) {
-        ret = 0;
+        res = 0;
     }
     apr_thread_mutex_unlock(sql->mutex);
     apr_pool_destroy(pool);
-    return ret;
+    if (sql->trans) {
+        sql->trans->errnum = res;
+    }
+    return res;
 }
 
 static const char *dbd_sqlite3_escape(apr_pool_t * pool, const char *arg, apr_dbd_t * sql)
@@ -346,6 +361,7 @@
     sql = apr_pcalloc(pool, sizeof(*sql));
     sql->conn = conn;
     sql->pool = pool;
+    sql->trans = NULL;
     /* Create a mutex */
     res = apr_thread_mutex_create(&sql->mutex, APR_THREAD_MUTEX_DEFAULT, pool);
     if (res != APR_SUCCESS) {



Mime
View raw message