@@ -215,6 +215,17 @@ pub unsafe extern "C" fn taos_print_row(
215215 row : TAOS_ROW ,
216216 fields : * mut TAOS_FIELD ,
217217 num_fields : c_int ,
218+ ) -> c_int {
219+ taos_print_row_with_size ( str, i32:: MAX as _ , row, fields, num_fields)
220+ }
221+
222+ #[ no_mangle]
223+ pub unsafe extern "C" fn taos_print_row_with_size (
224+ str : * mut c_char ,
225+ size : u32 ,
226+ row : TAOS_ROW ,
227+ fields : * mut TAOS_FIELD ,
228+ num_fields : c_int ,
218229) -> c_int {
219230 unsafe fn write_to_cstr ( size : & mut usize , str : * mut c_char , content : & str ) -> i32 {
220231 if content. len ( ) > * size {
@@ -226,7 +237,7 @@ pub unsafe extern "C" fn taos_print_row(
226237 content. len ( ) as _
227238 }
228239
229- trace ! ( str =?str , row=?row, fields=?fields, num_fields, "taos_print_row " ) ;
240+ trace ! ( str =?str , size , row=?row, fields=?fields, num_fields, "taos_print_row_with_size " ) ;
230241
231242 if str. is_null ( ) || row. is_null ( ) || fields. is_null ( ) || num_fields <= 0 {
232243 return Code :: SUCCESS . into ( ) ;
@@ -236,7 +247,7 @@ pub unsafe extern "C" fn taos_print_row(
236247 let fields = slice:: from_raw_parts ( fields, num_fields as usize ) ;
237248
238249 let mut len: usize = 0 ;
239- let mut size = ( i32 :: MAX - 1 ) as usize ;
250+ let mut size = ( size - 1 ) as usize ;
240251
241252 for i in 0 ..num_fields as usize {
242253 if i > 0 && size > 0 {
@@ -307,22 +318,15 @@ pub unsafe extern "C" fn taos_print_row(
307318
308319 * str. add ( len as usize ) = 0 ;
309320
310- trace ! ( len, "taos_print_row done str={:?}" , CStr :: from_ptr( str ) ) ;
321+ trace ! (
322+ len,
323+ "taos_print_row_with_size done str={:?}" ,
324+ CStr :: from_ptr( str )
325+ ) ;
311326
312327 len as _
313328}
314329
315- #[ no_mangle]
316- pub extern "C" fn taos_print_row_with_size (
317- str : * mut c_char ,
318- size : u32 ,
319- row : TAOS_ROW ,
320- fields : * mut TAOS_FIELD ,
321- num_fields : c_int ,
322- ) -> c_int {
323- todo ! ( )
324- }
325-
326330#[ no_mangle]
327331pub extern "C" fn taos_stop_query ( res : * mut TAOS_RES ) {
328332 todo ! ( )
0 commit comments