2017-01-11 00:59:16 +03:00
|
|
|
--TEST--
|
|
|
|
uses an input/output parameter
|
|
|
|
--SKIPIF--
|
2017-10-04 23:16:25 +03:00
|
|
|
<?php require('skipif_mid-refactor.inc'); ?>
|
2017-01-11 00:59:16 +03:00
|
|
|
--FILE--
|
|
|
|
<?php
|
2017-10-04 23:16:25 +03:00
|
|
|
require_once("MsCommon_mid-refactor.inc");
|
2017-01-11 00:59:16 +03:00
|
|
|
|
2017-10-04 23:16:25 +03:00
|
|
|
try {
|
|
|
|
$dbh = connect();
|
2017-01-11 00:59:16 +03:00
|
|
|
|
2017-10-04 23:16:25 +03:00
|
|
|
dropProc($dbh, "sp_ReverseString");
|
|
|
|
$dbh->query("CREATE PROCEDURE dbo.sp_ReverseString @String as VARCHAR(2048) OUTPUT as SELECT @String = REVERSE(@String)");
|
|
|
|
$stmt = $dbh->prepare("EXEC dbo.sp_ReverseString ?");
|
|
|
|
$string = "123456789";
|
|
|
|
$stmt->bindParam(1, $string, PDO::PARAM_STR | PDO::PARAM_INPUT_OUTPUT, 2048);
|
|
|
|
$stmt->execute();
|
|
|
|
print "Result: ".$string."\n"; // Expect 987654321
|
2017-01-11 00:59:16 +03:00
|
|
|
|
2017-10-04 23:16:25 +03:00
|
|
|
//free the statement and connection
|
|
|
|
unset($stmt);
|
|
|
|
unset($conn);
|
|
|
|
} catch (PDOException $e) {
|
|
|
|
var_dump($e->errorInfo);
|
|
|
|
}
|
2017-01-11 00:59:16 +03:00
|
|
|
?>
|
|
|
|
--EXPECT--
|
|
|
|
Result: 987654321
|