On Tue, 20 Jun 2006, Pau Aliagas wrote:

I having problems trying to create a query with to left joins as only one
allows having the left table specified, the rest have to be None,
otherwise it generates invalid SQL.

Sorry to follow up myself, I think this quick and dirty patch solves it.
It add commas or not if there is or not left table.

Is it acceptable? It seems to work for me in a quick test.

--

Pau
--- a/dbconnection.py   2006-06-19 10:37:21.000000000 +0200
+++ b/dbconnection.py   2006-06-20 16:47:18.000000000 +0200
@@ -455,11 +455,13 @@
                 join_str = ' '
             join_str += self.sqlrepr(join)
         else:
-            if tables and join[0].table1:
-                join_str = ", "
-            else:
-                join_str = ' '
-            join_str += " ".join([self.sqlrepr(j) for j in join])
+           join_str = ""
+           for j in join:
+               if tables and j.table1:
+                   sep = ", "
+                else:
+                    sep = ' '
+               join_str += sep + self.sqlrepr(j)
         return join_str
 
     def _addWhereClause(self, select, startSelect, limit=1, order=1):
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to