From 2e0379e2c62db0d21a6452437ca1d696e9a073f7 Mon Sep 17 00:00:00 2001 From: Michael Cuffaro Date: Fri, 1 Dec 2023 14:39:20 -0500 Subject: [PATCH] remove unnecessary check of nulltype condition --- src/lib.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7207995a..355cfc4e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2557,15 +2557,6 @@ pub async fn insert_new_row_tx( format!("No string named 'value' in {:?}", cell).into(), ))?; let nulltype = cell.get("nulltype").and_then(|n| n.as_str()); - let nulltype_condition = match nulltype { - None => None, - Some(nulltype) => Some( - compiled_datatype_conditions - .get(&nulltype.to_string()) - .and_then(|cc| Some(&cc.compiled)) - .unwrap(), - ), - }; let messages = sort_messages( &sorted_datatypes, cell.get("messages") @@ -2595,10 +2586,7 @@ pub async fn insert_new_row_tx( } match nulltype { - Some(_) if nulltype_condition.unwrap()(value) => { - insert_values.push(String::from("NULL")); - } - _ => { + None => { let sql_type = get_sql_type_from_global_config(global_config, table, column, pool) .ok_or(SqlxCErr( format!("Could not get SQL type for {}.{}", table, column).into(), @@ -2610,6 +2598,9 @@ pub async fn insert_new_row_tx( insert_params.push(String::from(value)); } } + _ => { + insert_values.push(String::from("NULL")); + } }; if !use_conflict_table && !valid && conflict_columns.contains(&json!(column)) {