Mercurial > p > roundup > code
comparison roundup/backends/rdbms_common.py @ 2494:ea7fb2f416db
fixed RDBMS Class.find() to handle None value in multiple find...
...and a merge from maint-0-7
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 23 Jun 2004 23:19:07 +0000 |
| parents | f41539b3c486 |
| children | 682eefe8ef23 |
comparison
equal
deleted
inserted
replaced
| 2492:fa871d7a3a0f | 2494:ea7fb2f416db |
|---|---|
| 1 # $Id: rdbms_common.py,v 1.110 2004-06-16 03:54:00 richard Exp $ | 1 # $Id: rdbms_common.py,v 1.111 2004-06-23 23:19:07 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 |
| 1950 allvalues += (values,) | 1950 allvalues += (values,) |
| 1951 where.append('_%s = %s'%(prop, a)) | 1951 where.append('_%s = %s'%(prop, a)) |
| 1952 elif values is None: | 1952 elif values is None: |
| 1953 where.append('_%s is NULL'%prop) | 1953 where.append('_%s is NULL'%prop) |
| 1954 else: | 1954 else: |
| 1955 allvalues += tuple(values.keys()) | 1955 values = values.keys() |
| 1956 where.append('_%s in (%s)'%(prop, ','.join([a]*len(values)))) | 1956 s = '' |
| 1957 if None in values: | |
| 1958 values.remove(None) | |
| 1959 s = '_%s is NULL or '%prop | |
| 1960 allvalues += tuple(values) | |
| 1961 s += '_%s in (%s)'%(prop, ','.join([a]*len(values))) | |
| 1962 where.append(s) | |
| 1957 tables = ['_%s'%self.classname] | 1963 tables = ['_%s'%self.classname] |
| 1958 if where: | 1964 if where: |
| 1959 o.append('(' + ' and '.join(where) + ')') | 1965 o.append('(' + ' and '.join(where) + ')') |
| 1960 | 1966 |
| 1961 # now multilinks | 1967 # now multilinks |
