msphpsql/test/functional/pdo_sqlsrv/pdo_012_bind_param.phpt

29 строки
765 B
Plaintext
Исходник Обычный вид История

2017-01-11 00:59:16 +03:00
--TEST--
uses an input/output parameter
--SKIPIF--
<?php require('skipif_mid-refactor.inc'); ?>
2017-01-11 00:59:16 +03:00
--FILE--
<?php
require_once("MsCommon_mid-refactor.inc");
2017-01-11 00:59:16 +03:00
try {
$dbh = connect();
2017-01-11 00:59:16 +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
//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