2017-02-24 08:40:51 +03:00
|
|
|
|
--TEST--
|
|
|
|
|
Test stored procedure that returns a varchar
|
2017-11-30 01:40:47 +03:00
|
|
|
|
--SKIPIF--
|
|
|
|
|
<?php require('skipif_versions_old.inc'); ?>
|
2017-02-24 08:40:51 +03:00
|
|
|
|
--FILE--
|
|
|
|
|
<?php
|
2017-10-05 00:22:56 +03:00
|
|
|
|
require_once('MsCommon.inc');
|
2017-02-24 08:40:51 +03:00
|
|
|
|
|
2017-11-30 01:40:47 +03:00
|
|
|
|
function storedProcVarchar()
|
2017-02-24 08:40:51 +03:00
|
|
|
|
{
|
2017-10-05 00:22:56 +03:00
|
|
|
|
set_time_limit(0);
|
|
|
|
|
sqlsrv_configure('WarningsReturnAsErrors', 1);
|
|
|
|
|
|
|
|
|
|
// connect
|
2017-11-30 01:40:47 +03:00
|
|
|
|
$conn = AE\connect();
|
2017-02-24 08:40:51 +03:00
|
|
|
|
|
2017-11-30 01:40:47 +03:00
|
|
|
|
$procName = 'sp_varchar';
|
|
|
|
|
dropProc($conn, $procName);
|
2017-10-05 00:22:56 +03:00
|
|
|
|
|
2017-02-24 08:40:51 +03:00
|
|
|
|
$tsql = "CREATE PROC $procName (@p1 VARCHAR(37) OUTPUT, @p2 VARCHAR(21), @p3 VARCHAR(14))
|
2017-10-05 00:22:56 +03:00
|
|
|
|
AS
|
|
|
|
|
BEGIN
|
|
|
|
|
SET @p1 = CONVERT(VARCHAR(37), @p2 + @p3)
|
2017-02-24 08:40:51 +03:00
|
|
|
|
END";
|
2017-10-05 00:22:56 +03:00
|
|
|
|
$stmt = sqlsrv_query($conn, $tsql);
|
|
|
|
|
sqlsrv_free_stmt($stmt);
|
|
|
|
|
$retValue = '';
|
|
|
|
|
$stmt = sqlsrv_prepare($conn, "{CALL $procName (?, ?, ?)}", array(array(&$retValue, SQLSRV_PARAM_OUT, null, SQLSRV_SQLTYPE_NVARCHAR(38)), array('Microsoft SQL Server ', SQLSRV_PARAM_IN), array('Driver for PHP', SQLSRV_PARAM_IN)));
|
|
|
|
|
$retValue = '';
|
|
|
|
|
sqlsrv_execute($stmt);
|
2017-02-24 08:40:51 +03:00
|
|
|
|
echo("$retValue\n");
|
2017-10-05 00:22:56 +03:00
|
|
|
|
$retValue = 'Microsoft SQL Server Driver for PH';
|
|
|
|
|
sqlsrv_execute($stmt);
|
2017-02-24 08:40:51 +03:00
|
|
|
|
echo("$retValue\n");
|
2017-10-05 00:22:56 +03:00
|
|
|
|
$retValue = 'ABCDEFGHIJKLMNOPQRSTUWXYZMicrosoft ';
|
|
|
|
|
sqlsrv_execute($stmt);
|
2017-02-24 08:40:51 +03:00
|
|
|
|
echo("$retValue\n");
|
2017-10-05 00:22:56 +03:00
|
|
|
|
$retValue = 'ABCDEFGHIJKLMNOPQRSTUWXYZ_Microsoft SQL Server Driver for PHP';
|
|
|
|
|
sqlsrv_execute($stmt);
|
2017-02-24 08:40:51 +03:00
|
|
|
|
echo("$retValue\n");
|
2017-10-05 00:22:56 +03:00
|
|
|
|
$retValue = 'Microsoft SQL Server Driver for';
|
|
|
|
|
sqlsrv_execute($stmt);
|
2017-02-24 08:40:51 +03:00
|
|
|
|
echo("$retValue\n");
|
2017-10-05 00:22:56 +03:00
|
|
|
|
sqlsrv_free_stmt($stmt);
|
2017-11-30 01:40:47 +03:00
|
|
|
|
|
|
|
|
|
dropProc($conn, $procName);
|
2017-10-05 00:22:56 +03:00
|
|
|
|
sqlsrv_close($conn);
|
2017-02-24 08:40:51 +03:00
|
|
|
|
}
|
|
|
|
|
|
2017-11-30 01:40:47 +03:00
|
|
|
|
echo "\nTest begins...\n";
|
|
|
|
|
try {
|
|
|
|
|
storedProcVarchar();
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
echo $e->getMessage();
|
2017-02-24 08:40:51 +03:00
|
|
|
|
}
|
2017-11-30 01:40:47 +03:00
|
|
|
|
echo "\nDone\n";
|
2017-02-24 08:40:51 +03:00
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
--EXPECT--
|
|
|
|
|
|
2017-05-02 03:01:30 +03:00
|
|
|
|
Test begins...
|
2017-02-24 08:40:51 +03:00
|
|
|
|
Microsoft SQL Server Driver for PHP
|
|
|
|
|
Microsoft SQL Server Driver for PHP
|
|
|
|
|
Microsoft SQL Server Driver for PHP
|
|
|
|
|
Microsoft SQL Server Driver for PHP
|
|
|
|
|
Microsoft SQL Server Driver for PHP
|
|
|
|
|
|
|
|
|
|
Done
|