diff -Nru cl-sql-6.0.1/ChangeLog cl-sql-6.1.1/ChangeLog --- cl-sql-6.0.1/ChangeLog 2011-09-21 16:55:32.000000000 +0000 +++ cl-sql-6.1.1/ChangeLog 2011-12-21 02:59:19.000000000 +0000 @@ -1,3 +1,28 @@ +2011-12-20 Kevin Rosenberg + * Version 6.1.1 + * db-oracle/oracle.lisp: Typo correction (Elias Martenson) + +2011-12-19 Kevin Rosenberg + * Version 6.1.0 + * db-oracle/oracle.lisp: Change length function to + uffi:foreign-string-length to handle foreign encodings. + Thanks to Elias Martenson. + +2011-11-28 Russ Tyndall + * db-odbc/odbc-api.lisp, tests/test-time.lisp + + In ODBC backend, avoid going through the common lisp + universal-time type (because it lacks support for historic dates) + + *time-conversion-function* renamed to *time-format* + + Patch from: Francisco Vides Fernandez + +2011-10-18 Russ Tyndall + * db-odbc/odbc-api.lisp + + Added type specifier so MSSQL nvarchar fields can make it through + 2011-09-12 Russ Tyndall * sql/fddl.lisp sql/generic-postgres.lisp db-mysql/mysql-sql.lisp sql/generic-odbc.lisp sql/odbc-api.lisp sql/odbc-dbi.lisp diff -Nru cl-sql-6.0.1/db-odbc/odbc-api.lisp cl-sql-6.1.1/db-odbc/odbc-api.lisp --- cl-sql-6.0.1/db-odbc/odbc-api.lisp 2011-09-21 16:55:32.000000000 +0000 +++ cl-sql-6.1.1/db-odbc/odbc-api.lisp 2011-12-19 17:12:37.000000000 +0000 @@ -22,17 +22,12 @@ (defvar *binary-format* :unsigned-byte-vector) -(defvar *time-conversion-function* - (lambda (universal-time &optional fraction) - (let ((time (clsql-sys:utime->time universal-time))) - (setf time (clsql-sys:time+ - time - (clsql-sys:make-duration :usec (/ fraction 1000)))) - (clsql-sys:format-time nil time :format :iso)) - #+ignore - universal-time) - "Bound to a function that converts from a Lisp universal time fixnum (and a fractional -as possible second argument) to the desired representation of date/time/timestamp. By default, returns an iso-timestring.") +(defvar *time-format* + (lambda (time) + (clsql-sys:format-time nil time :format :iso)) + "Bound to a function that converts from a clsql:wall-time to the desired + representation of date/time/timestamp. + By default, returns an iso-timestring.") (defvar +null-ptr+ (make-null-pointer :byte)) (defparameter +null-handle-ptr+ (make-null-pointer :void)) @@ -586,8 +581,9 @@ (defun sql-to-c-type (sql-type) (ecase sql-type + ;; Added -10 for MSSQL ntext type and -11 for nvarchar ((#.$SQL_CHAR #.$SQL_VARCHAR #.$SQL_LONGVARCHAR - #.$SQL_NUMERIC #.$SQL_DECIMAL -8 -9 -10) $SQL_C_CHAR) ;; Added -10 for MSSQL ntext type + #.$SQL_NUMERIC #.$sql_decimal -8 -9 -10 -11) $SQL_C_CHAR) (#.$SQL_INTEGER $SQL_C_SLONG) (#.$SQL_BIGINT $SQL_C_SBIGINT) (#.$SQL_SMALLINT $SQL_C_SSHORT) @@ -689,13 +685,11 @@ (t (case c-type ((#.$SQL_C_DATE #.$SQL_C_TYPE_DATE) - (funcall *time-conversion-function* (date-to-universal-time data-ptr))) + (funcall *time-format* (date-to-clsql-time data-ptr))) ((#.$SQL_C_TIME #.$SQL_C_TYPE_TIME) - (multiple-value-bind (universal-time frac) (time-to-universal-time data-ptr) - (funcall *time-conversion-function* universal-time frac))) + (funcall *time-format* (time-to-clsql-time data-ptr))) ((#.$SQL_C_TIMESTAMP #.$SQL_C_TYPE_TIMESTAMP) - (multiple-value-bind (universal-time frac) (timestamp-to-universal-time data-ptr) - (funcall *time-conversion-function* universal-time frac))) + (funcall *time-format* (timestamp-to-clsql-time data-ptr))) (#.$SQL_INTEGER (get-cast-int data-ptr)) (#.$SQL_C_FLOAT @@ -946,17 +940,17 @@ (def-type c-time-ptr-type (* (:struct sql-c-time))) (def-type c-date-ptr-type (* (:struct sql-c-date))) -(defun timestamp-to-universal-time (ptr) +(defun timestamp-to-clsql-time (ptr) (declare (type c-timestamp-ptr-type ptr)) - (values - (encode-universal-time - (get-slot-value ptr 'sql-c-timestamp 'second) - (get-slot-value ptr 'sql-c-timestamp 'minute) - (get-slot-value ptr 'sql-c-timestamp 'hour) - (get-slot-value ptr 'sql-c-timestamp 'day) - (get-slot-value ptr 'sql-c-timestamp 'month) - (get-slot-value ptr 'sql-c-timestamp 'year)) - (get-slot-value ptr 'sql-c-timestamp 'fraction))) + (clsql-sys:make-time + :second (get-slot-value ptr 'sql-c-timestamp 'second) + :minute (get-slot-value ptr 'sql-c-timestamp 'minute) + :hour (get-slot-value ptr 'sql-c-timestamp 'hour) + :day (get-slot-value ptr 'sql-c-timestamp 'day) + :month (get-slot-value ptr 'sql-c-timestamp 'month) + :year (get-slot-value ptr 'sql-c-timestamp 'year) + :usec (let ((frac (get-slot-value ptr 'sql-c-timestamp 'fraction))) + (if frac (/ frac 1000) 0)))) (defun universal-time-to-timestamp (time &optional (fraction 0)) "TODO: Dead function?" @@ -986,21 +980,20 @@ (get-slot-value ptr 'sql-c-timestamp 'fraction) fraction) ptr)) -(defun date-to-universal-time (ptr) +(defun date-to-clsql-time (ptr) (declare (type c-date-ptr-type ptr)) - (encode-universal-time - 0 0 0 - (get-slot-value ptr 'sql-c-timestamp 'day) - (get-slot-value ptr 'sql-c-timestamp 'month) - (get-slot-value ptr 'sql-c-timestamp 'year))) + (clsql-sys:make-time + :second 0 :minute 0 :hour 0 + :day (get-slot-value ptr 'sql-c-timestamp 'day) + :month (get-slot-value ptr 'sql-c-timestamp 'month) + :year (get-slot-value ptr 'sql-c-timestamp 'year))) -(defun time-to-universal-time (ptr) +(defun time-to-clsql-time (ptr) (declare (type c-time-ptr-type ptr)) - (encode-universal-time - (get-slot-value ptr 'sql-c-timestamp 'second) - (get-slot-value ptr 'sql-c-timestamp 'minute) - (get-slot-value ptr 'sql-c-timestamp 'hour) - 1 1 0)) + (clsql-sys:make-time + :second (get-slot-value ptr 'sql-c-timestamp 'second) + :minute (get-slot-value ptr 'sql-c-timestamp 'minute) + :hour (get-slot-value ptr 'sql-c-timestamp 'hour))) ;;; Added by KMR diff -Nru cl-sql-6.0.1/db-odbc/odbc-package.lisp cl-sql-6.1.1/db-odbc/odbc-package.lisp --- cl-sql-6.0.1/db-odbc/odbc-package.lisp 2010-02-11 20:59:14.000000000 +0000 +++ cl-sql-6.1.1/db-odbc/odbc-package.lisp 2011-12-19 17:12:37.000000000 +0000 @@ -25,7 +25,7 @@ #:+null-ptr+ #:+max-precision+ #:*info-output* - #:*time-conversion-function* + #:*time-format* #:get-cast-long #:%free-statement #:%disconnect diff -Nru cl-sql-6.0.1/db-oracle/oracle-sql.lisp cl-sql-6.1.1/db-oracle/oracle-sql.lisp --- cl-sql-6.0.1/db-oracle/oracle-sql.lisp 2010-03-10 17:31:31.000000000 +0000 +++ cl-sql-6.1.1/db-oracle/oracle-sql.lisp 2011-12-21 02:58:07.000000000 +0000 @@ -514,7 +514,7 @@ (oci-stmt-prepare (deref-vp stmthp) (deref-vp errhp) c-stmt-string - (length sql-stmt-string) + (uffi:foreign-string-length c--stmt-string) +oci-ntv-syntax+ +oci-default+ :database db) (oci-attr-get (deref-vp stmthp) +oci-htype-stmt+ diff -Nru cl-sql-6.0.1/debian/changelog cl-sql-6.1.1/debian/changelog --- cl-sql-6.0.1/debian/changelog 2011-11-24 00:07:21.000000000 +0000 +++ cl-sql-6.1.1/debian/changelog 2011-12-21 02:58:34.000000000 +0000 @@ -1,8 +1,14 @@ -cl-sql (6.0.1-1build1) precise; urgency=low +cl-sql (6.1.1-1) unstable; urgency=low - * Rebuild for libmysqlclient transition + * New upstream + + -- Kevin M. Rosenberg Tue, 20 Dec 2011 19:58:29 -0700 + +cl-sql (6.1.0-1) unstable; urgency=low + + * New upstream - -- Clint Byrum Wed, 23 Nov 2011 16:07:14 -0800 + -- Kevin M. Rosenberg Mon, 19 Dec 2011 10:13:58 -0700 cl-sql (6.0.1-1) unstable; urgency=low diff -Nru cl-sql-6.0.1/sql/command-object.lisp cl-sql-6.1.1/sql/command-object.lisp --- cl-sql-6.0.1/sql/command-object.lisp 2011-08-02 20:19:42.000000000 +0000 +++ cl-sql-6.1.1/sql/command-object.lisp 2011-12-19 17:12:37.000000000 +0000 @@ -23,13 +23,16 @@ (in-package #:clsql-sys) (defclass command-object () - ((expression :accessor expression :initarg :expression :initform nil) - (parameters :accessor parameters :initarg :parameters :initform nil) + ((expression :accessor expression :initarg :expression :initform nil + :documentation "query that refers to parameters using \"$1\", \"$2\", \"$n\". + These match positions in the parameters list.") + (parameters :accessor parameters :initarg :parameters :initform nil + :documentation "list of parameters") (prepared-name :accessor prepared-name :initarg :prepared-name :initform "" :documentation "If we want this to be a prepared statement, give it a name to identify it to this session") (has-been-prepared :accessor has-been-prepared :initarg :has-been-prepared :initform nil - :documentation "Have we already prepared this command object") + :documentation "Have we already prepared this command object?") )) (defmethod initialize-instance :after ((o command-object) &key &allow-other-keys ) diff -Nru cl-sql-6.0.1/tests/test-time.lisp cl-sql-6.1.1/tests/test-time.lisp --- cl-sql-6.0.1/tests/test-time.lisp 2011-08-02 20:19:42.000000000 +0000 +++ cl-sql-6.1.1/tests/test-time.lisp 2011-12-19 17:12:37.000000000 +0000 @@ -437,7 +437,23 @@ #.(iso-timestring (parse-timestring "2008-09-09T14:37:29.000278-04:00")) #.(iso-timestring (parse-timestring "2008-09-09T14:37:29.000278-04:00"))) +(deftest :time/historic-datetimes + (with-dataset *cross-platform-datetest* + (let ((time (parse-timestring "1800-09-09T14:37:29"))) + (clsql-sys:insert-records :into [datetest] + :attributes '([testtime]) + :values (list time)) + (let ((testtime + (first (clsql:select [testtime] + :from [datetest] :flatp t + :where [= [testtime] time] )))) + (format-time nil (parse-timestring testtime) :format :iso) + ))) + #.(format-time nil (parse-timestring "1800-09-09T14:37:29") :format :iso)) + )) + +