@@ -250,6 +250,21 @@ def _crow_varbinary_to_python_block(data, is_null, num_of_rows, nbytes=None, pre
250250 res .append (cast (buffer , c_char_p ).value )
251251 return res
252252
253+ def _crow_blob_to_python_block (data , is_null , num_of_rows , nbytes = None , precision = FieldType .C_TIMESTAMP_UNKNOWN ):
254+ """Function to convert C binary row to python row."""
255+ assert nbytes is not None
256+ res = []
257+ for i in range (abs (num_of_rows )):
258+ if is_null [i ]:
259+ res .append (None )
260+ else :
261+ rbyte = ctypes .cast (data + nbytes * i , ctypes .POINTER (ctypes .c_uint16 ))[:1 ].pop ()
262+ chars = ctypes .cast (c_char_p (data + nbytes * i + 4 ), ctypes .POINTER (c_char * rbyte ))
263+ buffer = create_string_buffer (rbyte + 1 )
264+ buffer [:rbyte ] = chars [0 ][:rbyte ]
265+ res .append (cast (buffer , c_char_p ).value )
266+ return res
267+
253268
254269def _crow_nchar_to_python_block (data , is_null , num_of_rows , nbytes = None , precision = FieldType .C_TIMESTAMP_UNKNOWN ):
255270 """Function to convert C nchar row to python row."""
@@ -301,6 +316,7 @@ def convert_block_func(field_type: FieldType, decode_binary=True):
301316 FieldType .C_GEOMETRY : _crow_varbinary_to_python ,
302317 FieldType .C_DECIMAL : _crow_decimal_to_python ,
303318 FieldType .C_DECIMAL64 : _crow_decimal_to_python ,
319+ FieldType .C_BLOB : _crow_blob_to_python_block ,
304320}
305321
306322CONVERT_FUNC_BLOCK = {
@@ -323,6 +339,7 @@ def convert_block_func(field_type: FieldType, decode_binary=True):
323339 FieldType .C_GEOMETRY : _crow_varbinary_to_python_block ,
324340 FieldType .C_DECIMAL : _crow_decimal_to_python ,
325341 FieldType .C_DECIMAL64 : _crow_decimal_to_python ,
342+ FieldType .C_BLOB : _crow_blob_to_python_block ,
326343}
327344
328345
0 commit comments