Cython View API: added small tools
This commit is contained in:
@ -389,6 +389,12 @@ cdef class View(OBIWrapper) :
|
|||||||
raise OBIDeactivatedInstanceError()
|
raise OBIDeactivatedInstanceError()
|
||||||
return self.pointer().infos.line_count
|
return self.pointer().infos.line_count
|
||||||
|
|
||||||
|
# line_count property getter
|
||||||
|
@property
|
||||||
|
def read_only(self):
|
||||||
|
if not self.active() :
|
||||||
|
raise OBIDeactivatedInstanceError()
|
||||||
|
return self.pointer().read_only
|
||||||
|
|
||||||
# name property getter
|
# name property getter
|
||||||
@property
|
@property
|
||||||
@ -435,6 +441,8 @@ cdef class Line :
|
|||||||
cdef bytes column_name_b
|
cdef bytes column_name_b
|
||||||
|
|
||||||
column_name_b = tobytes(column_name)
|
column_name_b = tobytes(column_name)
|
||||||
|
|
||||||
|
# TODO use functions in utils
|
||||||
|
|
||||||
if column_name_b not in self._view :
|
if column_name_b not in self._view :
|
||||||
if value == None :
|
if value == None :
|
||||||
@ -458,7 +466,8 @@ cdef class Line :
|
|||||||
elif (len(value) > 1) :
|
elif (len(value) > 1) :
|
||||||
value_obitype = OBI_STR
|
value_obitype = OBI_STR
|
||||||
else :
|
else :
|
||||||
raise RollbackException("Could not guess the type of a value to create a new column", self)
|
raise CantGuessTypeException()
|
||||||
|
#raise RollbackException("Could not guess the type of a value to create a new column", self._view)
|
||||||
|
|
||||||
Column.new_column(self._view, column_name_b, value_obitype)
|
Column.new_column(self._view, column_name_b, value_obitype)
|
||||||
|
|
||||||
@ -636,6 +645,9 @@ class RollbackException(Exception):
|
|||||||
OBIWrapper.close(view)
|
OBIWrapper.close(view)
|
||||||
|
|
||||||
|
|
||||||
|
class CantGuessTypeException(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
#############################################################
|
#############################################################
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user