From 4d1a3100285889c84e63f8f4500dbd4b6c1f8ddc Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Sat, 1 May 2004 11:41:32 +0000 Subject: [PATCH] r9188: make result-types :auto the default --- ChangeLog | 9 ++++++++- TODO | 3 +-- base/basic-sql.lisp | 2 +- debian/changelog | 2 +- tests/test-fdml.lisp | 16 ++++++++++++++-- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index a3593e8..25a2fd0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 30 Apr 2004 Kevin Rosenberg (kevin@rosenberg.net) - * Version 2.10.0: New API function: CACHE-TABLE-QUERIES. + * Version 2.10.2 + * base/basic-sql.lisp: Set default value of :result-types + to :auto for more CommonSQL conformance. + * test/test-fdml.lisp: Add tests for numeric value of fields + + +30 Apr 2004 Kevin Rosenberg (kevin@rosenberg.net) + * Version 2.10.1: New API function: CACHE-TABLE-QUERIES. * base/basic-sql.lisp, db-*/*-sql.lisp: More CommonSQL conformance. Return field names as second value for QUERY. This can be overridden for efficiency with the new keyword :FIELD-NAMES set to NIL diff --git a/TODO b/TODO index 9d5e76d..4b160e5 100644 --- a/TODO +++ b/TODO @@ -26,8 +26,7 @@ COMMONSQL SPEC QUERY o should coerce values returned as strings to appropriate lisp type - (except for SQLite interface, this works when :result-types is :auto). - Perhaps that should be the default? + for SQLite backend >> The object-oriented sql interface diff --git a/base/basic-sql.lisp b/base/basic-sql.lisp index 055e33a..bf8ef80 100644 --- a/base/basic-sql.lisp +++ b/base/basic-sql.lisp @@ -30,7 +30,7 @@ one result per row. Returns a list of lists of values of the result of that expression and a list of field names selected in sql-exp.")) (defmethod query ((query-expression string) &key (database *default-database*) - (result-types nil) (flatp nil) (field-names t)) + (result-types :auto) (flatp nil) (field-names t)) (record-sql-action query-expression :query database) (multiple-value-bind (rows names) (database-query query-expression database result-types field-names) diff --git a/debian/changelog b/debian/changelog index 57f9b33..acbd8ac 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -cl-sql (2.10.1-1) unstable; urgency=low +cl-sql (2.10.2-1) unstable; urgency=low * New upstream diff --git a/tests/test-fdml.lisp b/tests/test-fdml.lisp index 8d87097..f3b9d13 100644 --- a/tests/test-fdml.lisp +++ b/tests/test-fdml.lisp @@ -128,9 +128,13 @@ (("Vladamir" "Lenin" "lenin@soviet.org"))) +;; Computed values are not always classified as numeric by psqlodbc (deftest :fdml/query/1 - (clsql:query "SELECT COUNT(*) FROM EMPLOYEE WHERE (EMAIL LIKE '%org')" :field-names nil) - (("10"))) + (let ((count (caar (clsql:query "SELECT COUNT(*) FROM EMPLOYEE WHERE (EMAIL LIKE '%org')" :field-names nil)))) + (if (stringp count) + (nth-value 0 (parse-integer count)) + count)) + 10) (deftest :fdml/query/2 (multiple-value-bind (rows field-names) @@ -141,6 +145,14 @@ ("Josef" "Stalin") ("Leon" "Trotsky")) ("FIRST_NAME" "LAST_NAME")) +(deftest :fdml/query/3 + (caar (clsql:query "SELECT EMPLID FROM EMPLOYEE WHERE LAST_NAME = 'Andropov'" :field-names nil)) + 6) + +(deftest :fdml/query/4 + (typep (caar (clsql:query "SELECT HEIGHT FROM EMPLOYEE WHERE LAST_NAME = 'Andropov'" :field-names nil)) + 'float) + t) (deftest :fdml/execute-command/1 (values -- 2.34.1