@@ -44,7 +44,6 @@ enum Command {
4444    } , 
4545} 
4646
47- 
4847impl  ConnectionWorker  { 
4948    pub  async  fn  establish ( options :  OdbcConnectOptions )  -> Result < Self ,  Error >  { 
5049        let  ( establish_tx,  establish_rx)  = oneshot:: channel ( ) ; 
@@ -168,18 +167,14 @@ fn establish_connection(
168167    // to 'static, as ODBC connection borrows it. This is acceptable for long-lived 
169168    // process and mirrors SQLite approach to background workers. 
170169    let  env = Box :: leak ( Box :: new ( 
171-         odbc_api:: Environment :: new ( ) 
172-             . map_err ( |e| Error :: Configuration ( e. to_string ( ) . into ( ) ) ) ?, 
170+         odbc_api:: Environment :: new ( ) . map_err ( |e| Error :: Configuration ( e. to_string ( ) . into ( ) ) ) ?, 
173171    ) ) ; 
174172
175173    env. connect_with_connection_string ( options. connection_string ( ) ,  Default :: default ( ) ) 
176174        . map_err ( |e| Error :: Configuration ( e. to_string ( ) . into ( ) ) ) 
177175} 
178176
179- fn  process_command ( 
180-     cmd :  Command , 
181-     conn :  & odbc_api:: Connection < ' static > , 
182- )  -> bool  { 
177+ fn  process_command ( cmd :  Command ,  conn :  & odbc_api:: Connection < ' static > )  -> bool  { 
183178    match  cmd { 
184179        Command :: Ping  {  tx }  => handle_ping ( conn,  tx) , 
185180        Command :: Begin  {  tx }  => handle_transaction ( conn,  "BEGIN" ,  tx) , 
@@ -232,7 +227,7 @@ fn handle_prepare(
232227        } 
233228        Err ( e)  => Err ( Error :: from ( e) ) , 
234229    } ; 
235-      
230+ 
236231    let  _ = tx. send ( result) ; 
237232} 
238233
@@ -244,7 +239,6 @@ fn execute_simple(conn: &odbc_api::Connection<'static>, sql: &str) -> Result<(),
244239    } 
245240} 
246241
247- 
248242// SQL execution functions 
249243fn  execute_sql ( 
250244    conn :  & odbc_api:: Connection < ' static > , 
@@ -253,15 +247,14 @@ fn execute_sql(
253247    tx :  & flume:: Sender < Result < Either < OdbcQueryResult ,  OdbcRow > ,  Error > > , 
254248)  { 
255249    let  params = prepare_parameters ( args) ; 
256-      
250+ 
257251    if  params. is_empty ( )  { 
258252        dispatch_execute ( conn,  sql,  ( ) ,  tx) ; 
259253    }  else  { 
260254        dispatch_execute ( conn,  sql,  & params[ ..] ,  tx) ; 
261255    } 
262256} 
263257
264- 
265258fn  prepare_parameters ( 
266259    args :  Option < OdbcArguments > , 
267260)  -> Vec < Box < dyn  odbc_api:: parameter:: InputParameter > >  { 
@@ -295,33 +288,27 @@ fn dispatch_execute<P>(
295288    } 
296289} 
297290
298- 
299291fn  handle_cursor < C > ( 
300292    cursor :  & mut  C , 
301293    tx :  & flume:: Sender < Result < Either < OdbcQueryResult ,  OdbcRow > ,  Error > > , 
302294)  where 
303295    C :  Cursor  + ResultSetMetadata , 
304296{ 
305297    let  columns = collect_columns ( cursor) ; 
306-      
298+ 
307299    if  let  Err ( e)  = stream_rows ( cursor,  & columns,  tx)  { 
308300        send_error ( tx,  e) ; 
309301        return ; 
310302    } 
311-      
303+ 
312304    send_empty_result ( tx) ; 
313305} 
314306
315- fn  send_empty_result ( 
316-     tx :  & flume:: Sender < Result < Either < OdbcQueryResult ,  OdbcRow > ,  Error > > , 
317- )  { 
307+ fn  send_empty_result ( tx :  & flume:: Sender < Result < Either < OdbcQueryResult ,  OdbcRow > ,  Error > > )  { 
318308    let  _ = tx. send ( Ok ( Either :: Left ( OdbcQueryResult  {  rows_affected :  0  } ) ) ) ; 
319309} 
320310
321- fn  send_error ( 
322-     tx :  & flume:: Sender < Result < Either < OdbcQueryResult ,  OdbcRow > ,  Error > > , 
323-     error :  Error , 
324- )  { 
311+ fn  send_error ( tx :  & flume:: Sender < Result < Either < OdbcQueryResult ,  OdbcRow > ,  Error > > ,  error :  Error )  { 
325312    let  _ = tx. send ( Err ( error) ) ; 
326313} 
327314
@@ -331,7 +318,7 @@ where
331318    C :  ResultSetMetadata , 
332319{ 
333320    let  count = cursor. num_result_cols ( ) . unwrap_or ( 0 ) ; 
334-      
321+ 
335322    ( 1 ..=count) 
336323        . map ( |i| create_column ( cursor,  i as  u16 ) ) 
337324        . collect ( ) 
@@ -343,7 +330,7 @@ where
343330{ 
344331    let  mut  cd = odbc_api:: ColumnDescription :: default ( ) ; 
345332    let  _ = cursor. describe_col ( index,  & mut  cd) ; 
346-      
333+ 
347334    OdbcColumn  { 
348335        name :  decode_column_name ( cd. name ,  index) , 
349336        type_info :  OdbcTypeInfo :: new ( cd. data_type ) , 
@@ -369,7 +356,7 @@ where
369356            columns :  columns. to_vec ( ) , 
370357            values, 
371358        } ; 
372-          
359+ 
373360        if  tx. send ( Ok ( Either :: Right ( row_data) ) ) . is_err ( )  { 
374361            // Receiver dropped, stop processing 
375362            break ; 
@@ -395,7 +382,7 @@ fn collect_column_value(
395382    column :  & OdbcColumn , 
396383)  -> Result < ( OdbcTypeInfo ,  Option < Vec < u8 > > ) ,  Error >  { 
397384    let  col_idx = ( index + 1 )  as  u16 ; 
398-      
385+ 
399386    // Try text first 
400387    match  try_get_text ( row,  col_idx)  { 
401388        Ok ( value)  => Ok ( ( column. type_info . clone ( ) ,  value) ) , 
@@ -409,10 +396,7 @@ fn collect_column_value(
409396    } 
410397} 
411398
412- fn  try_get_text ( 
413-     row :  & mut  CursorRow < ' _ > , 
414-     col_idx :  u16 , 
415- )  -> Result < Option < Vec < u8 > > ,  odbc_api:: Error >  { 
399+ fn  try_get_text ( row :  & mut  CursorRow < ' _ > ,  col_idx :  u16 )  -> Result < Option < Vec < u8 > > ,  odbc_api:: Error >  { 
416400    let  mut  buf = Vec :: new ( ) ; 
417401    match  row. get_text ( col_idx,  & mut  buf) ? { 
418402        true  => Ok ( Some ( buf) ) , 
@@ -429,4 +413,4 @@ fn try_get_binary(
429413        true  => Ok ( Some ( buf) ) , 
430414        false  => Ok ( None ) , 
431415    } 
432- } 
416+ } 
0 commit comments