From: Nathan Bird Date: Wed, 3 Feb 2010 21:09:02 +0000 (-0500) Subject: Adding some tests for sending large strings to and from the database. X-Git-Tag: v5.0.0~20 X-Git-Url: http://git.kpe.io/?p=clsql.git;a=commitdiff_plain;h=f8a3685cf1911b090510f22eaa0734fb16d3fdb2 Adding some tests for sending large strings to and from the database. --- diff --git a/tests/datasets.lisp b/tests/datasets.lisp index 0d60e97..1e92241 100644 --- a/tests/datasets.lisp +++ b/tests/datasets.lisp @@ -20,6 +20,7 @@ should we debug (T) or just print and quit.") (when (and *dataset-debug-on-error* *debugger-hook*) (invoke-debugger e)) + (fresh-line *error-output*) (princ e *error-output*) (throw 'quit-dataset e)) diff --git a/tests/test-basic.lisp b/tests/test-basic.lisp index 03ed1e1..98e9861 100644 --- a/tests/test-basic.lisp +++ b/tests/test-basic.lisp @@ -201,6 +201,33 @@ 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) + )) @@ -256,3 +283,7 @@ (if (> diff (* 10 double-float-epsilon)) nil t)))) + +(def-dataset *ds-bigtext* + (:setup "CREATE TABLE testbigtext(a varchar(7500))") + (:cleanup "DROP TABLE testbigtext"))