From db592bcf2dea2288a146117d0fe5719490b6ac86 Mon Sep 17 00:00:00 2001 From: syn Date: Sun, 27 Feb 2011 21:13:35 +0000 Subject: [PATCH] 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-ac86a6ce46c4 --- ssql-postgresql.meta | 5 +++++ ssql-postgresql.scm | 24 ++++++++++++++++++++++++ ssql-postgresql.setup | 1 + tests/run.scm | 20 ++++++++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 ssql-postgresql.meta create mode 100644 ssql-postgresql.scm create mode 100644 ssql-postgresql.setup create mode 100644 tests/run.scm diff --git a/ssql-postgresql.meta b/ssql-postgresql.meta new file mode 100644 index 0000000..599fd85 --- /dev/null +++ b/ssql-postgresql.meta @@ -0,0 +1,5 @@ +((synopsis "SSQL translator for PostgreSQL") + (category databases) + (needs ssql postgresql) + (license "BSD") + (authors "Peter Bex, Moritz Heidkamp")) \ No newline at end of file diff --git a/ssql-postgresql.scm b/ssql-postgresql.scm new file mode 100644 index 0000000..6ad032a --- /dev/null +++ b/ssql-postgresql.scm @@ -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*) + +) \ No newline at end of file diff --git a/ssql-postgresql.setup b/ssql-postgresql.setup new file mode 100644 index 0000000..80282c9 --- /dev/null +++ b/ssql-postgresql.setup @@ -0,0 +1 @@ +(standard-extension 'ssql-postgresql #f) \ No newline at end of file diff --git a/tests/run.scm b/tests/run.scm new file mode 100644 index 0000000..ce1fec7 --- /dev/null +++ b/tests/run.scm @@ -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) \ No newline at end of file