Stas Boukarev <stass...@gmail.com> writes:

> Stas Boukarev <stass...@gmail.com> writes:
>
>> According  to
>> http://www.postgresql.org/docs/current/static/arrays.html#ARRAYS-INPUT
>> arrays should look like '{ val1 delim val2 delim ... }', but cl-postgres
>> sends them as {val1 ...}, the attached patch corrects this.

Aw, now I hit C-x C-w in the wrong buffer, that's what you  get for
being in a hurry.
Sorry for the noise, here's the patch for real.
diff --git a/cl-postgres/sql-string.lisp b/cl-postgres/sql-string.lisp
index 7555cc9..d884444 100644
--- a/cl-postgres/sql-string.lisp
+++ b/cl-postgres/sql-string.lisp
@@ -55,12 +55,12 @@ whether the string should be escaped before being put into a query.")
     (if (typep arg '(vector (unsigned-byte 8)))
         (values (escape-bytes arg) t)
         (with-output-to-string (out)
-          (write-char #\{ out)
+          (write-string "'{" out)
           (loop :for sep := "" :then #\, :for x :across arg :do
              (princ sep out)
              (multiple-value-bind (string escape) (to-sql-string x)
                (if escape (write-quoted string out) (write-string string out))))
-          (write-char #\} out))))
+          (write-string "}'" out))))
   (:method ((arg array))
     (with-output-to-string (out)
       (labels ((recur (dims off)
@@ -75,7 +75,9 @@ whether the string should be escaped before being put into a query.")
                         (multiple-value-bind (string escape) (to-sql-string (row-major-aref arg i))
                           (if escape (write-quoted string out) (write-string string out)))))
                  (write-char #\} out)))
-          (recur (array-dimensions arg) 0))))
+        (write-char #\' out)
+        (recur (array-dimensions arg) 0)
+        (write-char #\' out))))
   (:method ((arg integer))
     (princ-to-string arg))
   (:method ((arg float))
-- 
With Best Regards, Stas.
_______________________________________________
postmodern-devel mailing list
postmodern-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel

Reply via email to