emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/emacsql c8de0ff1fd 293/427: Adjust the EmacSQL protocol.


From: ELPA Syncer
Subject: [nongnu] elpa/emacsql c8de0ff1fd 293/427: Adjust the EmacSQL protocol.
Date: Tue, 13 Dec 2022 02:59:52 -0500 (EST)

branch: elpa/emacsql
commit c8de0ff1fda3358e696eb588f83d24ae6f26384a
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>

    Adjust the EmacSQL protocol.
---
 emacsql.el       | 4 +++-
 sqlite/emacsql.c | 9 ++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/emacsql.el b/emacsql.el
index 38964c8d07..82d3b7eabe 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -213,7 +213,9 @@ specific error conditions."
            (value (read)))
       (if (eql value 'error)
           (emacsql-handle connection (read) (read))
-        value))))
+        (prog1 value
+          (unless (eq 'success (read))
+            (emacsql-handle connection (read) (read))))))))
 
 (provide 'emacsql) ; end of generic function declarations
 
diff --git a/sqlite/emacsql.c b/sqlite/emacsql.c
index 34b3481c10..884c4d2fe6 100644
--- a/sqlite/emacsql.c
+++ b/sqlite/emacsql.c
@@ -165,9 +165,12 @@ int main(int argc, char **argv) {
         }
         printf(")\n");
         if (sqlite3_finalize(stmt) != SQLITE_OK) {
-            fprintf(stderr, "error %d: %s\n",
-                    sqlite3_errcode(db), sqlite3_errmsg(db));
-            exit(EXIT_FAILURE);
+            /* Despite any error code, the statement is still freed.
+             * http://stackoverflow.com/a/8391872
+             */
+            send_error(sqlite3_errcode(db), sqlite3_errmsg(db));
+        } else {
+            printf("success\n");
         }
     }
     buffer_free(input);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]