Corrected all 'touple' into 'tuple'

git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@81 014f5005-505e-4b48-8d0a-63407b615a7c
This commit is contained in:
LtWorf 2009-02-10 12:14:49 +00:00
parent 8d0830fd6b
commit 711426c23d

View File

@ -423,7 +423,7 @@ class relation (object):
'''Update, expr must be a valid boolean expression, can contain field names, '''Update, expr must be a valid boolean expression, can contain field names,
constant, math operations and boolean ones. constant, math operations and boolean ones.
This operation will change the relation itself instead of generating a new one, This operation will change the relation itself instead of generating a new one,
updating all the touples that make expr true. updating all the tuples that make expr true.
Dic must be a dictionary that has the form field name:value. Every kind of value Dic must be a dictionary that has the form field name:value. Every kind of value
will be converted into a string. will be converted into a string.
Returns the number of affected rows.''' Returns the number of affected rows.'''
@ -444,18 +444,18 @@ class relation (object):
attributes[self.header.attributes[j]]=rdate(i[j]) attributes[self.header.attributes[j]]=rdate(i[j])
else: else:
attributes[self.header.attributes[j]]=i[j] attributes[self.header.attributes[j]]=i[j]
if eval(expr,attributes): #If expr is true, changing the touple if eval(expr,attributes): #If expr is true, changing the tuple
affected+=1 affected+=1
for k in range(len(keys)): for k in range(len(keys)):
i[f_ids[k]]=str(dic[keys[k]]) i[f_ids[k]]=str(dic[keys[k]])
return affected return affected
def insert(self,values): def insert(self,values):
'''Inserts a touple in the relation. '''Inserts a tuple in the relation.
This function will not insert duplicate tuples. This function will not insert duplicate tuples.
All the values will be converted in string. All the values will be converted in string.
Will return the number of inserted rows.''' Will return the number of inserted rows.'''
#Returns if touple doesn't fit the number of attributes #Returns if tuple doesn't fit the number of attributes
if len(self.header.attributes) != len(values): if len(self.header.attributes) != len(values):
return 0 return 0
@ -474,7 +474,7 @@ class relation (object):
'''Delete, expr must be a valid boolean expression, can contain field names, '''Delete, expr must be a valid boolean expression, can contain field names,
constant, math operations and boolean ones. constant, math operations and boolean ones.
This operation will change the relation itself instead of generating a new one, This operation will change the relation itself instead of generating a new one,
deleting all the touples that make expr true. deleting all the tuples that make expr true.
Returns the number of affected rows.''' Returns the number of affected rows.'''
attributes={} attributes={}
affected=len(self.content) affected=len(self.content)