|
1 | | -# $Id: rdbms_common.py,v 1.27.2.8 2003-03-24 04:53:14 richard Exp $ |
| 1 | +# $Id: rdbms_common.py,v 1.27.2.9 2003-06-24 08:18:19 anthonybaxter Exp $ |
2 | 2 | ''' Relational database (SQL) backend common code. |
3 | 3 |
|
4 | 4 | Basics: |
@@ -720,13 +720,16 @@ def getnodeids(self, classname, retired=0): |
720 | 720 | Set retired=None to get all nodes. Otherwise it'll get all the |
721 | 721 | retired or non-retired nodes, depending on the flag. |
722 | 722 | ''' |
723 | | - # flip the sense of the flag if we don't want all of them |
| 723 | + # flip the sense of the 'retired' flag if we don't want all of them |
724 | 724 | if retired is not None: |
725 | | - retired = not retired |
726 | | - sql = 'select id from _%s where __retired__ <> %s'%(classname, self.arg) |
| 725 | + args = (((retired==0) and 1) or 0,) |
| 726 | + sql = 'select id from _%s where __retired__ <> %s'%(classname, self.arg) |
| 727 | + else: |
| 728 | + args = () |
| 729 | + sql = 'select id from _%s'%(classname,) |
727 | 730 | if __debug__: |
728 | | - print >>hyperdb.DEBUG, 'getnodeids', (self, sql, retired) |
729 | | - self.cursor.execute(sql, (retired,)) |
| 731 | + print >>hyperdb.DEBUG, 'getnodeids', (self, sql, args) |
| 732 | + self.cursor.execute(sql, args) |
730 | 733 | return [x[0] for x in self.cursor.fetchall()] |
731 | 734 |
|
732 | 735 | def addjournal(self, classname, nodeid, action, params, creator=None, |
|
0 commit comments