Fixed merge conflicts

This commit is contained in:
David Puglielli 2018-01-05 12:14:01 -08:00
commit bc71d659d8
26 changed files with 215 additions and 140 deletions

View file

@ -30,11 +30,12 @@ if( PHP_PDO_SQLSRV != "no" ) {
CHECK_HEADER_ADD_INCLUDE("sql.h", "CFLAGS_PDO_SQLSRV_ODBC");
CHECK_HEADER_ADD_INCLUDE("sqlext.h", "CFLAGS_PDO_SQLSRV_ODBC");
ADD_SOURCES( configure_module_dirname + "\\shared", shared_src_class, "pdo_sqlsrv" );
ADD_FLAG( "LDFLAGS_PDO_SQLSRV", "/NXCOMPAT /DYNAMICBASE /debug" );
ADD_FLAG( "LDFLAGS_PDO_SQLSRV", "/NXCOMPAT /DYNAMICBASE /debug /guard:cf" );
ADD_FLAG( "CFLAGS_PDO_SQLSRV", "/EHsc" );
ADD_FLAG( "CFLAGS_PDO_SQLSRV", "/GS" );
ADD_FLAG( "CFLAGS_PDO_SQLSRV", "/Zi" );
ADD_FLAG( "CFLAGS_PDO_SQLSRV", "/O2" );
ADD_FLAG( "CFLAGS_PDO_SQLSRV", "/guard:cf" );
ADD_FLAG( "CFLAGS_PDO_SQLSRV", "/D ZEND_WIN32_FORCE_INLINE" );
ADD_EXTENSION_DEP('pdo_sqlsrv', 'pdo');
EXTENSION("pdo_sqlsrv", pdo_sqlsrv_src_class, PHP_PDO_SQLSRV_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");

View file

@ -59,7 +59,7 @@ pdo_error PDO_ERRORS[] = {
{ IMSSP, (SQLCHAR*) "This extension requires the Microsoft ODBC Driver for SQL Server to "
"communicate with SQL Server. Access the following URL to download the ODBC Driver for SQL Server "
"for %1!s!: "
"http://go.microsoft.com/fwlink/?LinkId=163712", -1, true }
"https://go.microsoft.com/fwlink/?LinkId=163712", -1, true }
},
{
SQLSRV_ERROR_ZEND_HASH,

View file

@ -50,7 +50,7 @@ const char* PROCESSOR_ARCH[] = { "x86", "x64", "ia64" };
// ODBC driver names.
// the order of this list should match the order of DRIVER_VERSION enum
std::vector<std::string> CONNECTION_STRING_DRIVER_NAME{ "Driver={ODBC Driver 13 for SQL Server};", "Driver={ODBC Driver 11 for SQL Server};", "Driver={ODBC Driver 17 for SQL Server};" };
std::vector<std::string> CONNECTION_STRING_DRIVER_NAME{ "Driver={ODBC Driver 17 for SQL Server};", "Driver={ODBC Driver 13 for SQL Server};", "Driver={ODBC Driver 11 for SQL Server};" };
// default options if only the server is specified
const char CONNECTION_STRING_DEFAULT_OPTIONS[] = "Mars_Connection={Yes};";
@ -183,11 +183,11 @@ sqlsrv_conn* core_sqlsrv_connect( _In_ sqlsrv_context& henv_cp, _In_ sqlsrv_cont
// https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server#microsoft-odbc-driver-11-for-sql-server-on-linux
DRIVER_VERSION odbc_version = ODBC_DRIVER_UNKNOWN;
if( core_search_odbc_driver_unix( ODBC_DRIVER_13 ) ) {
odbc_version = ODBC_DRIVER_13;
}
else if ( core_search_odbc_driver_unix( ODBC_DRIVER_17 ) ) {
if( core_search_odbc_driver_unix( ODBC_DRIVER_17 ) ) {
odbc_version = ODBC_DRIVER_17;
}
else if ( core_search_odbc_driver_unix( ODBC_DRIVER_13 ) ) {
odbc_version = ODBC_DRIVER_13;
}
CHECK_CUSTOM_ERROR( odbc_version == ODBC_DRIVER_UNKNOWN, conn, SQLSRV_ERROR_DRIVER_NOT_INSTALLED, get_processor_arch() ) {

View file

@ -1043,10 +1043,10 @@ enum SERVER_VERSION {
enum DRIVER_VERSION {
ODBC_DRIVER_UNKNOWN = -1,
FIRST = 0,
ODBC_DRIVER_13 = FIRST,
ODBC_DRIVER_11 = 1,
ODBC_DRIVER_17 = 2,
LAST = ODBC_DRIVER_17
ODBC_DRIVER_17 = FIRST,
ODBC_DRIVER_13 = 1,
ODBC_DRIVER_11 = 2,
LAST = ODBC_DRIVER_11
};
// forward decl

View file

@ -35,7 +35,7 @@
// for stable releases should be empty
// "-RC" for release candidates
// "-preview" for ETP
#define SEMVER_PRERELEASE "RC"
#define SEMVER_PRERELEASE "RC1"
// Semantic versioning build metadata, build meta data is not counted in precedence order.
#define SEMVER_BUILDMETA

View file

@ -35,10 +35,10 @@ if test "$PHP_SQLSRV" != "no"; then
HOST_OS_ARCH=`uname`
if test "${HOST_OS_ARCH}" = "Darwin"; then
PDO_SQLSRV_SHARED_LIBADD="$PDO_SQLSRV_SHARED_LIBADD -Wl,-bind_at_load"
SQLSRV_SHARED_LIBADD="$SQLSRV_SHARED_LIBADD -Wl,-bind_at_load"
MACOSX_DEPLOYMENT_TARGET=`sw_vers -productVersion`
else
PDO_SQLSRV_SHARED_LIBADD="$PDO_SQLSRV_SHARED_LIBADD -Wl,-z,now"
SQLSRV_SHARED_LIBADD="$SQLSRV_SHARED_LIBADD -Wl,-z,now"
fi
PHP_REQUIRE_CXX()

View file

@ -30,12 +30,13 @@ if( PHP_SQLSRV != "no" ) {
ADD_SOURCES( configure_module_dirname + "\\shared", shared_src_class, "sqlsrv" );
CHECK_HEADER_ADD_INCLUDE("sql.h", "CFLAGS_SQLSRV_ODBC");
CHECK_HEADER_ADD_INCLUDE("sqlext.h", "CFLAGS_SQLSRV_ODBC");
ADD_FLAG( "LDFLAGS_SQLSRV", "/NXCOMPAT /DYNAMICBASE /debug" );
ADD_FLAG( "LDFLAGS_SQLSRV", "/NXCOMPAT /DYNAMICBASE /debug /guard:cf" );
ADD_FLAG( "CFLAGS_SQLSRV", "/D ZEND_WIN32_FORCE_INLINE" );
ADD_FLAG( "CFLAGS_SQLSRV", "/EHsc" );
ADD_FLAG( "CFLAGS_SQLSRV", "/GS" );
ADD_FLAG( "CFLAGS_SQLSRV", "/Zi" );
ADD_FLAG( "CFLAGS_SQLSRV", "/O2" );
ADD_FLAG( "CFLAGS_SQLSRV", "/guard:cf" );
EXTENSION("sqlsrv", sqlsrv_src_class , PHP_SQLSRV_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
} else {
WARNING("sqlsrv not enabled; libraries and headers not found");

View file

@ -302,7 +302,7 @@ ss_error SS_ERRORS[] = {
SQLSRV_ERROR_DRIVER_NOT_INSTALLED,
{ IMSSP, (SQLCHAR*) "This extension requires the Microsoft ODBC Driver for SQL Server. "
"Access the following URL to download the ODBC Driver for SQL Server for %1!s!: "
"http://go.microsoft.com/fwlink/?LinkId=163712", -49, true }
"https://go.microsoft.com/fwlink/?LinkId=163712", -49, true }
},
{

View file

@ -32,7 +32,7 @@ PDO::ATTR_ERRMODE: int\(0\)
PDO::ATTR_ERRMODE: int\(2\)
Array
\(
\[DriverDllName\] => msodbcsql[0-9]{2}\.dll|libmsodbcsql-[0-9]{2}\.[0-9]\.so\.[0-9]\.[0-9]
\[DriverDllName\]|\[DriverName\] => (msodbcsql[0-9]{2}\.dll|(libmsodbcsql-[0-9]{2}\.[0-9]\.so\.[0-9]\.[0-9]|libmsodbcsql.[0-9]{2}.dylib))
\[DriverODBCVer\] => [0-9]{1,2}\.[0-9]{1,2}
\[DriverVer\] => [0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}
\[ExtensionVer\] => [0-9].[0-9]\.[0-9](-(RC[0-9]?|preview))?(\.[0-9]+)?(\+[0-9]+)?

View file

@ -29,7 +29,7 @@ else
sqlsrv_close( $conn);
?>
--EXPECTREGEX--
DriverDllName: msodbcsql[0-9]{2}\.dll|libmsodbcsql-[0-9]{2}\.[0-9]\.so\.[0-9]\.[0-9]
DriverDllName|DriverName: (msodbcsql[0-9]{2}\.dll|(libmsodbcsql-[0-9]{2}\.[0-9]\.so\.[0-9]\.[0-9]|libmsodbcsql.[0-9]{2}.dylib))
DriverODBCVer: [0-9]{1,2}\.[0-9]{1,2}
DriverVer: [0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}
ExtensionVer: [0-9].[0-9]\.[0-9](-(RC[0-9]?|preview))?(\.[0-9]+)?(\+[0-9]+)?

View file

@ -20,7 +20,7 @@ try {
--EXPECTREGEX--
Array
\(
\[(DriverDllName|DriverName)\] => (msodbcsql1[1-9].dll|libmsodbcsql-[1-9]{2}.[0-9].so.[0-9].[0-9]|libmsodbcsql.1[1-9].dylib)
\[(DriverDllName|DriverName)\] => (msodbcsql1[1-9].dll|(libmsodbcsql-[0-9]{2}\.[0-9]\.so\.[0-9]\.[0-9]|libmsodbcsql.[0-9]{2}.dylib))
\[DriverODBCVer\] => [0-9]{1,2}\.[0-9]{1,2}
\[DriverVer\] => [0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}
\[ExtensionVer\] => [0-9].[0-9]\.[0-9](-(RC[0-9]?|preview))?(\.[0-9]+)?(\+[0-9]+)?

View file

@ -125,7 +125,7 @@ SQLSTATE\[IMSSP\]: A read-only attribute was designated on the PDO object.
Get Result PDO::ATTR_CLIENT_VERSION :
array\(4\) {
\[\"(DriverDllName|DriverName)\"\]=>
string\(15\) \"msodbcsql[0-9]{2}\.dll|string\(24\) \"libmsodbcsql-[0-9]{2}\.[0-9]\.so\.[0-9]\.[0-9]|string\(21\) \"libmsodbcsql\.1[1-9]\.dylib\"
(string\([0-9]+\) \"msodbcsql1[1-9].dll\"|string\([0-9]+\) \"(libmsodbcsql-[0-9]{2}\.[0-9]\.so\.[0-9]\.[0-9]|libmsodbcsql.[0-9]{2}.dylib)\")
\["DriverODBCVer"\]=>
string\(5\) \"[0-9]{1,2}\.[0-9]{1,2}\"
\["DriverVer"\]=>

View file

@ -78,8 +78,16 @@ if ($t === false) {
die(print_r(sqlsrv_errors(), true));
}
if ($t != "So?e sä???? ?SCII-te×t") {
die("varchar(100) doesn't match So?e sä???? ?SCII-te×t");
// If connected with AE, $t may be different in Windows and other platforms
// this is a workaround for now -- to make sure there are some '?' in $t
if (!AE\isColEncrypted() && $t !== "So?e sä???? ?SCII-te×t") {
die("varchar(100) \'$t\' doesn't match So?e sä???? ?SCII-te×t");
} else {
$arr = explode('?', $t);
if (count($arr) == 1) {
// this means there is no question mark in $t
die("varchar(100) value \'$t\' is unexpected");
}
}
$t = sqlsrv_get_field($s, 1, SQLSRV_PHPTYPE_STRING('utf-8'));
@ -87,7 +95,7 @@ if ($t === false) {
die(print_r(sqlsrv_errors(), true));
}
if ($t != $utf8) {
if ($t !== $utf8) {
die("nvarchar(100) doesn't match the inserted UTF-8 text.");
}
@ -96,7 +104,7 @@ if ($t === false) {
die(print_r(sqlsrv_errors(), true));
}
if ($t != $utf8) {
if ($t !== $utf8) {
die("nvarchar(max) doesn't match the inserted UTF-8 text.");
}
@ -129,7 +137,7 @@ if ($s === false) {
die(print_r(sqlsrv_errors(), true));
}
if ($t != $utf8) {
if ($t !== $utf8) {
die("Incorrect results from Utf8OutProc\n");
}
@ -148,7 +156,7 @@ if ($s === false) {
// retrieve all the results
while (sqlsrv_next_result($s));
if ($t != $utf8) {
if ($t !== $utf8) {
die("Incorrect results from Utf8OutWithResultsetProc\n");
}
@ -169,7 +177,7 @@ if ($s === false) {
die(print_r(sqlsrv_errors(), true));
}
if ($t != $utf8) {
if ($t !== $utf8) {
die("Incorrect results from Utf8InOutProc 1\n");
}

View file

@ -84,18 +84,6 @@ function isDaasMode()
return ($daasMode ? true : false);
}
// function isAEQualified($conn)
// {
// $msodbcsql_ver = sqlsrv_client_info($conn)['DriverVer'];
// $server_ver = sqlsrv_server_info($conn)['SQLServerVersion'];
// $msodbcsql_maj = explode(".", $msodbcsql_ver)[0];
// $msodbcsql_min = explode(".", $msodbcsql_ver)[1];
// if ($msodbcsql_maj < 17 || explode('.', $server_ver)[0] < 13) {
// return false;
// }
// return true;
// }
function startTest($testName)
{
if (traceMode()) {
@ -454,11 +442,36 @@ function handleErrors()
}
}
function setUSAnsiLocale()
{
if (!isWindows()) {
// macOS the locale names are different in Linux or macOS
$locale = strtoupper(PHP_OS) === 'LINUX' ? "en_US.ISO-8859-1" : "en_US.ISO8859-1";
setlocale(LC_ALL, $locale);
}
}
function resetLocaleToDefault()
{
// Like setUSAnsiLocale() above, this method is only needed in non-Windows environment
if (!isWindows()) {
setlocale(LC_ALL, null);
}
}
// non-UTF8 locale support in ODBC 17 and above only
// if AE enabled, only supported in Windows (AE limitations)
function isLocaleSupported()
{
if (isWindows()) {
return true;
}
if (AE\isColEncrypted()) {
return false;
}
// now check ODBC version
$conn = AE\connect();
$msodbcsql_ver = sqlsrv_client_info($conn)['DriverVer'];
if (explode(".", $msodbcsql_ver)[0] < 17) {
return false;

View file

@ -330,12 +330,8 @@ function getSeqPlaceholders($num)
*/
function isColEncrypted()
{
global $keystore, $dataEncrypted;
if ($keystore === KEYSTORE_NONE) {
return false;
} else {
return true;
}
global $keystore;
return ($keystore !== KEYSTORE_NONE);
}
/**
@ -345,11 +341,7 @@ function isColEncrypted()
function isDataEncrypted()
{
global $keystore, $dataEncrypted;
if ($keystore === KEYSTORE_NONE || !$dataEncrypted) {
return false;
} else {
return true;
}
return ($keystore !== KEYSTORE_NONE && $dataEncrypted);
}
/**

View file

@ -6,18 +6,23 @@ Validates that a prepared statement can be successfully executed more than once.
--ENV--
PHPT_EXEC=true
--SKIPIF--
<?php require('skipif_versions_old.inc'); ?>
<?php
// locale must be set before 1st connection
setUSAnsiLocale();
require('skipif_versions_old.inc');
?>
--FILE--
<?php
require_once('MsCommon.inc');
function prepareAndExecute($noPasses)
{
$testName = "Statement - Prepare and Execute";
startTest($testName);
setup();
$conn1 = AE\connect();
if (useUTF8Data()) {
$conn1 = AE\connect(array('CharacterSet'=>'UTF-8'));
} else {
$conn1 = AE\connect();
}
$tableName = 'TC34test';
AE\createTestTable($conn1, $tableName);
@ -80,20 +85,36 @@ function prepareAndExecute($noPasses)
dropTable($conn1, $tableName);
sqlsrv_close($conn1);
endTest($testName);
}
if (!isWindows()) {
setUTF8Data(true);
// locale must be set before 1st connection
setUSAnsiLocale();
$testName = "Statement - Prepare and Execute";
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
startTest($testName);
if (isLocaleSupported()) {
try {
setUTF8Data(false);
prepareAndExecute(5);
} catch (Exception $e) {
echo $e->getMessage();
}
}
endTest($testName);
// test utf8
startTest($testName);
try {
setUTF8Data(true);
resetLocaleToDefault();
prepareAndExecute(5);
} catch (Exception $e) {
echo $e->getMessage();
}
setUTF8Data(false);
endTest($testName);
?>
--EXPECT--
Test "Statement - Prepare and Execute" completed successfully.
Test "Statement - Prepare and Execute" completed successfully.

View file

@ -6,20 +6,20 @@ retrieving fields from a table including rows with all supported SQL types (28 t
--ENV--
PHPT_EXEC=true
--SKIPIF--
<?php require('skipif_versions_old.inc'); ?>
<?php
// locale must be set before 1st connection
setUSAnsiLocale();
require('skipif_versions_old.inc');
?>
--FILE--
<?php
require_once('MsCommon.inc');
function fetchFields()
{
$testName = "Fetch - Field";
startTest($testName);
setup();
$tableName = 'TC42test';
if (! isWindows()) {
if (useUTF8Data()) {
$conn1 = AE\connect(array('CharacterSet'=>'UTF-8'));
} else {
$conn1 = AE\connect();
@ -63,16 +63,36 @@ function fetchFields()
dropTable($conn1, $tableName);
sqlsrv_close($conn1);
endTest($testName);
}
// locale must be set before 1st connection
setUSAnsiLocale();
$testName = "Fetch - Field";
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
startTest($testName);
if (isLocaleSupported()) {
try {
setUTF8Data(false);
fetchFields();
} catch (Exception $e) {
echo $e->getMessage();
}
}
endTest($testName);
// test utf8
startTest($testName);
try {
setUTF8Data(true);
resetLocaleToDefault();
fetchFields();
} catch (Exception $e) {
echo $e->getMessage();
}
endTest($testName);
?>
--EXPECT--
Test "Fetch - Field" completed successfully.
Test "Fetch - Field" completed successfully.

View file

@ -5,9 +5,8 @@ PHPT_EXEC=true
--SKIPIF--
<?
// locale must be set before 1st connection
if ( !isWindows() ) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
setUSAnsiLocale();
require('skipif_versions_old.inc');
?>
--FILE--
<?php
@ -96,15 +95,12 @@ function checkData($col, $actual, $expected)
return ($success);
}
if (!isWindows()) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
setUSAnsiLocale();
$testName = "Fetch - Field Data";
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
startTest($testName);
if (isWindows() || isLocaleSupported()) {
if (isLocaleSupported()) {
try {
setUTF8Data(false);
@ -119,6 +115,7 @@ endTest($testName);
startTest($testName);
try {
setUTF8Data(true);
resetLocaleToDefault();
fetchFields();
} catch (Exception $e) {
echo $e->getMessage();

View file

@ -8,9 +8,8 @@ PHPT_EXEC=true
--SKIPIF--
<?
// locale must be set before 1st connection
if ( !isWindows() ) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
setUSAnsiLocale();
require('skipif_versions_old.inc');
?>
--FILE--
<?php
@ -152,16 +151,12 @@ function checkData($row, $stmt, $index, $mode)
}
// locale must be set before 1st connection
if (!isWindows()) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
global $testName;
setUSAnsiLocale();
$testName = "Fetch - Array";
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
startTest($testName);
if (isWindows() || isLocaleSupported()) {
if (isLocaleSupported()) {
try {
setUTF8Data(false);
fetchRow(1, 4);
@ -175,6 +170,7 @@ endTest($testName);
startTest($testName);
try {
setUTF8Data(true);
resetLocaleToDefault();
fetchRow(1, 4);
} catch (Exception $e) {
echo $e->getMessage();

View file

@ -5,7 +5,11 @@ Verifies data retrieval via "sqlsrv_fetch_object".
--ENV--
PHPT_EXEC=true
--SKIPIF--
<?php require('skipif_versions_old.inc'); ?>
<?php
// locale must be set before 1st connection
setUSAnsiLocale();
require('skipif_versions_old.inc');
?>
--FILE--
<?php
require_once('MsCommon.inc');
@ -19,14 +23,10 @@ class TestClass
function fetchRow($minFetchMode, $maxFetchMode)
{
$testName = "Fetch - Object";
startTest($testName);
setup();
$tableName = 'TC45test';
if (! isWindows()) {
$conn1 = AE\connect(array( 'CharacterSet'=>'UTF-8' ));
if (useUTF8Data()) {
$conn1 = AE\connect(array('CharacterSet'=>'UTF-8'));
} else {
$conn1 = AE\connect();
}
@ -73,8 +73,6 @@ function fetchRow($minFetchMode, $maxFetchMode)
dropTable($conn1, $tableName);
sqlsrv_close($conn1);
endTest($testName);
}
@ -89,7 +87,7 @@ function fetchObject($stmt, $rows, $fields, $useClass)
$obj = sqlsrv_fetch_object($stmt);
}
if ($obj === false) {
fatalError("Row $i is missing");
fatalError("In fetchObject: Row $i is missing");
}
$values[$i] = $obj;
}
@ -103,7 +101,7 @@ function fetchArray($stmt, $rows, $fields)
for ($i = 0; $i < $rows; $i++) {
$row = sqlsrv_fetch_array($stmt);
if ($row === false) {
fatalError("Row $i is missing");
fatalError("In fetchArray: Row $i is missing");
}
$values[$i] = $row;
}
@ -127,12 +125,34 @@ function checkData($rows, $fields, $actualValues, $expectedValues)
}
}
// locale must be set before 1st connection
setUSAnsiLocale();
$testName = "Fetch - Object";
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
startTest($testName);
if (isLocaleSupported()) {
try {
setUTF8Data(false);
fetchRow(0, 2);
} catch (Exception $e) {
echo $e->getMessage();
}
}
endTest($testName);
// test utf8
startTest($testName);
try {
setUTF8Data(true);
resetLocaleToDefault();
fetchRow(0, 2);
} catch (Exception $e) {
echo $e->getMessage();
}
endTest($testName);
?>
--EXPECT--
Test "Fetch - Object" completed successfully.
Test "Fetch - Object" completed successfully.

View file

@ -7,9 +7,8 @@ PHPT_EXEC=true
--SKIPIF--
<?
// locale must be set before 1st connection
if ( !isWindows() ) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
setUSAnsiLocale();
require('skipif_versions_old.inc');
?>
--FILE--
<?php
@ -85,16 +84,12 @@ function fetchFields()
}
// locale must be set before 1st connection
if (!isWindows()) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
global $testName;
setUSAnsiLocale();
$testName = "Fetch - Next Result";
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
startTest($testName);
if (isWindows() || isLocaleSupported()) {
if (isLocaleSupported()) {
try {
setUTF8Data(false);
fetchFields();
@ -108,6 +103,7 @@ endTest($testName);
startTest($testName);
try {
setUTF8Data(true);
resetLocaleToDefault();
fetchFields();
} catch (Exception $e) {
echo $e->getMessage();

View file

@ -5,19 +5,20 @@ Verifies data retrieval with scrollable result sets.
--ENV--
PHPT_EXEC=true
--SKIPIF--
<?php require('skipif_versions_old.inc'); ?>
<?php
// locale must be set before 1st connection
setUSAnsiLocale();
require('skipif_versions_old.inc');
?>
--FILE--
<?php
require_once('MsCommon.inc');
function fetchRow($noRows)
{
$testName = "Fetch - Scrollable";
startTest($testName);
setup();
$tableName = 'TC48test';
if (! isWindows()) {
if (useUTF8Data()) {
$conn1 = AE\connect(array('CharacterSet'=>'UTF-8'));
} else {
$conn1 = AE\connect();
@ -72,8 +73,6 @@ function fetchRow($noRows)
dropTable($conn1, $tableName);
sqlsrv_close($conn1);
endTest($testName);
}
function fetchArray($stmt, $rows, $fields)
@ -135,12 +134,34 @@ function checkData($rows, $fields, $actualValues, $expectedValues)
}
}
// locale must be set before 1st connection
setUSAnsiLocale();
$testName = "Fetch - Scrollable";
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
startTest($testName);
if (isLocaleSupported()) {
try {
setUTF8Data(false);
fetchRow(10);
} catch (Exception $e) {
echo $e->getMessage();
}
}
endTest($testName);
// test utf8
startTest($testName);
try {
setUTF8Data(true);
resetLocaleToDefault();
fetchRow(10);
} catch (Exception $e) {
echo $e->getMessage();
}
endTest($testName);
?>
--EXPECT--
Test "Fetch - Scrollable" completed successfully.
Test "Fetch - Scrollable" completed successfully.

View file

@ -7,9 +7,8 @@ can be successfully retrieved as streams.
PHPT_EXEC=true
--SKIPIF--
<?// locale must be set before 1st connection
if ( !isWindows() ) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
setUSAnsiLocale();
require('skipif_versions_old.inc');
?>
--FILE--
<?php
@ -125,10 +124,7 @@ function checkData($col, $actual, $expected)
}
// locale must be set before 1st connection
if (!isWindows()) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
setUSAnsiLocale();
global $testName;
$testName = "Stream - Read";
@ -138,7 +134,7 @@ $errMessage = 'Connection with Column Encryption enabled does not support fetchi
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
startTest($testName);
if (isWindows() || isLocaleSupported()) {
if (isLocaleSupported()) {
try {
setUTF8Data(false);
streamRead(20, 1);
@ -152,6 +148,7 @@ endTest($testName);
startTest($testName);
try {
setUTF8Data(true);
resetLocaleToDefault();
streamRead(20, 1);
} catch (Exception $e) {
echo $e->getMessage();

View file

@ -7,9 +7,8 @@ PHPT_EXEC=true
--SKIPIF--
<?
// locale must be set before 1st connection
if ( !isWindows() ) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
setUSAnsiLocale();
require('skipif_versions_old.inc');
?>
--FILE--
<?php
@ -162,11 +161,7 @@ function checkData($col, $actual, $expected)
}
// locale must be set before 1st connection
if (!isWindows()) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
global $testName;
setUSAnsiLocale();
$testName = "Stream - Scrollable";
// error message expected with AE enabled
@ -175,7 +170,7 @@ $errMessage = 'Connection with Column Encryption enabled does not support fetchi
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
startTest($testName);
if (isWindows() || isLocaleSupported()) {
if (isLocaleSupported()) {
try {
setUTF8Data(false);
streamScroll(20, 1);
@ -189,6 +184,7 @@ endTest($testName);
startTest($testName);
try {
setUTF8Data(true);
resetLocaleToDefault();
streamScroll(20, 1);
} catch (Exception $e) {
echo $e->getMessage();

View file

@ -15,7 +15,7 @@ var_dump( $client_info );
--EXPECTREGEX--
array\(4\) {
\[\"(DriverDllName|DriverName)\"\]=>
(string\(15\) \"msodbcsql1[1-9].dll\"|string\(24\) \"libmsodbcsql-[1-9]{2}.[0-9].so.[0-9].[0-9]\"|string\(21\) \"libmsodbcsql.1[1-9].dylib\")
(string\([0-9]+\) \"msodbcsql1[1-9].dll\"|string\([0-9]+\) \"(libmsodbcsql-[0-9]{2}\.[0-9]\.so\.[0-9]\.[0-9]|libmsodbcsql.[0-9]{2}.dylib)\")
\[\"DriverODBCVer\"\]=>
string\(5\) \"[0-9]{1,2}\.[0-9]{1,2}\"
\[\"DriverVer\"\]=>

View file

@ -3,11 +3,8 @@ streaming large amounts of data into a database and getting it out as a string e
--SKIPIF--
<?
// locale must be set before 1st connection
if ( !isWindows() ) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
php require('skipif.inc');
setUSAnsiLocale();
require('skipif.inc');
?>
--FILE--
<?php
@ -254,12 +251,10 @@ function CompareLengths($filesizes, $lens1, $lens2, $count, $useUTF8)
}
// locale must be set before 1st connection
if (!isWindows()) {
setlocale(LC_ALL, "en_US.ISO-8859-1");
}
setUSAnsiLocale();
// test ansi only if windows or non-UTF8 locales are supported (ODBC 17 and above)
if (isWindows() || isLocaleSupported()) {
if (isLocaleSupported()) {
setUTF8Data(false);
runtest();
}
@ -269,6 +264,7 @@ else {
// test utf8
setUTF8Data(true);
resetLocaleToDefault();
runtest();
?>