# HG changeset patch # User Sylvain Thénault # Date 1276877695 -7200 # Node ID 1faff41593df558be4fd5f0646b4a80729d7c6a9 # Parent e13aa4786a72661602ae6cc2127ff57f491a5d63 [rql2sql] use new dbhelper.sql_concat_string function to deal with sql string concatenation. This together with lgdb 1.0.4 fixes #1055133: SQL Server support : string concatenation issue diff -r e13aa4786a72 -r 1faff41593df __pkginfo__.py --- a/__pkginfo__.py Fri Jun 18 15:41:39 2010 +0200 +++ b/__pkginfo__.py Fri Jun 18 18:14:55 2010 +0200 @@ -52,7 +52,7 @@ 'Twisted': '', # XXX graphviz # server dependencies - 'logilab-database': '', + 'logilab-database': '>= 1.0.4', 'pysqlite': '>= 2.5.5', # XXX install pysqlite2 } diff -r e13aa4786a72 -r 1faff41593df debian/control --- a/debian/control Fri Jun 18 15:41:39 2010 +0200 +++ b/debian/control Fri Jun 18 18:14:55 2010 +0200 @@ -33,7 +33,7 @@ Conflicts: cubicweb-multisources Replaces: cubicweb-multisources Provides: cubicweb-multisources -Depends: ${python:Depends}, cubicweb-common (= ${source:Version}), cubicweb-ctl (= ${source:Version}), python-logilab-database (>= 1.0.2), cubicweb-postgresql-support | cubicweb-mysql-support | python-pysqlite2 +Depends: ${python:Depends}, cubicweb-common (= ${source:Version}), cubicweb-ctl (= ${source:Version}), python-logilab-database (>= 1.0.4), cubicweb-postgresql-support | cubicweb-mysql-support | python-pysqlite2 Recommends: pyro, cubicweb-documentation (= ${source:Version}) Description: server part of the CubicWeb framework CubicWeb is a semantic web application framework. diff -r e13aa4786a72 -r 1faff41593df server/sources/rql2sql.py --- a/server/sources/rql2sql.py Fri Jun 18 15:41:39 2010 +0200 +++ b/server/sources/rql2sql.py Fri Jun 18 18:14:55 2010 +0200 @@ -1096,7 +1096,8 @@ operator = mexpr.operator try: if mexpr.operator == '+' and mexpr.get_type(self._state.solution, self._args) == 'String': - operator = '||' + return '(%s)' % self.dbhelper.sql_concat_string(lhs.accept(self), + rhs.accept(self)) except CoercionError: pass return '(%s %s %s)'% (lhs.accept(self), operator, rhs.accept(self)) diff -r e13aa4786a72 -r 1faff41593df server/test/unittest_rql2sql.py --- a/server/test/unittest_rql2sql.py Fri Jun 18 15:41:39 2010 +0200 +++ b/server/test/unittest_rql2sql.py Fri Jun 18 18:14:55 2010 +0200 @@ -1416,6 +1416,12 @@ self.o.attr_map.clear() + def test_concat_string(self): + self._check('Any "A"+R WHERE X ref R', + '''SELECT (A || _X.cw_ref) +FROM cw_Affaire AS _X''') + + class SqliteSQLGeneratorTC(PostgresSQLGeneratorTC): def setUp(self):