@@ -322,7 +322,7 @@ def query(self, offset=0, limit=10, resulttype='results',
322322 LOGGER .debug ('processing properties' )
323323
324324 attribute_filter = ' and ' .join (
325- map (lambda x : f'{ x [0 ]} = { sanitize_attribute_value (x [1 ])} ' , properties ) # noqa
325+ map (lambda x : f'{ x [0 ]} = { self . sanitize_attribute_value (x [1 ])} ' , properties ) # noqa
326326 )
327327
328328 LOGGER .debug (attribute_filter )
@@ -410,7 +410,7 @@ def get(self, identifier, crs_transform_spec=None, **kwargs):
410410 LOGGER .debug (f'Fetching identifier { identifier } ' )
411411 layer = self ._get_layer ()
412412
413- identifier2 = sanitize_attribute_value (identifier )
413+ identifier2 = self . sanitize_attribute_value (identifier )
414414
415415 layer .SetAttributeFilter (f'{ self .id_field } = { identifier2 } ' )
416416
@@ -904,25 +904,3 @@ def _ignore_gdal_error(inst, fn, *args, **kwargs) -> Any:
904904 """
905905 value = getattr (inst , fn )(* args , ** kwargs )
906906 return value
907-
908-
909- def sanitize_attribute_value (value ) -> str :
910- """
911- Sanitize an attribute value used in an
912- OGR layer SetAttributeFilter function
913-
914- :param value: `str` of attribute value
915-
916- :returns: `str` of sanitized attribute value
917- """
918-
919- if value is None :
920- return 'NULL'
921-
922- if isinstance (value , bool ):
923- return '1' if value else '0'
924-
925- if isinstance (value , (int , float )):
926- return f"'{ value } '"
927-
928- return "'" + str (value ).replace ("'" , "''" ) + "'"
0 commit comments