From f8a3685cf1911b090510f22eaa0734fb16d3fdb2 Mon Sep 17 00:00:00 2001 From: Nathan Bird Date: Wed, 3 Feb 2010 16:09:02 -0500 Subject: [PATCH] Adding some tests for sending large strings to and from the database. --- tests/datasets.lisp | 1 + tests/test-basic.lisp | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) 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")) -- 2.34.1