bcit-ci / CodeIgniter

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
18.27k stars 7.6k forks source link

SQLSRV driver returns decimals without leading zero #6151

Open daveherman71 opened 2 years ago

daveherman71 commented 2 years ago

The SQLSRV driver returns decimals and money fields without the leading 0.

To fix this we require the FormatDecimals parameter to be passed in the sqlsrv_driver.php file.

        $connection = array(
            'UID'           => empty($this->username) ? '' : $this->username,
            'PWD'           => empty($this->password) ? '' : $this->password,
            'Database'      => $this->database,
            'ConnectionPooling' => ($pooling === TRUE) ? 1 : 0,
            'CharacterSet'      => $charset,
            'Encrypt'       => ($this->encrypt === TRUE) ? 1 : 0,
            'FormatDecimals'    => 1,
            'ReturnDatesAsStrings'  => 1
        );