- unit tests updated to run without any pysqlite installed; pool
test uses a mock DBAPI
- urls support escaped characters in passwords [ticket:281]
+- added limit/offset to UNION queries
0.2.7
- quoting facilities set up so that database-specific quoting can be
order_by = self.get_str(cs.order_by_clause)
if order_by:
text += " ORDER BY " + order_by
+ text += self.visit_select_postclauses(cs)
if cs.parens:
self.strings[cs] = "(" + text + ")"
else:
return (select.limit or select.offset) and self.limit_clause(select) or ""
def limit_clause(self, select):
+ text = ""
if select.limit is not None:
- return " \n LIMIT " + str(select.limit)
+ text += " \n LIMIT " + str(select.limit)
if select.offset is not None:
if select.limit is None:
- return " \n LIMIT -1"
- return " OFFSET " + str(select.offset)
+ text += " \n LIMIT -1"
+ text += " OFFSET " + str(select.offset)
+ return text
def visit_table(self, table):
self.froms[table] = self.preparer.format_table(table)
self.correlate = kwargs.pop('correlate', False)
self.for_update = kwargs.pop('for_update', False)
self.nowait = kwargs.pop('nowait', False)
+ self.limit = kwargs.get('limit', None)
+ self.offset = kwargs.get('offset', None)
for s in self.selects:
s.group_by(None)
s.order_by(None)
)
assert u.corresponding_column(table2.c.otherid) is u.c.otherid
+ self.runtest(
+ union(
+ select([table1]),
+ select([table2]),
+ order_by=['myid'],
+ offset=10,
+ limit=5
+ )
+ , "SELECT mytable.myid, mytable.name, mytable.description \
+FROM mytable UNION SELECT myothertable.otherid, myothertable.othername \
+FROM myothertable ORDER BY myid \
+ LIMIT 5 OFFSET 10"
+ )
def testouterjoin(self):
# test an outer join. the oracle module should take the ON clause of the join and