Skip to content

Commit

Permalink
remove unnecessary check of nulltype condition
Browse files Browse the repository at this point in the history
  • Loading branch information
lmcmicu committed Dec 1, 2023
1 parent 2249fd4 commit 2e0379e
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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(),
Expand All @@ -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)) {
Expand Down

0 comments on commit 2e0379e

Please sign in to comment.