NA value for OBI_STR and OBI_SEQ columns is now NULL

This commit is contained in:
Celine Mercier
2016-06-03 18:53:22 +02:00
parent a8ed57dc6e
commit 69bf7ec2e7
4 changed files with 13 additions and 15 deletions

View File

@ -9,8 +9,6 @@ from .capi.obitypes cimport OBIStr_NA, const_char_p
from obitools3.utils cimport str2bytes, bytes2str
from libc.string cimport strcmp
cdef class OBIDMS_column_str(OBIDMS_column):
@ -20,7 +18,7 @@ cdef class OBIDMS_column_str(OBIDMS_column):
value = obi_column_get_obistr_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0)
if obi_errno > 0 :
raise IndexError(line_nb)
if strcmp(value, OBIStr_NA) == 0 :
if value == OBIStr_NA :
result = None
else :
result = bytes2str(value)
@ -45,7 +43,7 @@ cdef class OBIDMS_column_multi_elts_str(OBIDMS_column_multi_elts):
value = obi_column_get_obistr_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name))
if obi_errno > 0 :
raise IndexError(line_nb, element_name)
if strcmp(value, OBIStr_NA) == 0 :
if value == OBIStr_NA :
result = None
else :
result = bytes2str(value)
@ -64,7 +62,7 @@ cdef class OBIDMS_column_multi_elts_str(OBIDMS_column_multi_elts):
value = obi_column_get_obistr_with_elt_idx_in_view(self.view.pointer, (self.pointer)[0], line_nb, i)
if obi_errno > 0 :
raise IndexError(line_nb)
if strcmp(value, OBIStr_NA) == 0 :
if value == OBIStr_NA :
value_in_result = None
else :
value_in_result = bytes2str(value)