- (deftest :BASIC/TYPE/1
- (let ((results '()))
- (dolist (row (query "select * from TYPE_TABLE" :result-types :auto)
- results)
- (destructuring-bind (int float str) row
- (push (list (integerp int)
- (typep float 'double-float)
- (stringp str))
- results))))
+ (deftest :basic/type/1
+ (let ((results '()))
+ (dolist (row (query "select * from TYPE_TABLE" :result-types :auto)
+ results)
+ (destructuring-bind (int float str) row
+ (push (list (integerp int)
+ (typep float 'double-float)
+ (stringp str))
+ results))))
- (deftest :BASIC/TYPE/2
- (let ((results '()))
- (dolist (row (query "select * from TYPE_TABLE" :result-types :auto)
- results)
- (destructuring-bind (int float str) row
- (setq results
- (cons (list (double-float-equal
- (transform-float-1 int)
- float)
- (double-float-equal
- (parse-double str)
- float))
- results))))
- results)
+ (deftest :basic/type/2
+ (let ((results '()))
+ (dolist (row (query "select * from TYPE_TABLE" :result-types :auto)
+ results)
+ (destructuring-bind (int float str) row
+ (setq results
+ (cons (list (double-float-equal
+ (transform-float-1 int)
+ float)
+ (double-float-equal
+ (parse-double str)
+ float))
+ results))))
+ results)
- (let ((results '()))
- (dolist (row (query "select * from TYPE_TABLE" :result-types nil)
- results)
- (destructuring-bind (int float str) row
- (push (list (stringp int)
- (stringp float)
- (stringp str))
- results))))
+ (let ((results '()))
+ (dolist (row (query "select * from TYPE_TABLE" :result-types nil)
+ results)
+ (destructuring-bind (int float str) row
+ (push (list (stringp int)
+ (stringp float)
+ (stringp str))
+ results))))
-
- (deftest :BASIC/SELECT/3
- (let ((results '()))
- (dolist (row (query "select * from TYPE_TABLE" :result-types nil)
- results)
- (destructuring-bind (int float str) row
- (push (list (double-float-equal
- (transform-float-1 (parse-integer int))
- (parse-double float))
- (double-float-equal
- (parse-double str)
- (parse-double float)))
- results))))
+
+ (deftest :basic/select/3
+ (let ((results '()))
+ (dolist (row (query "select * from TYPE_TABLE" :result-types nil)
+ results)
+ (destructuring-bind (int float str) row
+ (push (list (double-float-equal
+ (transform-float-1 (parse-integer int))
+ (parse-double float))
+ (double-float-equal
+ (parse-double str)
+ (parse-double float)))
+ results))))
- (deftest :BASIC/MAP/1
- (let ((results '())
- (rows (map-query 'vector #'identity "select * from TYPE_TABLE"
- :result-types nil)))
- (declare (type (simple-array list (*)) rows))
- (dotimes (i (length rows) results)
- (push
- (list
- (listp (aref rows i))
- (length (aref rows i))
- (eql (- i 5)
- (parse-integer (first (aref rows i))
- :junk-allowed nil))
- (double-float-equal
- (transform-float-1 (parse-integer (first (aref rows i))))
- (parse-double (second (aref rows i)))))
- results)))
+ (deftest :basic/map/1
+ (let ((results '())
+ (rows (map-query 'vector #'identity "select * from TYPE_TABLE"
+ :result-types nil)))
+ (declare (type (simple-array list (*)) rows))
+ (dotimes (i (length rows) results)
+ (push
+ (list
+ (listp (aref rows i))
+ (length (aref rows i))
+ (eql (- i 5)
+ (parse-integer (first (aref rows i))
+ :junk-allowed nil))
+ (double-float-equal
+ (transform-float-1 (parse-integer (first (aref rows i))))
+ (parse-double (second (aref rows i)))))
+ results)))
-
- (deftest :BASIC/MAP/2
- (let ((results '())
- (rows (map-query 'list #'identity "select * from TYPE_TABLE"
- :result-types nil)))
- (dotimes (i (length rows) results)
- (push
- (list
- (listp (nth i rows))
- (length (nth i rows))
- (eql (- i 5)
- (parse-integer (first (nth i rows))
- :junk-allowed nil))
- (double-float-equal
- (transform-float-1 (parse-integer (first (nth i rows))))
- (parse-double (second (nth i rows)))))
- results)))
+
+
+ (deftest :basic/map/2
+ (let ((results '())
+ (rows (map-query 'list #'identity "select * from TYPE_TABLE"
+ :result-types nil)))
+ (dotimes (i (length rows) results)
+ (push
+ (list
+ (listp (nth i rows))
+ (length (nth i rows))
+ (eql (- i 5)
+ (parse-integer (first (nth i rows))
+ :junk-allowed nil))
+ (double-float-equal
+ (transform-float-1 (parse-integer (first (nth i rows))))
+ (parse-double (second (nth i rows)))))
+ results)))
-
- (deftest :BASIC/MAP/3
- (let ((results '())
- (rows (map-query 'list #'identity "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)))
+
+ (deftest :basic/map/3
+ (let ((results '())
+ (rows (map-query 'list #'identity "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)))
- (deftest :BASIC/DO/1
- (let ((results '()))
- (do-query ((int float str) "select * from TYPE_TABLE" :result-types nil)
- (let ((int-number (parse-integer int)))
- (setq results
- (cons (list (double-float-equal (transform-float-1
- int-number)
- (parse-double float))
- (double-float-equal (parse-double str)
- (parse-double float)))
- results))))
- results)
+ ;; confirm that a query on a single element returns a list of one element
+ (deftest :basic/map/4
+ (let ((rows (map-query 'list #'identity "select t_int from TYPE_TABLE"
+ :result-types nil)))
+ (values
+ (consp (first rows))
+ (length (first rows))))
+ t 1)
+
+ (deftest :basic/do/1
+ (let ((results '()))
+ (do-query ((int float str) "select * from TYPE_TABLE" :result-types nil)
+ (let ((int-number (parse-integer int)))
+ (setq results
+ (cons (list (double-float-equal (transform-float-1
+ int-number)
+ (parse-double float))
+ (double-float-equal (parse-double str)
+ (parse-double float)))
+ results))))
+ results)
- (deftest :BASIC/DO/2
- (let ((results '()))
- (do-query ((int float str) "select * from TYPE_TABLE" :result-types :auto)
- (setq results
- (cons
- (list (double-float-equal
- (transform-float-1 int)
- float)
- (double-float-equal
- (parse-double str)
- float))
- results)))
- results)
+ (deftest :basic/do/2
+ (let ((results '()))
+ (do-query ((int float str) "select * from TYPE_TABLE" :result-types :auto)
+ (setq results
+ (cons
+ (list (double-float-equal
+ (transform-float-1 int)
+ float)
+ (double-float-equal
+ (parse-double str)
+ float))
+ results)))
+ results)
- (deftest :BASIC/BIGINT/1
- (let ((results '()))
- (dolist (row (query "select * from TYPE_BIGINT" :result-types :auto)
- results)
- (destructuring-bind (int bigint) row
- (push (list (integerp int)
- (if (and (eq :odbc *test-database-type*)
- (eq :postgresql *test-database-underlying-type*))
- ;; ODBC/Postgresql may return returns bigints as strings or integer
- ;; depending upon the platform
- t
- (integerp bigint)))
- results))))
+ (deftest :basic/bigint/1
+ (let ((results '()))
+ (dolist (row (query "select * from TYPE_BIGINT" :result-types :auto)
+ results)
+ (destructuring-bind (int bigint) row
+ (push (list (integerp int)
+ (if (and (eq :odbc *test-database-type*)
+ (eq :postgresql *test-database-underlying-type*))
+ ;; ODBC/Postgresql may return returns bigints as strings or integer
+ ;; depending upon the platform
+ t
+ (integerp bigint)))
+ results))))
"CREATE TABLE TYPE_TABLE (t_int integer, t_float double precision, t_str VARCHAR(30))")
(if (clsql-sys:db-type-has-bigint? *test-database-type*)
"CREATE TABLE TYPE_TABLE (t_int integer, t_float double precision, t_str VARCHAR(30))")
(if (clsql-sys:db-type-has-bigint? *test-database-type*)
- test-int
- (clsql-sys:number-to-sql-string test-flt)
- (clsql-sys:number-to-sql-string test-flt)
- ))
- (clsql:execute-command
- (format nil "INSERT INTO TYPE_BIGINT VALUES (~a,~a)"
- test-int
- (transform-bigint-1 test-int)
- )))))
+ test-int
+ (clsql-sys:number-to-sql-string test-flt)
+ (clsql-sys:number-to-sql-string test-flt)
+ ))
+ (when (clsql-sys:db-type-has-bigint? *test-database-type*)
+ (clsql:execute-command
+ (format nil "INSERT INTO TYPE_BIGINT VALUES (~a,~a)"
+ test-int
+ (transform-bigint-1 test-int)
+ ))))))