Author: phd
Date: 2004-12-28 08:38:23 +0000 (Tue, 28 Dec 2004)
New Revision: 498
Modified:
home/phd/SQLObject/inheritance/sqlobject/dbconnection.py
Log:
Merged a patch from revision 497: fixed a bug with tables that do not have columns (only MultipleJoins, e.g.)
Modified: home/phd/SQLObject/inheritance/sqlobject/dbconnection.py
===================================================================
--- home/phd/SQLObject/inheritance/sqlobject/dbconnection.py 2004-12-28 08:37:02 UTC (rev 497)
+++ home/phd/SQLObject/inheritance/sqlobject/dbconnection.py 2004-12-28 08:38:23 UTC (rev 498)
@@ -268,11 +268,16 @@
(cls._table, cls._idName,
", ".join(select.tables))
else:
- q += "%s.%s, %s FROM %s WHERE " % \
- (cls._table, cls._idName,
- ", ".join(["%s.%s" % (cls._table, col.dbName)
- for col in cls._SO_columns]),
- ", ".join(select.tables))
+ columns = ", ".join(["%s.%s" % (cls._table, col.dbName)
+ for col in cls._SO_columns])
+ if columns:
+ q += "%s.%s, %s FROM %s WHERE " % \
+ (cls._table, cls._idName, columns,
+ ", ".join(select.tables))
+ else:
+ q += "%s.%s FROM %s WHERE " % \
+ (cls._table, cls._idName,
+ ", ".join(select.tables))
return self._addWhereClause(select, q)
|