Welcome Guest, Not a member yet? Register   Sign In
database sqlsrv : add connection info "language"
#1

Hello everyone, my app work with several databases, mysql (windows), mariadb (linux) and mssql (windows). 
I can connect to sql server database but I need to connect it with the connection info "Language"=>"English" to prevent to have different formats of date to manage in my request.
The only solution I found is to modify the file vendor/codeigniter4/framework/system/Database/SQLSRV/Connection.php (method connect )
PHP Code:
        $connection = [
            'UID'                  => empty($this->username) ? '' $this->username,
            'PWD'                  => empty($this->password) ? '' $this->password,
            'Database'            => $this->database,
            'ConnectionPooling'    => $persistent 0,
            'CharacterSet'        => $charset,
            'Encrypt'              => $this->encrypt === true 0,
            'ReturnDatesAsStrings' => 1,
            'Language'=>'English',
        ]; 
This solution is not persistent with futur updates of codeigniter.
Is there a better way to connect with this extra parameter ?
In advance, thank you.
Reply
#2

Try extend system classess or replace init connection.
https://codeigniter.com/user_guide/exten...asses.html
Simple CI 4 project for beginners codeigniter-expenses ( topic )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB