Mercurial > p > roundup > code
diff roundup/backends/rdbms_common.py @ 3688:722ab52d47fc
added filter_sql to SQL backends which takes an arbitrary SQL statement...
...and returns a list of item ids
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 29 Aug 2006 04:32:49 +0000 |
| parents | ff9f4ca42454 |
| children | a775afeeee8b |
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py Tue Aug 29 04:20:50 2006 +0000 +++ b/roundup/backends/rdbms_common.py Tue Aug 29 04:32:49 2006 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -#$Id: rdbms_common.py,v 1.178 2006-08-29 04:20:50 richard Exp $ +#$Id: rdbms_common.py,v 1.179 2006-08-29 04:32:49 richard Exp $ ''' Relational database (SQL) backend common code. Basics: @@ -2319,6 +2319,25 @@ self.db.stats['filtering'] += (time.time() - start_t) return l + def filter_sql(self, sql): + '''Return a list of the ids of the items in this class that match + the SQL provided. The SQL is a complete "select" statement. + + The SQL select must include the item id as the first column. + + This function DOES NOT filter out retired items, add on a where + clause "__retired__ <> 1" if you don't want retired nodes. + ''' + if __debug__: + start_t = time.time() + + self.db.sql(sql) + l = self.db.sql_fetchall() + + if __debug__: + self.db.stats['filtering'] += (time.time() - start_t) + return l + def count(self): '''Get the number of nodes in this class.
