Simple database wrapper for Microsoft SQL Server, MySQL, PostgreSQL, and Sqlite written in C# supporting dynamic query building and nesting using expressions.
MIT License
97
stars
26
forks
source link
DatabaseWrapper: First draft of achieving independency from locales #20
Problem to be solved
As present the DatabaseWrapper at least regarding MS Sql Server is dependent on the database on the SQL server having the same regional settings as DatabaseWrapper. The problem becomes worse when there are multiple databases with different locales.
Corresponding issue:
17
Solution
The solution resolves the problem by using parametrized SQL queries. The amount of code is about the same as when sanitizing all the inputs.
Let me note that the reduction of lines of code in DatabaseWrapper.SqlServer was not due to conversion to use parametrized SQL queries.
As soon as the SQL query parametrization is OK for DatabaseWrapper.SqlServer, I will implement it for other drivers, too.
I think removing the method TimeStamp and associated members was a mistake. I will put them back.
In the case of Postgresql, the Npsql library has changed the handling of DateTimeOffsets in version 6.0: https://www.npgsql.org/doc/types/datetime.html. The Npsql only accepts DateTimeOffsets which have 0 for Offset.
Problem to be solved As present the DatabaseWrapper at least regarding MS Sql Server is dependent on the database on the SQL server having the same regional settings as DatabaseWrapper. The problem becomes worse when there are multiple databases with different locales.
Corresponding issue:
17
Solution The solution resolves the problem by using parametrized SQL queries. The amount of code is about the same as when sanitizing all the inputs.
Let me note that the reduction of lines of code in DatabaseWrapper.SqlServer was not due to conversion to use parametrized SQL queries.
As soon as the SQL query parametrization is OK for DatabaseWrapper.SqlServer, I will implement it for other drivers, too.
I am all ears for the improvements.