Cython API: trying to guess the type of a column when adding a None

value does not generate an exception anymore, and RollbackException can
now rollback several views
This commit is contained in:
Celine Mercier
2018-03-12 18:03:37 +01:00
parent 96bf2daae8
commit dad21823ff

View File

@ -444,9 +444,12 @@ cdef class Line :
# TODO use functions in utils
#print(column_name, "value:", value, type(value))
if column_name_b not in self._view :
if value == None :
raise RollbackException("Trying to create a column from a None value (can't guess type)", self)
if value is None :
return # TODO discuss. This means that columns aren't created until an identifiable type is found
#raise RollbackException("Trying to create a column from a None value (can't guess type)", self)
value_type = type(value)
if value_type == int :
value_obitype = OBI_INT
@ -636,13 +639,15 @@ cdef class Line_selection(list):
class RollbackException(Exception):
def __init__(self, message, View view):
def __init__(self, message, *views):
super(RollbackException, self).__init__(message)
if obi_rollback_view(<Obiview_p>(view.pointer())) < 0 :
raise Exception("Error rollbacking view")
if view.active() :
view._dms.unregister(view)
OBIWrapper.close(view)
for i in range(len(views)):
view = <View>(views[i])
if obi_rollback_view(<Obiview_p>(view.pointer())) < 0 :
raise Exception("Error rollbacking view")
if view.active() :
view._dms.unregister(view)
OBIWrapper.close(view)
class CantGuessTypeException(Exception):