|
|
@ -3,7 +3,7 @@
|
|
|
|
(*postgresql-translator*)
|
|
|
|
(*postgresql-translator*)
|
|
|
|
|
|
|
|
|
|
|
|
(import chicken scheme)
|
|
|
|
(import chicken scheme)
|
|
|
|
(use ssql postgresql foops)
|
|
|
|
(use ssql postgresql foops data-structures)
|
|
|
|
|
|
|
|
|
|
|
|
(define *postgresql-translator*
|
|
|
|
(define *postgresql-translator*
|
|
|
|
(let ((type->sql-converters
|
|
|
|
(let ((type->sql-converters
|
|
|
@ -12,7 +12,7 @@
|
|
|
|
(clauses-order (append (*ansi-translator* 'clauses-order)
|
|
|
|
(clauses-order (append (*ansi-translator* 'clauses-order)
|
|
|
|
'(returning))))
|
|
|
|
'(returning))))
|
|
|
|
|
|
|
|
|
|
|
|
(derive-object (*ansi-translator*)
|
|
|
|
(derive-object (*ansi-translator* self)
|
|
|
|
((escape-string string)
|
|
|
|
((escape-string string)
|
|
|
|
(escape-string (ssql-connection) string))
|
|
|
|
(escape-string (ssql-connection) string))
|
|
|
|
|
|
|
|
|
|
|
@ -21,13 +21,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
((clauses-order) clauses-order)
|
|
|
|
((clauses-order) clauses-order)
|
|
|
|
|
|
|
|
|
|
|
|
((type->sql-converters) type->sql-converters))))
|
|
|
|
((type->sql-converters) type->sql-converters)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
((array (elements ...))
|
|
|
|
|
|
|
|
(sprintf "ARRAY[~A]"
|
|
|
|
|
|
|
|
(string-intersperse
|
|
|
|
|
|
|
|
(map (lambda (el)
|
|
|
|
|
|
|
|
(self 'ssql->sql el))
|
|
|
|
|
|
|
|
elements)
|
|
|
|
|
|
|
|
", "))))))
|
|
|
|
|
|
|
|
|
|
|
|
(define-operators *postgresql-translator*
|
|
|
|
(define-operators *postgresql-translator*
|
|
|
|
(limit prefix)
|
|
|
|
(limit prefix)
|
|
|
|
(offset prefix)
|
|
|
|
(offset prefix)
|
|
|
|
(returning prefix "RETURNING" ", ")
|
|
|
|
(returning prefix "RETURNING" ", ")
|
|
|
|
(random function))
|
|
|
|
(random function)
|
|
|
|
|
|
|
|
(@> infix)
|
|
|
|
|
|
|
|
(<@ infix))
|
|
|
|
|
|
|
|
|
|
|
|
(register-sql-engine! connection? *postgresql-translator*)
|
|
|
|
(register-sql-engine! connection? *postgresql-translator*)
|
|
|
|
|
|
|
|
|
|
|
|