Adding some tests for sending large strings to and from the database.
authorNathan Bird <nathan@acceleration.net>
Wed, 3 Feb 2010 21:09:02 +0000 (16:09 -0500)
committerNathan Bird <nathan@acceleration.net>
Wed, 3 Feb 2010 21:09:42 +0000 (16:09 -0500)
tests/datasets.lisp
tests/test-basic.lisp

index 0d60e97022abfae8cfdcdfa7ffb66fdf97f569a3..1e922411966152eb0deb561148b78ede01695912 100644 (file)
@@ -20,6 +20,7 @@ should we debug (T) or just print and quit.")
   (when (and *dataset-debug-on-error*
             *debugger-hook*)
     (invoke-debugger e))
   (when (and *dataset-debug-on-error*
             *debugger-hook*)
     (invoke-debugger e))
+  (fresh-line *error-output*)
   (princ e *error-output*)
   (throw 'quit-dataset e))
 
   (princ e *error-output*)
   (throw 'quit-dataset e))
 
index 03ed1e1c4b03e9a2093aa1fb0dc25d7af4821115..98e986119fae8c6495caadc55d73ba3b00b4e87b 100644 (file)
                      results)))))
       ((t t) (t t) (t t) (t t) (t t) (t t) (t t) (t t) (t t) (t t) (t t)))
 
                      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/bigtext/1
+       (with-dataset *ds-bigtext*
+         (let* ((len 7499)
+                (str (make-string len :initial-element #\a))
+                (cmd (format nil "INSERT INTO testbigtext (a) VALUES ('~a')" str)))
+           (execute-command cmd)
+           (let ((a (first (query "SELECT a from testbigtext"
+                                  :flatp t :field-names nil))))
+             (assert (string= str a) (str a)
+                     "mismatch on a. inserted: ~a returned: ~a" len (length a)))
+           ))
+      nil)
+    (deftest :basic/bigtext/2
+       (dotimes (n 10)
+         (with-dataset *ds-bigtext*
+           (let* ((len (random 7500))
+                  (str (make-string len :initial-element #\a))
+                  (cmd (format nil "INSERT INTO testbigtext (a) VALUES ('~a')" str)))
+             (execute-command cmd)
+             (let ((a (first (query "SELECT a from testbigtext"
+                                    :flatp t :field-names nil))))
+               (assert (string= str a) (str a)
+                       "mismatch on a. inserted: ~a returned: ~a" len (length a)))
+             )))
+      nil)
+
     ))
 
 
     ))
 
 
        (if (> diff (* 10 double-float-epsilon))
            nil
            t))))
        (if (> diff (* 10 double-float-epsilon))
            nil
            t))))
+
+(def-dataset *ds-bigtext*
+  (:setup "CREATE TABLE testbigtext(a varchar(7500))")
+  (:cleanup "DROP TABLE testbigtext"))