Mercurial > p > roundup > code
diff roundup/backends/back_mysql.py @ 6148:8497bf3f23a1
Allow to define reverse Multilinks
Now it's possible to specify a rev_multilink parameter when creating
Link or Multilink properties. The parameter takes a property name to be
inserted into the linked-to class. It allows to navigate from the other
side of the link as if it where a forward Multilink using the existing
data structures.
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Wed, 29 Apr 2020 16:30:27 +0200 |
| parents | 3175bb92ca28 |
| children | 6a2de9606652 |
line wrap: on
line diff
--- a/roundup/backends/back_mysql.py Sun Apr 12 21:03:55 2020 +0100 +++ b/roundup/backends/back_mysql.py Wed Apr 29 16:30:27 2020 +0200 @@ -605,12 +605,12 @@ # TODO: AFAIK its version dependent for MySQL return False - def _subselect(self, classname, multilink_table): + def _subselect(self, classname, multilink_table, nodeid_name): ''' "I can't believe it's not a toy RDBMS" see, even toy RDBMSes like gadfly and sqlite can do sub-selects... ''' - self.db.sql('select nodeid from %s'%multilink_table) - s = ','.join([x[0] for x in self.db.sql_fetchall()]) + self.db.sql('select %s from %s'%(nodeid_name, multilink_table)) + s = ','.join([str(x[0]) for x in self.db.sql_fetchall()]) return '_%s.id not in (%s)'%(classname, s) def create_inner(self, **propvalues):
