Method to close a DMS is uncommented but not complete yet (columns have

to be closed separately)
This commit is contained in:
Celine Mercier
2015-10-08 10:44:13 +02:00
parent ee4c513fd4
commit b553eef781
2 changed files with 10 additions and 9 deletions

View File

@ -4,7 +4,8 @@ from pathlib import Path
from obitools3.utils cimport bytes2str, str2bytes
from .capi.obidms cimport obi_dms
from .capi.obidms cimport obi_dms, \
obi_close_dms
from .capi.obidmscolumn cimport obi_column_get_data_type_from_name, \
obi_column_get_latest_version_from_name, \
obi_column_get_line_count_from_name, \
@ -51,10 +52,13 @@ cdef class OBIDMS :
# Fill structure and create or open the DMS
self.dms_name = dms_name
self.pointer = obi_dms(<const_char_p> dms_name_b)
# TODO: test pointer and raise Exception("Failed opening or creating an OBIDMS")
# def __del__(self) : # TODO problem with closing dir breaking everything
# obi_close_dms(self.pointer)
cpdef close(self) :
#TODO close all columns
if (obi_close_dms(self.pointer)) < 0 :
raise Exception("Problem closing an OBIDMS")
cpdef dict list(self):
@ -121,10 +125,7 @@ cdef class OBIDMS :
else :
data_type = obi_column_get_data_type_from_name(self.pointer, column_name_b)
# Open the column with the right subclass depending on the data type and the mode (read-only or writable)
# TODO : check that data type is the same as previous version if it exists?
# Open the column with the right subclass depending on the data type and the mode (read-only or writable)
if data_type == 1 :
if (create or clone) :
column = OBIDMS_column_int_writable(self, column_name,