msphpsql/test/functional/sqlsrv/0075.phpt

50 строки
1.5 KiB
Plaintext
Исходник Обычный вид История

2017-05-03 18:05:26 +03:00
--TEST--
Fix for output string parameter truncation error
--SKIPIF--
<?php require('skipif_versions_old.inc'); ?>
2017-05-03 18:05:26 +03:00
--FILE--
<?php
require_once('MsCommon.inc');
$conn = AE\connect();
2017-05-03 18:05:26 +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;
$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 = "";
$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)),
array(&$outValue1, SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR), SQLSRV_SQLTYPE_VARCHAR(512)))
);
2017-05-03 18:05:26 +03:00
if ($s === false) {
die(print_r(sqlsrv_errors(), true));
2017-05-03 18:05:26 +03:00
}
print_r(strlen($outValue1));
2017-05-03 18:05:26 +03:00
echo "\n$outValue1";
dropProc($conn, 'test_output');
2017-05-03 18:05:26 +03:00
sqlsrv_free_stmt($s);
sqlsrv_close($conn);
2017-05-03 18:05:26 +03:00
?>
--EXPECT--
512
Some data