branch: elpa/pg
commit ec52fe6cf4f154d7887d4595bdd21b8c922a8038
Author: Eric Marsden <[email protected]>
Commit: Eric Marsden <[email protected]>

    Tests: RETURNING functionality for the extended query protocol
---
 test/test-pg.el | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/test/test-pg.el b/test/test-pg.el
index 59ab3876509..d3d02b3f39e 100755
--- a/test/test-pg.el
+++ b/test/test-pg.el
@@ -2769,6 +2769,21 @@ bar$$"))))
   (let* ((res (pg-exec con "SELECT data from pgeltestr WHERE id=1"))
          (data (cl-first (pg-result res :tuple 0))))
     (should (string= data "Foobles")))
+  (pgtest-flush-table con "pgeltestr")
+  (let* ((res (pg-exec con "SELECT data from pgeltestr WHERE id=1"))
+         (data (cl-first (pg-result res :tuple 0))))
+    (should (string= data "Foobles")))
+  ;; Now test RETURNING functionality for the extended query protocol
+  (let* ((res (pg-exec-prepared con "INSERT INTO pgeltestr VALUES ($1, 
'Bizzles') RETURNING id" '((89 . "int4"))))
+         (id (cl-first (pg-result res :tuple 0))))
+    (should (eql 89 id)))
+  (let* ((res (pg-exec-prepared con "INSERT INTO pgeltestr VALUES ($1, 
'Bazzles') RETURNING id" '((-69 . "int4"))))
+         (id (cl-first (pg-result res :tuple 0))))
+    (should (eql -69 id)))
+  (pgtest-flush-table con "pgeltestr")
+  (let* ((res (pg-exec con "SELECT data from pgeltestr WHERE id=-69"))
+         (data (cl-first (pg-result res :tuple 0))))
+    (should (string= data "Bazzles")))
   (pg-exec con "DROP TABLE pgeltestr"))
 
 

Reply via email to