[pg-devel] pg-close-statement error

Anton ya007 at yandex.ru
Tue Sep 12 03:56:45 UTC 2006


File v3-protocol.lisp. Following function:

	(defmethod pg-close-statement ((connection pgcon-v3) (statement-name
string))
	    (pg-close connection statement-name #\s))

contains an error - lower case 's'. This doesn't work, PostgreSQL swars
"invalid CLOSE message subtype 115". With upper case 'S' all workds fine.

Right version:

(defmethod pg-close-statement ((connection pgcon-v3) (statement-name
string))
    (pg-close connection statement-name #\S))


Also, it would be good to have sligtly more documentation about how to use
prepared statements.
I suggest following:

1) More detailed comment for pg-close-statement in the pg.lisp:

(defgeneric pg-close-statement (connection statement-name)
  (:documentation
   "Closes prepared statement specified by statement-name;
also closes all portals associated with that statement. (see pg-prepare,
pg-bind)"))


2) Place an example, like the following one, into README or into separate
file with examples.

(defun delete-item (db-connection int-value string-value)
  (pg-prepare db-connection "delete-statement"
		  "DELETE FROM items WHERE int_column = $1 AND string_column = $2"
		  `("int4" "varchar"))
  (unwind-protect
       (progn (pg-bind db-connection "delete-portal" "delete-statement"
		       `((:int32 ,int-value) (:string ,string-value)))

	      (pg-execute db-connection "delete-portal"))

    ;; Note, portal is closed automatically
    ;; when statement is closed.
    (pg-close-statement db-connection "select-statement")))


All code is tested.

Regards,
-Anton




More information about the pg-devel mailing list