[llvm-commits] [zorg] r150757 - /zorg/trunk/lnt/lnt/server/db/testsuitedb.py
Daniel Dunbar
daniel at zuster.org
Thu Feb 16 14:55:03 PST 2012
Author: ddunbar
Date: Thu Feb 16 16:55:03 2012
New Revision: 150757
URL: http://llvm.org/viewvc/llvm-project?rev=150757&view=rev
Log:
[lnt] lnt.server.db.testsuitedb: Avoid possible IN clause on empty set, which SA
seems think might irritate some databases.
Modified:
zorg/trunk/lnt/lnt/server/db/testsuitedb.py
Modified: zorg/trunk/lnt/lnt/server/db/testsuitedb.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/db/testsuitedb.py?rev=150757&r1=150756&r2=150757&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/db/testsuitedb.py (original)
+++ zorg/trunk/lnt/lnt/server/db/testsuitedb.py Thu Feb 16 16:55:03 2012
@@ -705,10 +705,14 @@
orders_to_return = all_machine_orders[index+1:index+N]
# Get all the runs for those orders on this machine in a single query.
+ ids_to_fetch = [o.id
+ for o in orders_to_return]
+ if not ids_to_fetch:
+ return []
+
runs = self.query(self.Run).\
filter(self.Run.machine == run.machine).\
- filter(self.Run.order_id.in_(o.id
- for o in orders_to_return)).all()
+ filter(self.Run.order_id.in_(ids_to_fetch)).all()
# Sort the result by order, accounting for direction to satisfy our
# requirement of returning the runs in adjacency order.
More information about the llvm-commits
mailing list