Added workaround for the test plus use BIGINT for 64-bit systems

This commit is contained in:
Jenny Tam 2018-05-15 14:28:26 -07:00
parent bca311081d
commit 4c7c08515d
2 changed files with 21 additions and 13 deletions

View file

@ -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 = &param_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;

View file

@ -9,14 +9,6 @@ PHPT_EXEC=true
<?php require('skipif.inc'); ?>
--FILE--
<?php
if (strtoupper(substr(PHP_OS, 0, 3)) === 'LIN') {
// This test fails in Linux, but not Windows or mac. This test requires
// unixODBC 2.3.4 or above (see the list of bug fixes in www.unixodbc.org
echo "Done\n";
return;
}
require_once('MsCommon.inc');
$connectionOptions = array("CharacterSet"=> "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;