summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1d2361a)
raw | patch | inline | side by side (parent: 1d2361a)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 8 Apr 2004 00:40:20 +0000 (00:40 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 8 Apr 2004 00:40:20 +0000 (00:40 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2267 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/backends/rdbms_common.py | patch | blob | history | |
test/db_test_base.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index 14d8a923f230fe7819f33297b88b99bdb5a88e85..c9a05661a4ac0f2034ccd0ca2620cf8ee8e92caf 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
- added search_checkboxes as an option for the search form
Fixed:
+- mysql and postgresql schema mutation now handle added Multilinks
- web CSV export was busted (as was any action returning a result)
- MultiMapping deviated from the Zope C implementation in a number of
places (thanks Toby Sargeant)
index ab43ecd1709126a15fea3b33b734d72d83a885a5..e468a0f2b4e56e3faae4c4d15465b60eccb0136e 100644 (file)
-# $Id: rdbms_common.py,v 1.89 2004-04-05 07:13:10 richard Exp $
+# $Id: rdbms_common.py,v 1.90 2004-04-08 00:40:20 richard Exp $
''' Relational database (SQL) backend common code.
Basics:
keyprop_changes['remove'])
# add new columns
- for propname, x in new_spec[1]:
+ for propname, prop in new_spec[1]:
if old_has(propname):
continue
- sql = 'alter table _%s add column _%s varchar(255)'%(
- spec.classname, propname)
- if __debug__:
- print >>hyperdb.DEBUG, 'update_class', (self, sql)
- self.cursor.execute(sql)
-
- # if the new column is a key prop, we need an index!
- if new_spec[0] == propname:
- self.create_class_table_key_index(spec.classname, propname)
- del keyprop_changes['add']
+ prop = spec.properties[propname]
+ if isinstance(prop, Multilink):
+ self.create_multilink_table(spec, propname)
+ else:
+ sql = 'alter table _%s add column _%s varchar(255)'%(
+ spec.classname, propname)
+ if __debug__:
+ print >>hyperdb.DEBUG, 'update_class', (self, sql)
+ self.cursor.execute(sql)
+
+ # if the new column is a key prop, we need an index!
+ if new_spec[0] == propname:
+ self.create_class_table_key_index(spec.classname, propname)
+ del keyprop_changes['add']
# if we didn't add the key prop just then, but the key prop has
# changed, we still need to add the new index
diff --git a/test/db_test_base.py b/test/db_test_base.py
index a69b859d0dbab9efa25f933bc7f93aa8a63d7d58..007ef9f3496048e9b1cc659c1edf25f3b45d2017 100644 (file)
--- a/test/db_test_base.py
+++ b/test/db_test_base.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: db_test_base.py,v 1.21 2004-04-05 07:13:10 richard Exp $
+# $Id: db_test_base.py,v 1.22 2004-04-08 00:40:20 richard Exp $
import unittest, os, shutil, errno, imp, sys, time, pprint
self.db = self.module.Database(config, 'admin')
a = self.module.Class(self.db, "a", name=String())
a.setkey("name")
- b = self.module.Class(self.db, "b", name=String())
+ b = self.module.Class(self.db, "b", name=String(),
+ fooz=Multilink('a'))
b.setkey("name")
self.db.post_init()
# add a new class to the schema and check creation of new items
# (and existence of old ones)
self.init_ab()
- bid = self.db.b.create(name='bear')
+ bid = self.db.b.create(name='bear', fooz=[aid])
self.assertEqual(self.db.a.get(aid, 'name'), 'apple')
self.db.commit()
self.db.close()
self.assertEqual(self.db.a.get(aid, 'name'), 'apple')
self.assertEqual(self.db.a.lookup('apple'), aid)
self.assertEqual(self.db.b.get(bid, 'name'), 'bear')
+ self.assertEqual(self.db.b.get(bid, 'fooz'), [aid])
self.assertEqual(self.db.b.lookup('bear'), bid)
# confirm journal's ok
def init_ml(self):
self.db = self.module.Database(config, 'admin')
- a = self.module.Class(self.db, "a", name=String())
- a.setkey('name')
- b = self.module.Class(self.db, "b", name=String(),
+ a = self.module.Class(self.db, "a", name=String(),
fooz=Multilink('a'))
- b.setkey("name")
+ a.setkey('name')
self.db.post_init()
def test_makeNewMultilink(self):
# add a multilink prop
self.init_ml()
- bid = self.db.b.create(name='bear', fooz=[aid])
- self.assertEqual(self.db.b.find(fooz=aid), [bid])
+ bid = self.db.a.create(name='bear', fooz=[aid])
+ self.assertEqual(self.db.a.find(fooz=aid), [bid])
self.assertEqual(self.db.a.lookup('apple'), aid)
self.db.commit(); self.db.close()
# check
self.init_ml()
- self.assertEqual(self.db.b.find(fooz=aid), [bid])
+ self.assertEqual(self.db.a.find(fooz=aid), [bid])
self.assertEqual(self.db.a.lookup('apple'), aid)
- self.assertEqual(self.db.b.lookup('bear'), bid)
+ self.assertEqual(self.db.a.lookup('bear'), bid)
# confirm journal's ok
self.db.getjournal('a', aid)
- self.db.getjournal('b', bid)
+ self.db.getjournal('a', bid)
def test_removeMultilink(self):
# add a multilink prop