ssql: move ssql-pgsql into a separate egg to remove the postgresql dependency and rename it to ssql-postgresql in the course to match with awful-postgresql and autoform-postgresql
git-svn-id: https://code.call-cc.org/svn/chicken-eggs/release/4/ssql-postgresql/trunk@22911 fca3e652-9b03-0410-8d7b-ac86a6ce46c4master
commit
db592bcf2d
@ -0,0 +1,5 @@
|
||||
((synopsis "SSQL translator for PostgreSQL")
|
||||
(category databases)
|
||||
(needs ssql postgresql)
|
||||
(license "BSD")
|
||||
(authors "Peter Bex, Moritz Heidkamp"))
|
@ -0,0 +1,24 @@
|
||||
(module ssql-postgresql
|
||||
|
||||
(*postgresql-translator*)
|
||||
|
||||
(import chicken scheme)
|
||||
(use ssql postgresql foops)
|
||||
|
||||
(define *postgresql-translator*
|
||||
(let ((type->sql-converters
|
||||
`((,boolean? . boolean->sql)
|
||||
,@(*ansi-translator* 'type->sql-converters))))
|
||||
|
||||
(derive-object (*ansi-translator*)
|
||||
((escape-string string)
|
||||
(escape-string (ssql-connection) string))
|
||||
|
||||
((boolean->sql boolean)
|
||||
(if boolean "'t'" "'f'"))
|
||||
|
||||
((type->sql-converters) type->sql-converters))))
|
||||
|
||||
(register-sql-engine! connection? *postgresql-translator*)
|
||||
|
||||
)
|
@ -0,0 +1 @@
|
||||
(standard-extension 'ssql-postgresql #f)
|
@ -0,0 +1,20 @@
|
||||
(load-relative "../ssql-postgresql")
|
||||
(use ssql)
|
||||
(import ssql-postgresql)
|
||||
(use test postgresql foops)
|
||||
|
||||
(define *test-postgresql-translator*
|
||||
(derive-object (*postgresql-translator* self super)
|
||||
((escape-string string)
|
||||
(super (ssql-connection) string))))
|
||||
|
||||
(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-exit)
|
Loading…
Reference in New Issue