Thanks to the community’s input, this release expands drivers functionalities and also includes some bug fixes:
- SQLSRV_ATTR_FETCHES_NUMERIC_TYPE connection attribute flag is added to PDO_SQLSRV driver to handle numeric fetches from columns with numeric Sql types (only bit, integer, smallint, tinyint, float and real). This flag can be turned on by setting its value in PDO::setAttribute to true, For example,
If SQLSRV_ATTR_FETCHES_NUMERIC_TYPE is set to true the results from an integer column will be represented as an int, likewise, Sql types float and real will be represented as float.
Note for exceptions:
- When connection option flag ATTR_STRINGIFY_FETCHES is on, even when SQLSRV_ATTR_FETCHES_NUMERIC_TYPE is on, the return value will still be string.
- When the returned PDO type in bind column is PDO_PARAM_INT, the return value from a integer column will be int even if SQLSRV_ATTR_FETCHES_NUMERIC_TYPE is off.
- Fixed float truncation when using buffered query.
- Fixed handling of Unicode strings and binary when emulate prepare is on in PDOStatement::bindParam. To bind a unicode string, PDO::SQLSRV_ENCODING_UTF8 should be set using $driverOption, and to bind a string to column of Sql type binary, PDO::SQLSRV_ENCODING_BINARY should be set.
- Fixed string truncation in bind output parameters when the size is not set and the length of initialized variable is less than the output.
- Fixed bind string parameters as bidirectional parameters (PDO::PARAM_INPUT_OUTPUT) in PDO_SQLSRV driver. Note for output or bidirectional parameters, PDOStatement::closeCursor should be called to get the output value.
SQL Server Engineering Team