Skip to content

Commit

Permalink
small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
lmcmicu committed Oct 31, 2023
1 parent fb0ca93 commit b74cd09
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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));
}
Expand Down

0 comments on commit b74cd09

Please sign in to comment.