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:
@ -444,9 +444,12 @@ cdef class Line :
|
|||||||
|
|
||||||
# TODO use functions in utils
|
# TODO use functions in utils
|
||||||
|
|
||||||
|
#print(column_name, "value:", value, type(value))
|
||||||
|
|
||||||
if column_name_b not in self._view :
|
if column_name_b not in self._view :
|
||||||
if value == None :
|
if value is None :
|
||||||
raise RollbackException("Trying to create a column from a None value (can't guess type)", self)
|
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)
|
value_type = type(value)
|
||||||
if value_type == int :
|
if value_type == int :
|
||||||
value_obitype = OBI_INT
|
value_obitype = OBI_INT
|
||||||
@ -636,13 +639,15 @@ cdef class Line_selection(list):
|
|||||||
|
|
||||||
|
|
||||||
class RollbackException(Exception):
|
class RollbackException(Exception):
|
||||||
def __init__(self, message, View view):
|
def __init__(self, message, *views):
|
||||||
super(RollbackException, self).__init__(message)
|
super(RollbackException, self).__init__(message)
|
||||||
if obi_rollback_view(<Obiview_p>(view.pointer())) < 0 :
|
for i in range(len(views)):
|
||||||
raise Exception("Error rollbacking view")
|
view = <View>(views[i])
|
||||||
if view.active() :
|
if obi_rollback_view(<Obiview_p>(view.pointer())) < 0 :
|
||||||
view._dms.unregister(view)
|
raise Exception("Error rollbacking view")
|
||||||
OBIWrapper.close(view)
|
if view.active() :
|
||||||
|
view._dms.unregister(view)
|
||||||
|
OBIWrapper.close(view)
|
||||||
|
|
||||||
|
|
||||||
class CantGuessTypeException(Exception):
|
class CantGuessTypeException(Exception):
|
||||||
|
Reference in New Issue
Block a user