Merge pull request #732 from yitam/issue705

Fix issue 705 by including the possible negative sign
This commit is contained in:
Jenny Tam 2018-04-04 14:46:20 -07:00 committed by GitHub
commit dd582409e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2535,11 +2535,14 @@ void resize_output_buffer_if_necessary( _Inout_ sqlsrv_stmt* stmt, _Inout_ zval*
// account for the NULL terminator returned by ODBC and needed by Zend to avoid a "String not null terminated" debug warning
SQLULEN field_size = column_size;
// with AE on, when column_size is retrieved from SQLDescribeParam, column_size does not include the decimal place
// include the decimal for output params by adding elem_size
if ( stmt->conn->ce_option.enabled && decimal_digits > 0 )
{
// with AE on, when column_size is retrieved from SQLDescribeParam, column_size does not include the negative sign or decimal place for numeric values
if (stmt->conn->ce_option.enabled && (sql_type == SQL_DECIMAL || sql_type == SQL_NUMERIC || sql_type == SQL_BIGINT || sql_type == SQL_INTEGER || sql_type == SQL_SMALLINT)) {
// include the possible negative sign
field_size += elem_size;
// include the decimal for output params by adding elem_size
if (decimal_digits > 0) {
field_size += elem_size;
}
}
if (column_size == SQL_SS_LENGTH_UNLIMITED) {
field_size = SQL_SERVER_MAX_FIELD_SIZE / elem_size;