diff --git a/src/functions/harms.rs b/src/functions/harms.rs index e4da237..b1e4dc4 100644 --- a/src/functions/harms.rs +++ b/src/functions/harms.rs @@ -130,60 +130,61 @@ pub fn set_harms_multi_column(connection: &SqliteConnection) -> QueryResult(&query).to_string()); -} +// #[test] +// fn examine_set_harms_multi_column() { +// let query = insert_into(harms).values(( +// id_harm.eq("123456789"), +// id_policyholder.eq("110-123456789"), +// id_callback.eq("0221 93123456789"), +// )); +// let sql = "INSERT INTO `harms` (`id_harm`, `id_policyholder`, `id_callback`) \ +// VALUES (?, ?, ?) \ +// -- binds: [\"123456789\", \"110-123456789\", \"0221 93123456789\"]"; +// assert_eq!(sql, debug_query::(&query).to_string()); +// } -pub fn set_harms_struct_json(connection: &SqliteConnection) -> Result<(), Box> { - let json = r#"{ "id_harm": "123456789", "id_policyholder": "110-123456789", "id_callback": "0221 92123456789", "date_recording": "2019-11-16 20:00:15.114957766"}"#; - let harm_struct = serde_json::from_str::(json)?; +// pub fn set_harms_struct_json(connection: &SqliteConnection) -> Result<(), Box> { +// let json = r#"{ "id_harm": "123456789", "id_policyholder": "110-123456789", "id_callback": "0221 92123456789", "date_recording": "2019-11-16 20:00:15.114957766"}"#; +// //let harm_struct = serde_json::from_str::(json)?; +// let harm_struct = serde_json::from_str::<'_>(json)?; - insert_into(harms) - .values(&harm_struct) - .execute(connection)?; +// insert_into(harms) +// .values(&harm_struct) +// .execute(connection)?; - Ok(()) -} +// Ok(()) +// } -#[test] -fn examine_set_harms_struct_json() { - let json = r#"{ "id_harm": "123456789", "id_policyholder": "110-123456789", "id_callback": "0221 93123456789", "date_recording": "2019-11-19T00:08:00", "id_user": 102, "id_user_changed": 101 }"#; - let harm_struct = serde_json::from_str::(json).unwrap(); - let query = insert_into(harms).values(&harm_struct); - let sql = - "INSERT INTO `harms` (`id_harm`, `id_policyholder`, `id_callback`, `date_recording`, `id_user`, `id_user_changed`) \ - VALUES (?, ?, ?, ?, ?, ?) \ - -- binds: [\"123456789\", \"110-123456789\", \"0221 93123456789\", 2019-11-19T00:08:00, 102, 101]"; - assert_eq!(sql, debug_query::(&query).to_string()); -} +// #[test] +// fn examine_set_harms_struct_json() { +// let json = r#"{ "id_harm": "123456789", "id_policyholder": "110-123456789", "id_callback": "0221 93123456789", "date_recording": "2019-11-19T00:08:00", "id_user": 102, "id_user_changed": 101 }"#; +// let harm_struct = serde_json::from_str::(json).unwrap(); +// let query = insert_into(harms).values(&harm_struct); +// let sql = +// "INSERT INTO `harms` (`id_harm`, `id_policyholder`, `id_callback`, `date_recording`, `id_user`, `id_user_changed`) \ +// VALUES (?, ?, ?, ?, ?, ?) \ +// -- binds: [\"123456789\", \"110-123456789\", \"0221 93123456789\", 2019-11-19T00:08:00, 102, 101]"; +// assert_eq!(sql, debug_query::(&query).to_string()); +// } -pub fn set_harms_struct_json_option(connection: &SqliteConnection) -> Result<(), Box> { - let json = r#"{ "id_harm": "123456789", "id_policyholder": null, "id_callback": null, "date_recording": "2019-11-19T00:08:00", 102, 101 }"#; - let harm_struct = serde_json::from_str::(json)?; +// pub fn set_harms_struct_json_option(connection: &SqliteConnection) -> Result<(), Box> { +// let json = r#"{ "id_harm": "123456789", "id_policyholder": null, "id_callback": null, "date_recording": "2019-11-19T00:08:00", 102, 101 }"#; +// let harm_struct = serde_json::from_str::<'_>(json)?; - insert_into(harms) - .values(&harm_struct) - .execute(connection)?; +// insert_into(harms) +// .values(&harm_struct) +// .execute(connection)?; - Ok(()) -} +// Ok(()) +// } -#[test] -fn examine_set_harms_struct_json_option() { - let json = r#"{ "id_harm": "123456789", "id_policyholder": null, "id_callback": null, "date_recording": "2019-11-19T00:08:00", "id_user": 102, "id_user_changed": 101 }"#; - let harm_struct = serde_json::from_str::(json).unwrap(); - let query = insert_into(harms).values(&harm_struct); - let sql = "INSERT INTO `harms` (`id_harm`, `date_recording`, `id_user`, `id_user_changed`) \ - VALUES (?, ?, ?, ?) \ - -- binds: [\"123456789\", 2019-11-19T00:08:00, 102, 101]"; - assert_eq!(sql, debug_query::(&query).to_string()); -} +// #[test] +// fn examine_set_harms_struct_json_option() { +// let json = r#"{ "id_harm": "123456789", "id_policyholder": null, "id_callback": null, "date_recording": "2019-11-19T00:08:00", "id_user": 102, "id_user_changed": 101 }"#; +// let harm_struct = serde_json::from_str::(json).unwrap(); +// let query = insert_into(harms).values(&harm_struct); +// let sql = "INSERT INTO `harms` (`id_harm`, `date_recording`, `id_user`, `id_user_changed`) \ +// VALUES (?, ?, ?, ?) \ +// -- binds: [\"123456789\", 2019-11-19T00:08:00, 102, 101]"; +// assert_eq!(sql, debug_query::(&query).to_string()); +// }