Bug: error in update operation, it changed the original tuple, so also other relations using the same tuple would change. Now it copies it

git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@122 014f5005-505e-4b48-8d0a-63407b615a7c
This commit is contained in:
LtWorf 2009-04-03 19:03:02 +00:00
parent 44e2de218c
commit 39a27aef71
3 changed files with 9 additions and 3 deletions

View File

@ -68,4 +68,4 @@
0.10
- In optimizer, added a function that tokenizes an expression
- Document about complexity of operations
- Bug: error in rename operator, it didn't perform a fullcopy of the relation
- Bug: error in update operation, it changed the original tuple, so also other relations using the same tuple would change. Now it copies it.

View File

@ -122,5 +122,5 @@ Notation
2.9 Join
Same as above.
Same as above.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

View File

@ -446,8 +446,14 @@ class relation (object):
attributes[self.header.attributes[j]]=i[j]
if eval(expr,attributes): #If expr is true, changing the tuple
affected+=1
new_tuple=list(i)
#Deleting the tuple, instead of changing it, so other
#relations can still point to the same list without
#being affected.
self.content.remove(i)
for k in range(len(keys)):
i[f_ids[k]]=str(dic[keys[k]])
new_tuple[f_ids[k]]=str(dic[keys[k]])
self.content.append(new_tuple)
return affected
def insert(self,values):
'''Inserts a tuple in the relation.