зеркало из https://github.com/microsoft/msphpsql.git
39 строки
3.3 KiB
PHP
39 строки
3.3 KiB
PHP
--TEST--
|
|
Verify Github Issue 1261 is fixed.
|
|
--DESCRIPTION--
|
|
This test should already pass in Windows so it is mainly aimed for non-Windows settings where UTF-8 is the default encoding.
|
|
--SKIPIF--
|
|
<?php require('skipif.inc'); ?>
|
|
--FILE--
|
|
<?php
|
|
sqlsrv_configure('WarningsReturnAsErrors', 1);
|
|
sqlsrv_configure('LogSeverity', SQLSRV_LOG_SEVERITY_ALL);
|
|
require_once('MsCommon.inc');
|
|
|
|
$conn = connect(array("CharacterSet" => SQLSRV_ENC_CHAR));
|
|
|
|
# leading string >= 2045 leading to result length > 2048
|
|
# column must be VARCHAR(MAX) or VARCHAR(2048) (starts working with bigger VARCHAR(n), e.g. 2060)
|
|
# 'CharacterSet' connInfo must be set to SQLSRV_ENC_CHAR (works with UTF-8)
|
|
# COLLATE must not be %UTF8% (e.g. Latin1_General_100_CI_AS_SC_UTF8 works)
|
|
|
|
$sql = "SET NOCOUNT ON;
|
|
DECLARE @val VARCHAR(8000) = REPLICATE('a', 2045) + 'ñ';
|
|
CREATE TABLE #tmpTest (testCol VARCHAR(MAX) COLLATE SQL_Latin1_General_CP1_CI_AS);
|
|
INSERT INTO #tmpTest (testCol) VALUES (@val);
|
|
SELECT * from #tmpTest;";
|
|
|
|
$stmt = sqlsrv_query($conn, $sql);
|
|
$row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC);
|
|
$errors = sqlsrv_errors(SQLSRV_ERR_ERRORS);
|
|
var_dump($row, $errors);
|
|
|
|
sqlsrv_free_stmt($stmt);
|
|
sqlsrv_close($conn);
|
|
?>
|
|
--EXPECT--
|
|
array(1) {
|
|
["testCol"]=>
|
|
string(2049) "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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