From 8e643f3af7018f5023ef3d6e7aa56c65d4781958 Mon Sep 17 00:00:00 2001 From: Russ Tyndall Date: Fri, 9 Oct 2009 15:34:48 -0400 Subject: [PATCH] made command-object work with execute-command calls (in the pg-socket3 backend) --- db-postgresql-socket3/sql.lisp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/db-postgresql-socket3/sql.lisp b/db-postgresql-socket3/sql.lisp index 9b73b0d..e251500 100644 --- a/db-postgresql-socket3/sql.lisp +++ b/db-postgresql-socket3/sql.lisp @@ -236,7 +236,25 @@ ((expression string) (database postgresql-socket3-database)) (let ((connection (database-connection database))) (with-postgresql-handlers (database expression) - (cl-postgres:exec-query connection expression)))) + ;; return row count? + (second (multiple-value-list (cl-postgres:exec-query connection expression)))))) + +(defmethod execute-command ((obj command-object) + &key (database *default-database*)) + (clsql-sys::record-sql-command (expression obj) database) + (let ((res (database-execute-command obj database))) + (clsql-sys::record-sql-result res database) + ;; return row count? + res)) + +(defmethod database-execute-command + ((obj command-object) (database postgresql-socket3-database)) + (let ((connection (database-connection database))) + (with-postgresql-handlers (database obj) + (unless (has-been-prepared obj) + (cl-postgres:prepare-query connection (prepared-name obj) (expression obj)) + (setf (has-been-prepared obj) T)) + (second (multiple-value-list (cl-postgres:exec-prepared connection (prepared-name obj) (parameters obj))))))) ;;;; Cursoring interface -- 2.34.1