From b74cd09814d5d10d5fda958c5e4e6b44e0b079b9 Mon Sep 17 00:00:00 2001 From: Michael Cuffaro Date: Tue, 31 Oct 2023 09:39:27 -0400 Subject: [PATCH] small tweaks --- src/lib.rs | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 86fe95a9..d53916cd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -837,15 +837,15 @@ fn get_sql_for_standard_view(table: &str, pool: &AnyPool) -> (String, String) { (drop_view_sql, create_view_sql) } -/// Given the name of a table and a database connection pool, generate SQL for creating a more -/// user-friendly version of the view that is generated by [get_sql_for_standard_view()]. -/// Unlike the standard view generated by that function, the view generated by this function -/// (called my_table_user_view) always shows all of the values of every column in the table, even -/// when those values contain errors. Also unlike the standard view, the datatypes of all columns -/// in the user view are TEXT (this is what makes it possible to always display error values). -/// Like the function for generating a standard view, the SQL generated by this function is in the -/// form of a tuple of Strings, with the first string being a SQL statement for dropping the view, -/// and the second string being a SQL statement for creating it. +/// Given the tables configuration map, the name of a table and a database connection pool, +/// generate SQL for creating a more user-friendly version of the view that is generated by +/// [get_sql_for_standard_view()]. Unlike the standard view generated by that function, the view +/// generated by this function (called my_table_user_view) always shows all of the values of every +/// column in the table, even when those values contain errors. Also unlike the standard view, the +/// datatypes of all columns in the user view are TEXT (this is what makes it possible to always +/// display error values). Like the function for generating a standard view, the SQL generated by +/// this function is in the form of a tuple of Strings, with the first string being a SQL statement +/// for dropping the view, and the second string being a SQL statement for creating it. fn get_sql_for_user_view( tables_config: &mut SerdeMap, table: &str, @@ -2555,10 +2555,6 @@ pub async fn insert_new_row_tx( if is_sql_type_error(&sql_type, value) { insert_values.push(String::from("NULL")); } else { - let sql_type = get_sql_type_from_global_config(&global_config, &table, &column, pool) - .ok_or(SqlxCErr( - format!("Unable to determine SQL type for {}.{}", table, column).into(), - ))?; insert_values.push(cast_sql_param_from_text(&sql_type)); insert_params.push(String::from(value)); }