* base/basic-sql.lisp: Make :AUTO the default value for
:RESULT-TYPES for MAP-QUERY and DO-QUERY.
* sql/objects.lisp: Add bigint type
- * base/loop.lisp: Add placeholder (and warning) for object iteration
- * TODO: Need results for result-types for map-query and do-query
+ * base/loop.lisp: Add placeholder for object iteration
+ * test/tests-basic.lisp: Add tests for :result-types for
+ MAP-QUERY and DO-QUERY
4 May 2004 Marcus Pearce (m.t.pearce@city.ac.uk)
* Version 2.10.9
* Large object testing
* Test bigint type
* :db-constraint tests
-* Test result-types for MAP-QUERY and DO-QUERY
COMMONSQL SPEC
(setq from-phrase '(clsql-base:*default-database*)))
(cond
;; Object query resulting in a list of returned object instances
- ((consp in-phrase)
- (error "object query not yet supported"))
+ #+ignore
+ ((consp (car in-phrase))
+ (ansi-loop::loop-error "object query not yet supported"))
((consp variable)
(let ((query-var (ansi-loop::loop-gentemp 'loop-record-))
(cond
;; Object query resulting in a list of returned object instances
- ((consp in-phrase)
+ #+ignore
+ ((consp (car in-phrase))
(error "Object query not yet supported."))
((consp iter-var)
(parse-double (second (nth i rows)))))
results)))
((t 4 t t) (t 4 t t) (t 4 t t) (t 4 t t) (t 4 t t) (t 4 t t) (t 4 t t) (t 4 t t) (t 4 t t) (t 4 t t) (t 4 t t)))
+
+ (deftest :BASIC/MAP/3
+ (let ((results '())
+ (rows (map-query 'list #'list "select * from TYPE_TABLE"
+ :result-types :auto)))
+ (dotimes (i (length rows) results)
+ (push
+ (list
+ (listp (nth i rows))
+ (length (nth i rows))
+ (eql (- i 5)
+ (first (nth i rows)))
+ (double-float-equal
+ (transform-float-1 (first (nth i rows)))
+ (second (nth i rows))))
+ results)))
+ ((t 4 t t) (t 4 t t) (t 4 t t) (t 4 t t) (t 4 t t) (t 4 t t) (t 4 t t) (t 4 t t) (t 4 t t) (t 4 t t) (t 4 t t)))
(deftest :BASIC/DO/1
(let ((results '()))
- (do-query ((int float bigint str) "select * from TYPE_TABLE")
+ (do-query ((int float bigint str) "select * from TYPE_TABLE" :result-types nil)
(push (list (double-float-equal
(transform-float-1 (parse-integer int))
(parse-double float))
results))
results)
((t t) (t t) (t t) (t t) (t t) (t t) (t t) (t t) (t t) (t t) (t t)))
+
+ (deftest :BASIC/DO/2
+ (let ((results '()))
+ (do-query ((int float bigint str) "select * from TYPE_TABLE" :result-types :auto)
+ (push (list (double-float-equal
+ (transform-float-1 int)
+ float)
+ (double-float-equal
+ (parse-double str)
+ float))
+ results))
+ results)
+ ((t t) (t t) (t t) (t t) (t t) (t t) (t t) (t t) (t t) (t t) (t t)))
))