Update of /project/pg/cvsroot/pg In directory common-lisp.net:/tmp/cvs-serv32538
Modified Files: parsers.lisp sysdep.lisp v3-protocol.lisp Log Message: Three fixes from Björn Lindberg d95-bli@nada.kth.se:
- Two trivial bugs with regards to use with Allegro
- Handling of the special timestamp values infinity and -infinity. They gave an error, but now returns the symbols :INFINITY and :-INFINITY respectively.
- A bug in the version 3 of the protocol, where it would return NIL for fields in the database containing the empty string, rather than an empty string.
Date: Sun Jul 17 15:46:50 2005 Author: emarsden
Index: pg/parsers.lisp diff -u pg/parsers.lisp:1.6 pg/parsers.lisp:1.7 --- pg/parsers.lisp:1.6 Tue Sep 7 14:52:19 2004 +++ pg/parsers.lisp Sun Jul 17 15:46:50 2005 @@ -170,9 +170,14 @@ ;; for a fix for timestamp format in PostgreSQL 7.3 (with or without ;; tz, with or without milliseconds). (defun timestamp-parser (str) - (multiple-value-bind (year month day hours minutes seconds) - (parse-timestamp str) - (encode-universal-time seconds minutes hours day month year))) + ;; Test for the special values 'infinity' and '-infinity' + (cond ((digit-char-p (schar str 0)) + (multiple-value-bind (year month day hours minutes seconds) + (parse-timestamp str) + (encode-universal-time seconds minutes hours day month year))) + ((equal str "infinity") :infinity) + ((equal str "-infinity") :-infinity) + (t (error "Unknown special timestamp value ~A" str))))
(defun precise-timestamp-parser (str) (multiple-value-bind (year month day hours minutes seconds milliseconds)
Index: pg/sysdep.lisp diff -u pg/sysdep.lisp:1.7 pg/sysdep.lisp:1.8 --- pg/sysdep.lisp:1.7 Wed May 4 22:51:35 2005 +++ pg/sysdep.lisp Sun Jul 17 15:46:50 2005 @@ -1,7 +1,7 @@ ;;; sysdep.lisp -- system-dependent parts of pg-dot-lisp ;;; ;;; Author: Eric Marsden emarsden@laas.fr -;;; Time-stamp: <2004-04-23 emarsden> +;;; Time-stamp: <2005-07-17 emarsden> ;; ;;
@@ -261,7 +261,6 @@ end)
-;; there seems to be a bug in ECL's binary socket streams; data is corrupted #+ecl (defun socket-connect (port host) (declare (type integer port)) @@ -320,8 +319,9 @@ (%sysdep "convert string to bytes" #+(and clisp unicode) (ext:convert-string-to-bytes string encoding) - #+(and acl ics) - (excl:string-to-octets string :external-format encoding) + #+(and allegro ics) + (excl:string-to-octets string :null-terminate nil + :external-format encoding) #+(and :sbcl :sb-unicode) (sb-ext:string-to-octets string :external-format (sbcl-ext-form-from-client-encoding encoding)) #+(or cmu sbcl gcl ecl) @@ -333,8 +333,8 @@ (%sysdep "convert octet-array to string" #+(and clisp unicode) (ext:convert-string-from-bytes bytes encoding) - #+(and acl ics) - (ext:octets-to-string bytes :external-format encoding) + #+(and allegro ics) + (excl:octets-to-string bytes :external-format encoding) #+(and :sbcl :sb-unicode) (sb-ext:octets-to-string bytes :external-format encoding) ;; for implementations that have no support for character
Index: pg/v3-protocol.lisp diff -u pg/v3-protocol.lisp:1.15 pg/v3-protocol.lisp:1.16 --- pg/v3-protocol.lisp:1.15 Mon Sep 20 00:32:33 2004 +++ pg/v3-protocol.lisp Sun Jul 17 15:46:50 2005 @@ -270,8 +270,6 @@ "Reads a string of LENGTH characters from the packet") (:method ((packet pg-packet) (length (eql -1))) nil) - (:method ((packet pg-packet) (length (eql 0))) - nil) (:method ((packet pg-packet) (length integer)) (when (< length 0) (error "length cannot be negative. is: ~S"