diff --git a/source/shared/core_stmt.cpp b/source/shared/core_stmt.cpp index bc090e07..c2fc18c5 100644 --- a/source/shared/core_stmt.cpp +++ b/source/shared/core_stmt.cpp @@ -487,7 +487,7 @@ void core_sqlsrv_bind_param( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT param_ // if it is boolean, set the lval to 0 or 1 convert_to_long( param_z ); buffer = ¶m_z->value; - buffer_len = sizeof(int); // do not use size of a zend_long + buffer_len = sizeof( Z_LVAL_P( param_z )); ind_ptr = buffer_len; if( direction != SQL_PARAM_INPUT ){ // save the parameter so that 1) the buffer doesn't go away, and 2) we can set it to NULL if returned @@ -1864,8 +1864,12 @@ SQLSMALLINT default_c_type( _Inout_ sqlsrv_stmt* stmt, _In_opt_ SQLULEN paramno, sql_c_type = SQL_C_SBIGINT; } else { - sql_c_type = SQL_C_SLONG; - } +#ifdef ZEND_ENABLE_ZVAL_LONG64 + sql_c_type = SQL_C_SBIGINT; +#else + sql_c_type = SQL_C_SLONG; +#endif + } break; case IS_DOUBLE: sql_c_type = SQL_C_DOUBLE; @@ -1934,8 +1938,12 @@ void default_sql_type( _Inout_ sqlsrv_stmt* stmt, _In_opt_ SQLULEN paramno, _In_ sql_type = SQL_BIGINT; } else { +#ifdef ZEND_ENABLE_ZVAL_LONG64 + sql_type = SQL_BIGINT; +#else sql_type = SQL_INTEGER; - } +#endif + } break; case IS_DOUBLE: sql_type = SQL_FLOAT; diff --git a/test/functional/sqlsrv/srv_699_out_param_integer.phpt b/test/functional/sqlsrv/srv_699_out_param_integer.phpt index e760b9bf..bd48716b 100644 --- a/test/functional/sqlsrv/srv_699_out_param_integer.phpt +++ b/test/functional/sqlsrv/srv_699_out_param_integer.phpt @@ -9,14 +9,6 @@ PHPT_EXEC=true --FILE-- "UTF-8", "ConnectionPooling"=>1); @@ -63,7 +55,15 @@ if (!$stmt) { fatalError("Error in creating the stored procedure $procName\n"); } -$sql_callSP = "{call $procName(?)}"; +$set_no_count = ""; +if (strtoupper(substr(PHP_OS, 0, 3)) === 'LIN') { + // This test, when running outside of Windows, requires unixODBC 2.3.4 + // or above (see the list of bug fixes in www.unixodbc.org) + // Add this workaround for Linux platforms + $set_no_count = "SET NOCOUNT ON; "; +} + +$sql_callSP = $set_no_count . "{call $procName(?)}"; // Initialize the output parameter to any number $outParam = -1;