2017-02-24 06:40:51 +01:00
|
|
|
|
--TEST--
|
2017-10-04 23:22:56 +02:00
|
|
|
|
Free statement twice
|
2017-02-24 06:40:51 +01:00
|
|
|
|
--FILE--
|
|
|
|
|
<?php
|
2017-10-04 23:22:56 +02:00
|
|
|
|
require_once('MsCommon.inc');
|
2017-02-24 06:40:51 +01:00
|
|
|
|
|
|
|
|
|
function ExecuteTwice()
|
2017-10-04 23:22:56 +02:00
|
|
|
|
{
|
|
|
|
|
set_time_limit(0);
|
|
|
|
|
sqlsrv_configure('WarningsReturnAsErrors', 1);
|
2017-02-24 06:40:51 +01:00
|
|
|
|
|
|
|
|
|
// Connect
|
2017-10-04 23:22:56 +02:00
|
|
|
|
$conn = connect();
|
|
|
|
|
if (!$conn) {
|
|
|
|
|
fatalError("Could not connect.\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$tableName = GetTempTableName();
|
|
|
|
|
|
|
|
|
|
$stmt = sqlsrv_query($conn, "CREATE TABLE $tableName ([c1_int] int, [c2_tinyint] tinyint)");
|
|
|
|
|
sqlsrv_free_stmt($stmt);
|
2017-02-24 06:40:51 +01:00
|
|
|
|
|
2017-10-04 23:22:56 +02:00
|
|
|
|
$stmt = sqlsrv_query($conn, "SELECT * FROM $tableName");
|
2017-02-24 06:40:51 +01:00
|
|
|
|
sqlsrv_execute($stmt);
|
2017-10-04 23:22:56 +02:00
|
|
|
|
|
|
|
|
|
$errors = sqlsrv_errors(SQLSRV_ERR_ALL);
|
|
|
|
|
$e = $errors[0];
|
|
|
|
|
$value1 = $e['message'];
|
|
|
|
|
print "$value1\n";
|
|
|
|
|
$value2 = $e['code'];
|
|
|
|
|
print "$value2\n";
|
|
|
|
|
$value3 = $e['SQLSTATE'];
|
|
|
|
|
print "$value3\n";
|
|
|
|
|
|
|
|
|
|
sqlsrv_free_stmt($stmt);
|
|
|
|
|
sqlsrv_close($conn);
|
2017-02-24 06:40:51 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
|
// Repro
|
|
|
|
|
//
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
|
function Repro()
|
|
|
|
|
{
|
2017-10-04 23:22:56 +02:00
|
|
|
|
startTest("sqlsrv_statement_execute_twice");
|
2017-05-02 02:01:30 +02:00
|
|
|
|
echo "\nTest begins...\n";
|
2017-10-04 23:22:56 +02:00
|
|
|
|
try {
|
2017-02-24 06:40:51 +01:00
|
|
|
|
ExecuteTwice();
|
2017-10-04 23:22:56 +02:00
|
|
|
|
} catch (Exception $e) {
|
2017-02-24 06:40:51 +01:00
|
|
|
|
echo $e->getMessage();
|
|
|
|
|
}
|
|
|
|
|
echo "\nDone\n";
|
2017-10-04 23:22:56 +02:00
|
|
|
|
endTest("sqlsrv_statement_execute_twice");
|
2017-02-24 06:40:51 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Repro();
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
--EXPECT--
|
|
|
|
|
|
2017-05-02 02:01:30 +02:00
|
|
|
|
Test begins...
|
2017-02-24 06:40:51 +01:00
|
|
|
|
A statement must be prepared with sqlsrv_prepare before calling sqlsrv_execute.
|
|
|
|
|
-23
|
|
|
|
|
IMSSP
|
|
|
|
|
|
|
|
|
|
Done
|
2017-05-02 02:01:30 +02:00
|
|
|
|
Test "sqlsrv_statement_execute_twice" completed successfully.
|