X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=db-postgresql-socket3%2Fsql.lisp;h=e2515005cb5cda828bd910484cb89d7d94e8dba2;hb=1e8d22b3fdace44a45b6b0702da5587e136e2398;hp=8428d481f08a3d0570d652d9b17d00a1089c7c57;hpb=09a2bc41215abb9dd9c92db6cb70e04fa845f938;p=clsql.git diff --git a/db-postgresql-socket3/sql.lisp b/db-postgresql-socket3/sql.lisp index 8428d48..e251500 100644 --- a/db-postgresql-socket3/sql.lisp +++ b/db-postgresql-socket3/sql.lisp @@ -155,6 +155,10 @@ (cl-postgres:close-database (database-connection database)) t) +(defmethod clsql-sys::release-to-conn-pool :before ((conn postgresql-socket3-database)) + ;; This resets the connection to "New" state + (database-execute-command "DISCARD ALL;" conn)) + (defvar *include-field-names* nil) @@ -232,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