-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
and again: SQLSTATE[22007]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Bei der Konvertierung eines nvarchar-Datentyps in einen datetime-Datentyp liegt der Wert außerhalb des gültigen Bereichs. #4677
Comments
see https://laravel.io/forum/sql-server-date-format-issue Change Default Language of MS SQL Database User (from DE-DE) to EN-US solves the issue |
This documentation says that we can select a language for the current session/transaction; https://database.guide/how-to-set-the-current-language-in-sql-server-tsql/
We could do this here: webtrees/app/Http/Middleware/UseDatabase.php Line 110 in c8e2627 Maybe also needed here:
We could replace the |
i found this here https://stackoverflow.com/questions/34616869/set-database-connection-and-language-dynamically-in-laravel and adjusted it slightly: You can easily do that with a middleware - see some docs here: https://laravel.com/docs/master/middleware You need a middleware that would be run for all requests before controllers are executed. This middleware should configure application locale and connection used based on the domain and then execute the request. Something similar to the following logic should do the trick:
return |
@ -106,6 +106,10 @@ class UseDatabase implements MiddlewareInterface
to early Exception null Connection |
I think this code should go after the line |
yes it works
} |
SQLSTATE[22007]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Bei der Konvertierung eines nvarchar-Datentyps in einen datetime-Datentyp liegt der Wert außerhalb des gültigen Bereichs. (SQL: insert into [wt2212_session] ([session_id], [session_time], [user_id], [ip_address], [session_data]) values (57mhpi06rdmtgi4oudl7gqotum, 2022-12-22 16:21:15, 0, 127.0.0.1, initiated|b:1;))
#0 D:\GitRepos\fisharebest\webtrees\vendor\illuminate\database\Connection.php(720): Illuminate\Database\Connection->runQueryCallback('insert into [wt...', Array, Object(Closure))
#1 D:\GitRepos\fisharebest\webtrees\vendor\illuminate\database\Connection.php(546): Illuminate\Database\Connection->run('insert into [wt...', Array, Object(Closure))
#2 D:\GitRepos\fisharebest\webtrees\vendor\illuminate\database\Connection.php(498): Illuminate\Database\Connection->statement('insert into [wt...', Array)
#3 D:\GitRepos\fisharebest\webtrees\vendor\illuminate\database\Query\Builder.php(3218): Illuminate\Database\Connection->insert('insert into [wt...', Array)
#4 D:\GitRepos\fisharebest\webtrees\app\SessionDatabaseHandler.php(100): Illuminate\Database\Query\Builder->insert(Array)
#5 [internal function]: Fisharebest\Webtrees\SessionDatabaseHandler->write('57mhpi06rdmtgi4...', 'initiated|b:1;')
#6 D:\GitRepos\fisharebest\webtrees\app\Session.php(146): session_regenerate_id(false)
#7 D:\GitRepos\fisharebest\webtrees\app\Auth.php(189): Fisharebest\Webtrees\Session::regenerate()
The text was updated successfully, but these errors were encountered: