Fixed error in read-sql-value that was throwing no next-method errors
authorRuss Tyndall <russ@acceleration.net>
Mon, 23 Mar 2015 20:49:10 +0000 (16:49 -0400)
committerRuss Tyndall <russ@acceleration.net>
Mon, 23 Mar 2015 20:49:12 +0000 (16:49 -0400)
 * Changed read-sql-value to throw continuable
   sql-value-conversion-error

From the mailing list - thanks Mariano Montone

LATEST-TEST-RESULTS
sql/conditions.lisp
sql/oodml.lisp
tests/test-init.lisp
tests/test-oodml.lisp

index 91103fb51177d24570dd1822c910cfced4137882..72725ce9d9e32d178e8a651e7fa6b7330babf137 100644 (file)
@@ -1,4 +1,4 @@
-Note from Russ Tyndall <russ@acceleration.net> 2013-01-30 :
+Note from Russ Tyndall <russ@acceleration.net> 2015-03-23 :
 
 This is the current results of running the test suite against all the database
 backends I have accessible, on SBCL / UBUNTU64bit.  It would be great to
 
 This is the current results of running the test suite against all the database
 backends I have accessible, on SBCL / UBUNTU64bit.  It would be great to
@@ -7,20 +7,24 @@ tests so that all pass.  In the interim, I would like know that I am not
 increasing the number of failing tests
 
 :mysql
 increasing the number of failing tests
 
 :mysql
-1 out of 301 total tests failed: :FDDL/CACHE-TABLE-QUERIES/1.
+No tests failed.
+18 of 310 Tests skipped
 
 :odbc MSSQL2000/5
 
 :odbc MSSQL2000/5
-1 out of 298 total tests failed: :FDDL/CACHE-TABLE-QUERIES/1.
+No tests failed.
+22 of 306 Tests skipped:
 
 :odbc postgres
 
 :odbc postgres
-2 out of 311 total tests failed: :FDML/SELECT/36, :FDDL/CACHE-TABLE-QUERIES/1.
+*couldnt get them to run - foreign lib problems*
 
 :postgres-socket :postgres-socket-3
 
 :postgres-socket :postgres-socket-3
-5 out of 300 total tests failed: :TIME/PG/OODML/USEC, :TIME/PG/OODML/NO-USEC, 
-   :TIME/PG/FDML/USEC, :FDML/SELECT/36, :FDDL/CACHE-TABLE-QUERIES/1.
+4 out of 308 total tests failed: :TIME/PG/OODML/USEC, :TIME/PG/OODML/NO-USEC, 
+   :TIME/PG/FDML/USEC, :FDML/SELECT/36.
+20 of 308 Tests skipped:
 
 :sqlite3
 
 :sqlite3
-1 out of 300 total tests failed: :FDDL/INDEX/3.
+1 out of 308 total tests failed: :FDDL/INDEX/3.
+20 of 308 Tests skipped:
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
index 1969b962ae28728e565ea2d6a11fd03f04c49acc..e19805248bd5e6f9601a98db29a3e76157741238 100644 (file)
@@ -151,8 +151,9 @@ connection is no longer usable."))
 
 (defun error-converting-value (val type &optional (database *default-database*))
   (restart-case 
 
 (defun error-converting-value (val type &optional (database *default-database*))
   (restart-case 
-      (error 'sql-value-conversion-error
-             :expected-type type :value val :database database)
+      (error (make-condition
+              'sql-value-conversion-error
+              :expected-type type :value val :database database))
     (continue ()
       :report "Continue using the unconverted value"
       (values val t))
     (continue ()
       :report "Continue using the unconverted value"
       (values val t))
index 169fa89d70d6f0fe17e834749e9a27f337cfe2f8..5a966e7abd554a2bf811a021e792ea7960575222 100644 (file)
               (number (not (zerop val))))))
        ((wall-time duration) (parse-timestring val))
        (date (parse-datestring val))
               (number (not (zerop val))))))
        ((wall-time duration) (parse-timestring val))
        (date (parse-datestring val))
-       (t (call-next-method))))
+       (list (let ((*read-eval* nil))
+               (read-from-string val)))
+       (t (error-converting-value val type database))))
     (t (typecase val
     (t (typecase val
-         (string (read-from-string val))
+         (string
+          (let ((*read-eval* nil))
+            (read-from-string val)))
          (t (error-converting-value val type database))))))
 
 ;; ------------------------------------------------------------
          (t (error-converting-value val type database))))))
 
 ;; ------------------------------------------------------------
index d1de92e94668eda0afacc5dc61e6148c2a2472af..8312784216c8fd84f50f4575f255bab0de691363 100644 (file)
 
          (%do-tests test-forms db-type)
 
 
          (%do-tests test-forms db-type)
 
-           (format *report-stream* "~&Tests skipped:")
+         (format *report-stream* "~&~D of ~D Tests skipped:"
+                 (length skip-tests)
+                 (length test-forms))
            (if skip-tests
                (let ((max-test-name (length (symbol-name (caar skip-tests)))))
                  (dolist (skipped (cdr skip-tests))
            (if skip-tests
                (let ((max-test-name (length (symbol-name (caar skip-tests)))))
                  (dolist (skipped (cdr skip-tests))
index 042fd48b6d71bb39cf8cb720ad60ae159dc76d85..6278d73cd64e40f78bd2ef415072328127a3b69f 100644 (file)
 
 (clsql-sys:file-enable-sql-reader-syntax)
 
 
 (clsql-sys:file-enable-sql-reader-syntax)
 
+(defmacro has-sql-value-conversion-error (() &body body)
+  `(let (*debugger-hook*)
+    (handler-case
+        (progn ,@body nil)
+      (clsql-sys::sql-value-conversion-error (c)
+        (declare (ignore c))
+        t))))
 
 (setq *rt-oodml*
       '(
 
 (setq *rt-oodml*
       '(
  :foo)
 
 (deftest :oodml/read-symbol-value/4-keyword-error
  :foo)
 
 (deftest :oodml/read-symbol-value/4-keyword-error
- (handler-case
-     (clsql-sys::read-sql-value
-      (clsql-sys::database-output-sql-as-type 'keyword 'foo nil nil)
-      'keyword nil nil)
-   (clsql-sys::sql-value-conversion-error (c) (declare (ignore c))
-     :error))
- :error)
+ (has-sql-value-conversion-error ()
+   (clsql-sys::read-sql-value
+    (clsql-sys::database-output-sql-as-type 'keyword 'foo nil nil)
+    'keyword nil nil))
+ T)
+
+(deftest :oodml/read-symbol-value/5-unknown-type-error-1
+ (has-sql-value-conversion-error ()
+   (clsql-sys::read-sql-value
+    (clsql-sys::database-output-sql-as-type 'bloop 'foo nil nil)
+    'bloop nil nil))
+ t)
+
+(deftest :oodml/read-symbol-value/6-unknown-type-error-2
+ (has-sql-value-conversion-error ()
+   (clsql-sys::read-sql-value
+    (clsql-sys::database-output-sql-as-type 'bloop 'foo nil nil)
+    '(or integer float) nil nil))
+ t)
+
+(deftest :oodml/read-symbol-value/read-list
+ (clsql-sys::read-sql-value
+  (clsql-sys::database-output-sql-as-type
+   'list '(("status" "new" "open")) nil nil)
+  'list nil nil)
+ (("status" "new" "open")))
 
 (deftest :oodml/select/1
     (with-dataset *ds-employees*
 
 (deftest :oodml/select/1
     (with-dataset *ds-employees*