@@ -696,11 +696,7 @@ impl Statement {
696696 Ok :: < _ , napi:: Error > ( rows)
697697 } ;
698698 env. execute_tokio_future ( future, move |& mut _env, result| {
699- let mut column_names = Vec :: new ( ) ;
700- for i in 0 ..result. column_count ( ) {
701- let column_name = result. column_name ( i) . unwrap ( ) . to_string ( ) ;
702- column_names. push ( std:: ffi:: CString :: new ( column_name) . unwrap ( ) ) ;
703- }
699+ let column_names = Self :: get_column_names ( & result) ?;
704700 Ok ( RowsIterator :: new (
705701 Arc :: new ( tokio:: sync:: Mutex :: new ( result) ) ,
706702 column_names,
@@ -806,7 +802,7 @@ impl Statement {
806802 stmt. reset ( ) ;
807803 let params = map_params ( & stmt, params) ?;
808804 let mut rows = stmt. query ( params) . await . map_err ( Error :: from) ?;
809- let column_names = self . get_column_names ( & rows) ?;
805+ let column_names = Self :: get_column_names ( & rows) ?;
810806 let row = rows. next ( ) . await . map_err ( Error :: from) ?;
811807 let duration = start. elapsed ( ) . as_secs_f64 ( ) ;
812808 let result = match row {
@@ -853,7 +849,7 @@ impl Statement {
853849 Ok ( ( ) )
854850 }
855851
856- fn get_column_names ( & self , rows : & libsql:: Rows ) -> Result < Vec < std:: ffi:: CString > > {
852+ fn get_column_names ( rows : & libsql:: Rows ) -> Result < Vec < std:: ffi:: CString > > {
857853 let mut column_names = Vec :: new ( ) ;
858854 for i in 0 ..rows. column_count ( ) {
859855 let column_name = match rows. column_name ( i) {
0 commit comments