add `returning' to `clauses-order' to make it composable

master
Moritz Heidkamp 13 years ago
parent de54e9ed44
commit 33cf06740e

@ -8,7 +8,9 @@
(define *postgresql-translator* (define *postgresql-translator*
(let ((type->sql-converters (let ((type->sql-converters
`((,boolean? . boolean->sql) `((,boolean? . boolean->sql)
,@(*ansi-translator* 'type->sql-converters)))) ,@(*ansi-translator* 'type->sql-converters)))
(clauses-order (append (*ansi-translator* 'clauses-order)
'(returning))))
(derive-object (*ansi-translator*) (derive-object (*ansi-translator*)
((escape-string string) ((escape-string string)
@ -17,6 +19,8 @@
((boolean->sql boolean) ((boolean->sql boolean)
(if boolean "'t'" "'f'")) (if boolean "'t'" "'f'"))
((clauses-order) clauses-order)
((type->sql-converters) type->sql-converters)))) ((type->sql-converters) type->sql-converters))))
(define-operators *postgresql-translator* (define-operators *postgresql-translator*

@ -27,6 +27,10 @@
(test "returning" (test "returning"
"INSERT INTO widgets VALUES ('foo', 'bar') RETURNING id, name" "INSERT INTO widgets VALUES ('foo', 'bar') RETURNING id, name"
(ssql->sql #t '(insert (into widgets) (values ("foo" "bar")) (returning id name))))) (ssql->sql #t '(insert (into widgets) (values ("foo" "bar")) (returning id name))))
(test "compose returning"
'(insert (into widgets) (values (1 2 3)) (returning id))
(ssql-compose #t '(insert (into widgets) (values (1 2 3))) '((returning id)))))
(test-exit) (test-exit)
Loading…
Cancel
Save