Raise an exception when trying to insert n-uples with the wrong cardinality
This commit is contained in:
parent
3fca4edd15
commit
496a5c19d1
@ -468,9 +468,14 @@ class relation (object):
|
||||
This function will not insert duplicate tuples.
|
||||
All the values will be converted in string.
|
||||
Will return the number of inserted rows.'''
|
||||
# Returns if tuple doesn't fit the number of attributes
|
||||
|
||||
if len(self.header.attributes) != len(values):
|
||||
return 0
|
||||
raise Exception(
|
||||
'Tuple has the wrong size. Expected %d, got %d' % (
|
||||
len(self.header.attributes),
|
||||
len(values)
|
||||
)
|
||||
)
|
||||
|
||||
self._make_writable()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user