fixed bug converting to boolean in db-mysql/mysql-sql.lisp - from github user Sectoid
[clsql.git] / tests / test-internal.lisp
index adfab8a3acebfa9998638182c6a9090b218ec903..8ee2b031c6df7986a63d89a2125bd915c1167309 100644 (file)
@@ -15,6 +15,7 @@
 ;;;; *************************************************************************
 
 (in-package #:clsql-tests)
+(clsql-sys:file-enable-sql-reader-syntax)
 
 (setq *rt-internal*
   '(
         (clsql-sys::prepared-sql-to-postgresql-sql "SELECT 'FOO' FROM BAR WHERE ID='Match?''?' AND CODE=?")
       "SELECT 'FOO' FROM BAR WHERE ID='Match?''?' AND CODE=$1")
 
+    (deftest :int/output-caching/1
+     ;; ensure that key generation and matching is working
+     ;; so that this table doesnt balloon (more than designed)
+     (list
+      (progn (clsql:sql [foo])
+             (clsql:sql [foo])
+             (hash-table-count clsql-sys::*output-hash*))
+
+      (progn (clsql:sql [foo.bar])
+             (clsql:sql [foo bar])
+             (hash-table-count clsql-sys::*output-hash*))
+      (progn (clsql:sql (clsql-sys:sql-expression
+                         :table (clsql-sys::database-identifier 'foo)
+                         :attribute (clsql-sys::database-identifier 'bar)))
+             (clsql:sql (clsql-sys:sql-expression
+                         :table (clsql-sys::database-identifier 'foo)
+                         :attribute (clsql-sys::database-identifier 'bar)))
+             (hash-table-count clsql-sys::*output-hash*)))
+     (1 2 2))
+
+    (deftest :int/output-caching/2
+     ;; ensure that we can disable the output cache and
+     ;; still have everything work
+     (let ((clsql-sys::*output-hash*))
+       (list (clsql:sql [foo]) (clsql:sql [foo]) (clsql:sql [foo.bar])))
+     ("FOO" "FOO" "FOO.BAR"))
+
     ))