]> git.eshelyaron.com Git - emacs.git/commitdiff
Add a test for sqlite "insert ... returning"
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 10 Oct 2022 12:09:54 +0000 (14:09 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 10 Oct 2022 12:10:04 +0000 (14:10 +0200)
* test/src/sqlite-tests.el (sqlite-returning): Add a test for
"insert ... returning".

test/src/sqlite-tests.el

index 5af43923012a5f3722b69d83f1bfdd013e019e0d..be4f60ab57fabc3e3d7403a9ea2cd02328407d49 100644 (file)
           (should (multibyte-string-p c1))
           (should-not (multibyte-string-p c2)))))))
 
+(ert-deftest sqlite-returning ()
+  (skip-unless (sqlite-available-p))
+  (let (db)
+    (progn
+      (setq db (sqlite-open))
+      (sqlite-execute db "CREATE TABLE people1 (people_id INTEGER PRIMARY KEY, first TEXT, last TEXT)")
+      (should (null (sqlite-select db "select * from people1")))
+      (should
+       (equal
+        (sqlite-execute db "INSERT INTO people1 (first, last) values (?, ?) RETURNING people_id, first"
+                       '("Joe" "Doe"))
+        '((1 "Joe")))))))
+
 ;;; sqlite-tests.el ends here