add support for LIMIT, OFFSET and RANDOM()

master
Moritz Heidkamp 14 years ago
parent db592bcf2d
commit 86ca63c539

@ -19,6 +19,11 @@
((type->sql-converters) type->sql-converters))))
(define-operators *postgresql-translator*
(limit prefix)
(offset prefix)
(random function))
(register-sql-engine! connection? *postgresql-translator*)
)

@ -10,11 +10,19 @@
(register-sql-engine! (lambda (x) (eq? x #t)) *test-postgresql-translator*)
(test-begin "selects")
(test "Simple query"
"SELECT actors.firstname, actors.lastname FROM actors"
(ssql->sql #t `(select (columns actors.firstname actors.lastname)
(from actors))))
(test-end "selects")
(test-group "selects"
(test "Simple query"
"SELECT actors.firstname, actors.lastname FROM actors"
(ssql->sql #t `(select (columns actors.firstname actors.lastname)
(from actors)))))
(test-group "dialect"
(test "LIMIT and OFFSET"
"SELECT * FROM integers LIMIT 10 OFFSET 10"
(ssql->sql #t `(select (columns *) (from integers) (limit 10) (offset 100))))
(test "random()"
"SELECT * FROM widgets ORDER BY RANDOM()"
(ssql->sql #t `(select (columns *) (from widgets) (order (random))))))
(test-exit)
Loading…
Cancel
Save