DatabaseWrapper icon indicating copy to clipboard operation
DatabaseWrapper copied to clipboard

DatabaseWrapper: First draft of achieving independency from locales

Open Andrei-Errapart opened this issue 1 year ago • 3 comments

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.

Andrei-Errapart avatar Dec 27 '23 20:12 Andrei-Errapart

  1. I think removing the method TimeStamp and associated members was a mistake. I will put them back.
  2. 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.

Andrei-Errapart avatar Dec 28 '23 16:12 Andrei-Errapart

At first sight it seems to work with RestDb.

Andrei-Errapart avatar Dec 29 '23 12:12 Andrei-Errapart

Hi @Andrei-Errapart sorry for the delay on getting back to you on this one, I will do my best to get to it ASAP. I appreciate your contribution!

jchristn avatar Jan 11 '24 19:01 jchristn