|
|
|
(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)))
|
|
|
|
(clauses-order (append (*ansi-translator* 'clauses-order)
|
|
|
|
'(returning))))
|
|
|
|
|
|
|
|
(derive-object (*ansi-translator*)
|
|
|
|
((escape-string string)
|
|
|
|
(escape-string (ssql-connection) string))
|
|
|
|
|
|
|
|
((boolean->sql boolean)
|
|
|
|
(if boolean "'t'" "'f'"))
|
|
|
|
|
|
|
|
((clauses-order) clauses-order)
|
|
|
|
|
|
|
|
((type->sql-converters) type->sql-converters))))
|
|
|
|
|
|
|
|
(define-operators *postgresql-translator*
|
|
|
|
(limit prefix)
|
|
|
|
(offset prefix)
|
|
|
|
(returning prefix "RETURNING" ", ")
|
|
|
|
(random function))
|
|
|
|
|
|
|
|
(register-sql-engine! connection? *postgresql-translator*)
|
|
|
|
|
|
|
|
)
|