Mercurial > p > roundup > code
comparison roundup/backends/rdbms_common.py @ 2888:95a8b49090de maint-0.7
merge from HEAD
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 09 Nov 2004 04:10:28 +0000 |
| parents | 638fc2dab5a1 |
| children | 17df4dc4ae51 |
comparison
equal
deleted
inserted
replaced
| 2885:b72cd8fa1b9c | 2888:95a8b49090de |
|---|---|
| 1 # $Id: rdbms_common.py,v 1.98.2.25 2004-10-15 01:10:22 richard Exp $ | 1 # $Id: rdbms_common.py,v 1.98.2.26 2004-11-09 04:10:28 richard Exp $ |
| 2 ''' Relational database (SQL) backend common code. | 2 ''' Relational database (SQL) backend common code. |
| 3 | 3 |
| 4 Basics: | 4 Basics: |
| 5 | 5 |
| 6 - map roundup classes to relational tables | 6 - map roundup classes to relational tables |
| 961 sql = 'select linkid from %s_%s where nodeid=%s'%(classname, col, | 961 sql = 'select linkid from %s_%s where nodeid=%s'%(classname, col, |
| 962 self.arg) | 962 self.arg) |
| 963 self.cursor.execute(sql, (nodeid,)) | 963 self.cursor.execute(sql, (nodeid,)) |
| 964 # extract the first column from the result | 964 # extract the first column from the result |
| 965 # XXX numeric ids | 965 # XXX numeric ids |
| 966 node[col] = [str(x[0]) for x in self.cursor.fetchall()] | 966 items = [int(x[0]) for x in self.cursor.fetchall()] |
| 967 items.sort () | |
| 968 node[col] = [str(x) for x in items] | |
| 967 | 969 |
| 968 # save off in the cache | 970 # save off in the cache |
| 969 key = (classname, nodeid) | 971 key = (classname, nodeid) |
| 970 self.cache[key] = node | 972 self.cache[key] = node |
| 971 # update the LRU | 973 # update the LRU |
