X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tests%2Ftest-syntax.lisp;h=c910448dcadd420016a9717a7aaf817cc533daa8;hb=85508ad5c4abbd8e3f7549c8c13210e7f6642af5;hp=9bd666247ff860a86def758c4b4a6a528bd51364;hpb=4fa0aba28de88bf4db5e979152d90e01f8a365f2;p=clsql.git diff --git a/tests/test-syntax.lisp b/tests/test-syntax.lisp index 9bd6662..c910448 100644 --- a/tests/test-syntax.lisp +++ b/tests/test-syntax.lisp @@ -417,9 +417,33 @@ [like (clsql:sql-expression :table table :attribute 'baz) (clsql:sql table)]))) - "(BETWEEN(THISTIME.BAR,(HIP * HOP),42) AND (THISTIME.BAZ LIKE 'THISTIME') AND BETWEEN(NEXTTIME.BAR,(HIP * HOP),43) AND (NEXTTIME.BAZ LIKE 'NEXTTIME') AND BETWEEN(SOMETIME.BAR,(HIP * HOP),44) AND (SOMETIME.BAZ LIKE 'SOMETIME') AND BETWEEN(NEVER.BAR,(HIP * HOP),45) AND (NEVER.BAZ LIKE 'NEVER'))") - -)) + "(BETWEEN(THISTIME.BAR,(HIP * HOP),42) AND (THISTIME.BAZ LIKE 'THISTIME') AND BETWEEN(NEXTTIME.BAR,(HIP * HOP),43) AND (NEXTTIME.BAZ LIKE 'NEXTTIME') AND BETWEEN(SOMETIME.BAR,(HIP * HOP),44) AND (SOMETIME.BAZ LIKE 'SOMETIME') AND BETWEEN(NEVER.BAR,(HIP * HOP),45) AND (NEVER.BAZ LIKE 'NEVER'))" + ) + +(deftest :syntax/subqueries/query + (clsql:sql + (clsql:sql-operation 'select [*] + :from [foo] + :where [in [id] [select [id] :from [bar]]])) + "SELECT * FROM FOO WHERE (ID IN (SELECT ID FROM BAR))") + +(deftest :syntax/subqueries/delete + (clsql:sql + (make-instance 'clsql-sys::sql-delete + :from [foo] + :where [in [id] [select [id] :from [bar]]])) + "DELETE FROM FOO WHERE (ID IN (SELECT ID FROM BAR))") + +(deftest :syntax/subqueries/update + (clsql:sql + (make-instance 'clsql-sys::sql-update + :attributes (list [id]) + :values '(0) + :table [foo] + :where [in [id] [select [id] :from [bar]]])) + "UPDATE FOO SET ID = 0 WHERE (ID IN (SELECT ID FROM BAR))") + + )) (defun test-output-sql/sql-ident-table () (let ((tests `((,(make-instance 'sql-ident-table :name :foo) "FOO")