2017-05-03 18:05:26 +03:00
|
|
|
--TEST--
|
|
|
|
Fix for output string parameter truncation error
|
|
|
|
--SKIPIF--
|
2017-11-29 03:40:49 +03:00
|
|
|
<?php require('skipif_versions_old.inc'); ?>
|
2017-05-03 18:05:26 +03:00
|
|
|
--FILE--
|
|
|
|
<?php
|
2017-11-29 03:40:49 +03:00
|
|
|
require_once('MsCommon.inc');
|
|
|
|
$conn = AE\connect();
|
2017-05-03 18:05:26 +03:00
|
|
|
|
2017-11-29 03:40:49 +03:00
|
|
|
dropProc($conn, 'test_output');
|
2017-05-03 18:05:26 +03:00
|
|
|
|
|
|
|
$create_proc = <<<PROC
|
|
|
|
CREATE PROC [test_output] ( @p1 CHAR(512), @p2 VARCHAR(512) OUTPUT)
|
|
|
|
AS
|
|
|
|
BEGIN
|
|
|
|
SELECT @p2 = CONVERT( VARCHAR(512), @p1 )
|
|
|
|
END
|
|
|
|
PROC;
|
2017-11-29 03:40:49 +03:00
|
|
|
$s = sqlsrv_query($conn, $create_proc);
|
|
|
|
if ($s === false) {
|
|
|
|
die(print_r(sqlsrv_errors(), true));
|
2017-05-03 18:05:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
$inValue1 = "Some data";
|
|
|
|
$outValue1 = "";
|
2017-11-29 03:40:49 +03:00
|
|
|
$s = sqlsrv_query(
|
|
|
|
$conn,
|
|
|
|
"{CALL [test_output] (?, ?)}",
|
2017-05-03 18:05:26 +03:00
|
|
|
array(array($inValue1, SQLSRV_PARAM_IN, null, SQLSRV_SQLTYPE_VARCHAR(512)),
|
2017-11-29 03:40:49 +03:00
|
|
|
array(&$outValue1, SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR), SQLSRV_SQLTYPE_VARCHAR(512)))
|
|
|
|
);
|
2017-05-03 18:05:26 +03:00
|
|
|
|
2017-11-29 03:40:49 +03:00
|
|
|
if ($s === false) {
|
|
|
|
die(print_r(sqlsrv_errors(), true));
|
2017-05-03 18:05:26 +03:00
|
|
|
}
|
|
|
|
|
2017-11-29 03:40:49 +03:00
|
|
|
print_r(strlen($outValue1));
|
2017-05-03 18:05:26 +03:00
|
|
|
|
|
|
|
echo "\n$outValue1";
|
|
|
|
|
2017-11-29 03:40:49 +03:00
|
|
|
dropProc($conn, 'test_output');
|
2017-05-03 18:05:26 +03:00
|
|
|
|
2017-11-29 03:40:49 +03:00
|
|
|
sqlsrv_free_stmt($s);
|
|
|
|
sqlsrv_close($conn);
|
2017-05-03 18:05:26 +03:00
|
|
|
|
|
|
|
?>
|
|
|
|
--EXPECT--
|
|
|
|
512
|
|
|
|
Some data
|