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:
parent
44e2de218c
commit
39a27aef71
@ -68,4 +68,4 @@
|
|||||||
0.10
|
0.10
|
||||||
- In optimizer, added a function that tokenizes an expression
|
- In optimizer, added a function that tokenizes an expression
|
||||||
- Document about complexity of operations
|
- 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.
|
@ -122,5 +122,5 @@ Notation
|
|||||||
|
|
||||||
2.9 Join
|
2.9 Join
|
||||||
|
|
||||||
Same as above.
|
Same as above.
|
||||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
@ -446,8 +446,14 @@ class relation (object):
|
|||||||
attributes[self.header.attributes[j]]=i[j]
|
attributes[self.header.attributes[j]]=i[j]
|
||||||
if eval(expr,attributes): #If expr is true, changing the tuple
|
if eval(expr,attributes): #If expr is true, changing the tuple
|
||||||
affected+=1
|
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)):
|
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
|
return affected
|
||||||
def insert(self,values):
|
def insert(self,values):
|
||||||
'''Inserts a tuple in the relation.
|
'''Inserts a tuple in the relation.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user