Refactored tests
This commit is contained in:
parent
633024c22b
commit
b2e962100d
|
@ -9,8 +9,38 @@ Test that calling nextRowset() and fetching on nonempty, empty, and null result
|
||||||
require_once("MsSetup.inc");
|
require_once("MsSetup.inc");
|
||||||
require_once("MsCommon.inc");
|
require_once("MsCommon.inc");
|
||||||
|
|
||||||
|
// These are the error messages we expect at various points below
|
||||||
|
$errorNoMoreResults = "There are no more results returned by the query.";
|
||||||
|
$errorNoFields = "The active result for the query contains no fields.";
|
||||||
|
|
||||||
|
// This function compares the expected error message and the error returned by errorInfo().
|
||||||
|
function CheckError($stmt, $expectedError=NULL)
|
||||||
|
{
|
||||||
|
$actualError = $stmt->errorInfo();
|
||||||
|
|
||||||
|
if ($actualError[2] != $expectedError) {
|
||||||
|
echo "Wrong error message:\n";
|
||||||
|
print_r($actualError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Fetch($stmt, $error=NULL)
|
||||||
|
{
|
||||||
|
echo "Fetch...\n";
|
||||||
|
$result = $stmt->fetchObject();
|
||||||
|
print_r($result);
|
||||||
|
CheckError($stmt, $error);
|
||||||
|
}
|
||||||
|
|
||||||
|
function NextResult($stmt, $error=NULL)
|
||||||
|
{
|
||||||
|
echo "Next result...\n";
|
||||||
|
$stmt->nextRowset();
|
||||||
|
CheckError($stmt, $error);
|
||||||
|
}
|
||||||
|
|
||||||
$conn = new PDO( "sqlsrv:Server = $server; Database = $databaseName; ", $uid, $pwd );
|
$conn = new PDO( "sqlsrv:Server = $server; Database = $databaseName; ", $uid, $pwd );
|
||||||
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
|
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT );
|
||||||
|
|
||||||
DropTable($conn, 'TestEmptySetTable');
|
DropTable($conn, 'TestEmptySetTable');
|
||||||
$stmt = $conn->query("CREATE TABLE TestEmptySetTable ([c1] nvarchar(10),[c2] nvarchar(10))");
|
$stmt = $conn->query("CREATE TABLE TestEmptySetTable ([c1] nvarchar(10),[c2] nvarchar(10))");
|
||||||
|
@ -38,191 +68,71 @@ $stmt = $conn->query("CREATE PROCEDURE TestEmptySetProc @a nvarchar(10), @b nvar
|
||||||
// Call fetch on a nonempty result set
|
// Call fetch on a nonempty result set
|
||||||
echo "Nonempty result set, call fetch first: ###############################\n";
|
echo "Nonempty result set, call fetch first: ###############################\n";
|
||||||
|
|
||||||
try
|
$stmt = $conn->query("TestEmptySetProc @a='a', @b='b'");
|
||||||
{
|
Fetch($stmt);
|
||||||
$stmt = $conn->query("TestEmptySetProc @a='a', @b='b'");
|
NextResult($stmt);
|
||||||
|
Fetch($stmt);
|
||||||
|
NextResult($stmt, $errorNoMoreResults);
|
||||||
|
|
||||||
echo "First fetch...\n";
|
// Call nextRowset on a nonempty result set
|
||||||
$result = $stmt->fetchObject();
|
echo "Nonempty result set, call nextRowset first: #########################\n";
|
||||||
print_r($result);
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
$stmt = $conn->query("TestEmptySetProc @a='a', @b='b'");
|
||||||
$stmt->nextRowset();
|
NextResult($stmt);
|
||||||
|
Fetch($stmt);
|
||||||
|
NextResult($stmt, $errorNoMoreResults);
|
||||||
|
|
||||||
echo "Fetch...\n";
|
// Call nextRowset twice in succession on a nonempty result set
|
||||||
$result = $stmt->fetch();
|
echo "Nonempty result set, call nextRowset twice: #########################\n";
|
||||||
print_r($result);
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
$stmt = $conn->query("TestEmptySetProc @a='a', @b='b'");
|
||||||
$stmt->nextRowset();
|
NextResult($stmt);
|
||||||
}
|
NextResult($stmt, $errorNoMoreResults);
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
echo $e->getMessage()."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call next_result on a nonempty result set
|
|
||||||
echo "Nonempty result set, call next_result first: #########################\n";
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$stmt = $conn->query("TestEmptySetProc @a='a', @b='b'");
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
$stmt->nextRowset();
|
|
||||||
|
|
||||||
echo "Fetch...\n";
|
|
||||||
$result = $stmt->fetchObject();
|
|
||||||
print_r($result);
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
$stmt->nextRowset();
|
|
||||||
}
|
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
echo $e->getMessage()."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call next_result twice in succession on a nonempty result set
|
|
||||||
echo "Nonempty result set, call next_result twice: #########################\n";
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$stmt = $conn->query("TestEmptySetProc @a='a', @b='b'");
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
$stmt->nextRowset();
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
$stmt->nextRowset();
|
|
||||||
}
|
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
echo $e->getMessage()."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call fetch on an empty result set
|
// Call fetch on an empty result set
|
||||||
echo "Empty result set, call fetch first: ##################################\n";
|
echo "Empty result set, call fetch first: ##################################\n";
|
||||||
|
|
||||||
try
|
$stmt = $conn->query("TestEmptySetProc @a='a', @b='w'");
|
||||||
{
|
Fetch($stmt);
|
||||||
$stmt = $conn->query("TestEmptySetProc @a='a', @b='w'");
|
NextResult($stmt);
|
||||||
|
Fetch($stmt);
|
||||||
|
NextResult($stmt, $errorNoMoreResults);
|
||||||
|
|
||||||
echo "First fetch...\n";
|
// Call nextRowset on an empty result set
|
||||||
$result = $stmt->fetchObject();
|
echo "Empty result set, call nextRowset first: ############################\n";
|
||||||
print_r($result);
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
$stmt = $conn->query("TestEmptySetProc @a='a', @b='w'");
|
||||||
$stmt->nextRowset();
|
NextResult($stmt);
|
||||||
|
Fetch($stmt);
|
||||||
|
NextResult($stmt, $errorNoMoreResults);
|
||||||
|
|
||||||
echo "Fetch...\n";
|
// Call nextRowset twice in succession on an empty result set
|
||||||
$result = $stmt->fetchObject();
|
echo "Empty result set, call nextRowset twice: ############################\n";
|
||||||
print_r($result);
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
$stmt = $conn->query("TestEmptySetProc @a='a', @b='w'");
|
||||||
$stmt->nextRowset();
|
NextResult($stmt);
|
||||||
}
|
NextResult($stmt, $errorNoMoreResults);
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
echo $e->getMessage()."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call next_result on an empty result set
|
|
||||||
echo "Empty result set, call next_result first: ############################\n";
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$stmt = $conn->query("TestEmptySetProc @a='a', @b='w'");
|
|
||||||
|
|
||||||
echo "First go to next result...\n";
|
|
||||||
$stmt->nextRowset();
|
|
||||||
|
|
||||||
echo "Fetch...\n";
|
|
||||||
$result = $stmt->fetchObject();
|
|
||||||
print_r($result);
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
$stmt->nextRowset();
|
|
||||||
}
|
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
echo $e->getMessage()."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call next_result twice in succession on an empty result set
|
|
||||||
echo "Empty result set, call next_result twice: ############################\n";
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$stmt = $conn->query("TestEmptySetProc @a='a', @b='w'");
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
$stmt->nextRowset();
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
$stmt->nextRowset();
|
|
||||||
}
|
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
echo $e->getMessage()."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call fetch on a null result set
|
// Call fetch on a null result set
|
||||||
echo "Null result set, call fetch first: ###################################\n";
|
echo "Null result set, call fetch first: ###################################\n";
|
||||||
|
|
||||||
try
|
$stmt = $conn->query("TestEmptySetProc @a='a', @b='c'");
|
||||||
{
|
Fetch($stmt, $errorNoFields);
|
||||||
$stmt = $conn->query("TestEmptySetProc @a='a', @b='c'");
|
NextResult($stmt);
|
||||||
|
|
||||||
echo "Fetch...\n";
|
// Call nextRowset on a null result set
|
||||||
$result = $stmt->fetchObject();
|
|
||||||
print_r($result);
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
$stmt->nextRowset();
|
|
||||||
}
|
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
echo $e->getMessage()."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call next_result on a null result set
|
|
||||||
echo "Null result set, call next result first: #############################\n";
|
echo "Null result set, call next result first: #############################\n";
|
||||||
|
|
||||||
try
|
$stmt = $conn->query("TestEmptySetProc @a='a', @b='c'");
|
||||||
{
|
NextResult($stmt);
|
||||||
$stmt = $conn->query("TestEmptySetProc @a='a', @b='c'");
|
Fetch($stmt);
|
||||||
|
|
||||||
echo "Next result...\n";
|
// Call nextRowset twice in succession on a null result set
|
||||||
$stmt->nextRowset();
|
|
||||||
|
|
||||||
echo "Fetch...\n";
|
|
||||||
$result = $stmt->fetchObject();
|
|
||||||
print_r($result);
|
|
||||||
}
|
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
echo $e->getMessage()."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call next_result twice in succession on a null result set
|
|
||||||
echo "Null result set, call next result twice: #############################\n";
|
echo "Null result set, call next result twice: #############################\n";
|
||||||
|
|
||||||
try
|
$stmt = $conn->query("TestEmptySetProc @a='a', @b='c'");
|
||||||
{
|
NextResult($stmt);
|
||||||
$stmt = $conn->query("TestEmptySetProc @a='a', @b='c'");
|
NextResult($stmt, $errorNoMoreResults);
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
$stmt->nextRowset();
|
|
||||||
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
$stmt->nextRowset();
|
|
||||||
|
|
||||||
}
|
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
echo $e->getMessage()."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt = $conn->query("DROP TABLE TestEmptySetTable");
|
$stmt = $conn->query("DROP TABLE TestEmptySetTable");
|
||||||
$stmt = $conn->query("DROP PROCEDURE TestEmptySetProc");
|
$stmt = $conn->query("DROP PROCEDURE TestEmptySetProc");
|
||||||
|
@ -231,7 +141,7 @@ $conn = null;
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
Nonempty result set, call fetch first: ###############################
|
Nonempty result set, call fetch first: ###############################
|
||||||
First fetch...
|
Fetch...
|
||||||
stdClass Object
|
stdClass Object
|
||||||
(
|
(
|
||||||
[testValue] => a
|
[testValue] => a
|
||||||
|
@ -239,38 +149,31 @@ stdClass Object
|
||||||
Next result...
|
Next result...
|
||||||
Fetch...
|
Fetch...
|
||||||
Next result...
|
Next result...
|
||||||
SQLSTATE[IMSSP]: There are no more results returned by the query.
|
Nonempty result set, call nextRowset first: #########################
|
||||||
Nonempty result set, call next_result first: #########################
|
|
||||||
Next result...
|
Next result...
|
||||||
Fetch...
|
Fetch...
|
||||||
Next result...
|
Next result...
|
||||||
SQLSTATE[IMSSP]: There are no more results returned by the query.
|
Nonempty result set, call nextRowset twice: #########################
|
||||||
Nonempty result set, call next_result twice: #########################
|
|
||||||
Next result...
|
Next result...
|
||||||
Next result...
|
Next result...
|
||||||
SQLSTATE[IMSSP]: There are no more results returned by the query.
|
|
||||||
Empty result set, call fetch first: ##################################
|
Empty result set, call fetch first: ##################################
|
||||||
First fetch...
|
Fetch...
|
||||||
Next result...
|
Next result...
|
||||||
Fetch...
|
Fetch...
|
||||||
Next result...
|
Next result...
|
||||||
SQLSTATE[IMSSP]: There are no more results returned by the query.
|
Empty result set, call nextRowset first: ############################
|
||||||
Empty result set, call next_result first: ############################
|
Next result...
|
||||||
First go to next result...
|
|
||||||
Fetch...
|
Fetch...
|
||||||
Next result...
|
Next result...
|
||||||
SQLSTATE[IMSSP]: There are no more results returned by the query.
|
Empty result set, call nextRowset twice: ############################
|
||||||
Empty result set, call next_result twice: ############################
|
|
||||||
Next result...
|
Next result...
|
||||||
Next result...
|
Next result...
|
||||||
SQLSTATE[IMSSP]: There are no more results returned by the query.
|
|
||||||
Null result set, call fetch first: ###################################
|
Null result set, call fetch first: ###################################
|
||||||
Fetch...
|
Fetch...
|
||||||
SQLSTATE[IMSSP]: The active result for the query contains no fields.
|
Next result...
|
||||||
Null result set, call next result first: #############################
|
Null result set, call next result first: #############################
|
||||||
Next result...
|
Next result...
|
||||||
Fetch...
|
Fetch...
|
||||||
Null result set, call next result twice: #############################
|
Null result set, call next result twice: #############################
|
||||||
Next result...
|
Next result...
|
||||||
Next result...
|
Next result...
|
||||||
SQLSTATE[IMSSP]: There are no more results returned by the query.
|
|
|
@ -9,6 +9,61 @@ Test that calling sqlsrv_next_result() and fetching on nonempty, empty, and null
|
||||||
require_once("MsSetup.inc");
|
require_once("MsSetup.inc");
|
||||||
require_once("MsCommon.inc");
|
require_once("MsCommon.inc");
|
||||||
|
|
||||||
|
// These are the error messages we expect at various points below
|
||||||
|
$errorNoMoreResults = "There are no more results returned by the query.";
|
||||||
|
$errorNoMoreRows = "There are no more rows in the active result set. Since this result set is not scrollable, no more data may be retrieved.";
|
||||||
|
$errorNoFields = "The active result for the query contains no fields.";
|
||||||
|
|
||||||
|
// Variable function gets an error message that depends on the OS
|
||||||
|
function getFuncSeqError()
|
||||||
|
{
|
||||||
|
if ( strtoupper( substr( php_uname( 's' ),0,3 ) ) === 'WIN' ) {
|
||||||
|
return "[Microsoft][ODBC Driver Manager] Function sequence error";
|
||||||
|
} else {
|
||||||
|
return "[unixODBC][Driver Manager] Function sequence error";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$errorFuncSeq = 'getFuncSeqError';
|
||||||
|
|
||||||
|
// This function takes an array of expected error messages and compares the
|
||||||
|
// contents to the actual errors
|
||||||
|
function CheckError($expectedErrors)
|
||||||
|
{
|
||||||
|
$actualErrors = sqlsrv_errors();
|
||||||
|
|
||||||
|
if (sizeof($actualErrors) != sizeof($expectedErrors)) {
|
||||||
|
echo "Wrong size for error array\n";
|
||||||
|
print_r($actualErrors);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
foreach ($expectedErrors as $e) {
|
||||||
|
if ($actualErrors[$i]['message'] != $e) {
|
||||||
|
echo "Wrong error message:\n";
|
||||||
|
print_r($actualErrors[$i]);
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Fetch($stmt, $errors)
|
||||||
|
{
|
||||||
|
echo "Fetch...\n";
|
||||||
|
$result = sqlsrv_fetch_array($stmt);
|
||||||
|
print_r($result);
|
||||||
|
CheckError($errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
function NextResult($stmt, $errors)
|
||||||
|
{
|
||||||
|
echo "Next result...\n";
|
||||||
|
sqlsrv_next_result($stmt);
|
||||||
|
CheckError($errors);
|
||||||
|
}
|
||||||
|
|
||||||
$conn = sqlsrv_connect($server, array("Database"=>$databaseName, "uid"=>$uid, "pwd"=>$pwd));
|
$conn = sqlsrv_connect($server, array("Database"=>$databaseName, "uid"=>$uid, "pwd"=>$pwd));
|
||||||
|
|
||||||
DropTable($conn, 'TestEmptySetTable');
|
DropTable($conn, 'TestEmptySetTable');
|
||||||
|
@ -38,158 +93,79 @@ $stmt = sqlsrv_query($conn, "CREATE PROCEDURE TestEmptySetProc @a nvarchar(10),
|
||||||
echo "Nonempty result set, call fetch first: ###############################\n";
|
echo "Nonempty result set, call fetch first: ###############################\n";
|
||||||
|
|
||||||
$stmt = sqlsrv_query($conn,"TestEmptySetProc @a='a', @b='b'");
|
$stmt = sqlsrv_query($conn,"TestEmptySetProc @a='a', @b='b'");
|
||||||
|
Fetch($stmt, []);
|
||||||
echo "First fetch...\n";
|
NextResult($stmt, []);
|
||||||
$result = sqlsrv_fetch_array($stmt);//$result=sqlsrv_get_field($stmt,0);
|
Fetch($stmt, [$errorFuncSeq()]);
|
||||||
print_r($result);
|
NextResult($stmt, [$errorNoMoreResults, $errorFuncSeq()]);
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
sqlsrv_next_result($stmt);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
echo "Fetch...\n";
|
|
||||||
$result = sqlsrv_fetch_array($stmt);
|
|
||||||
print_r($result);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
sqlsrv_next_result($stmt);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
// Call next_result on a nonempty result set
|
// Call next_result on a nonempty result set
|
||||||
echo "Nonempty result set, call next_result first: #########################\n";
|
echo "Nonempty result set, call next_result first: #########################\n";
|
||||||
|
|
||||||
$stmt = sqlsrv_query($conn,"TestEmptySetProc @a='a', @b='b'");
|
$stmt = sqlsrv_query($conn,"TestEmptySetProc @a='a', @b='b'");
|
||||||
|
NextResult($stmt, []);
|
||||||
echo "Next result...\n";
|
Fetch($stmt, [$errorFuncSeq()]);
|
||||||
sqlsrv_next_result($stmt);
|
NextResult($stmt, [$errorNoMoreResults, $errorFuncSeq()]);
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
echo "Fetch...\n";
|
|
||||||
$result = sqlsrv_fetch_array($stmt);
|
|
||||||
print_r($result);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
sqlsrv_next_result($stmt);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
// Call next_result twice in succession on a nonempty result set
|
// Call next_result twice in succession on a nonempty result set
|
||||||
echo "Nonempty result set, call next_result twice: #########################\n";
|
echo "Nonempty result set, call next_result twice: #########################\n";
|
||||||
|
|
||||||
$stmt = sqlsrv_query($conn, "TestEmptySetProc @a='a', @b='b'");
|
$stmt = sqlsrv_query($conn, "TestEmptySetProc @a='a', @b='b'");
|
||||||
|
NextResult($stmt, []);
|
||||||
echo "Next result...\n";
|
NextResult($stmt, [$errorNoMoreResults]);
|
||||||
sqlsrv_next_result($stmt);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
sqlsrv_next_result($stmt);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
// Call fetch on an empty result set
|
// Call fetch on an empty result set
|
||||||
echo "Empty result set, call fetch first: ##################################\n";
|
echo "Empty result set, call fetch first: ##################################\n";
|
||||||
|
|
||||||
$stmt = sqlsrv_query($conn,"TestEmptySetProc @a='a', @b='w'");
|
$stmt = sqlsrv_query($conn,"TestEmptySetProc @a='a', @b='w'");
|
||||||
|
Fetch($stmt, []);
|
||||||
echo "First fetch...\n";
|
NextResult($stmt, []);
|
||||||
$result = sqlsrv_fetch_array($stmt);
|
Fetch($stmt, [$errorNoMoreRows]);
|
||||||
print_r($result);
|
NextResult($stmt, [$errorNoMoreResults]);
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
sqlsrv_next_result($stmt);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
echo "Fetch...\n";
|
|
||||||
$result = sqlsrv_fetch_array($stmt);
|
|
||||||
print_r($result);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
sqlsrv_next_result($stmt);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
// Call next_result on an empty result set
|
// Call next_result on an empty result set
|
||||||
echo "Empty result set, call next_result first: ############################\n";
|
echo "Empty result set, call next_result first: ############################\n";
|
||||||
|
|
||||||
$stmt = sqlsrv_query($conn,"TestEmptySetProc @a='a', @b='w'");
|
$stmt = sqlsrv_query($conn,"TestEmptySetProc @a='a', @b='w'");
|
||||||
|
NextResult($stmt, []);
|
||||||
echo "First go to next result...\n";
|
Fetch($stmt, [$errorFuncSeq()]);
|
||||||
sqlsrv_next_result($stmt);
|
NextResult($stmt, [$errorNoMoreResults, $errorFuncSeq()]);
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
echo "Fetch...\n";
|
|
||||||
$result = sqlsrv_fetch_array($stmt);
|
|
||||||
print_r($result);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
sqlsrv_next_result($stmt);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
// Call next_result twice in succession on an empty result set
|
// Call next_result twice in succession on an empty result set
|
||||||
echo "Empty result set, call next_result twice: ############################\n";
|
echo "Empty result set, call next_result twice: ############################\n";
|
||||||
|
|
||||||
$stmt = sqlsrv_query($conn, "TestEmptySetProc @a='a', @b='w'");
|
$stmt = sqlsrv_query($conn, "TestEmptySetProc @a='a', @b='w'");
|
||||||
|
NextResult($stmt, []);
|
||||||
echo "Next result...\n";
|
NextResult($stmt, [$errorNoMoreResults]);
|
||||||
sqlsrv_next_result($stmt);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
sqlsrv_next_result($stmt);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
// Call fetch on a null result set
|
// Call fetch on a null result set
|
||||||
echo "Null result set, call fetch first: ###################################\n";
|
echo "Null result set, call fetch first: ###################################\n";
|
||||||
|
|
||||||
$stmt = sqlsrv_query($conn, "TestEmptySetProc @a='a', @b='c'");
|
$stmt = sqlsrv_query($conn, "TestEmptySetProc @a='a', @b='c'");
|
||||||
|
Fetch($stmt, [$errorNoFields]);
|
||||||
echo "Fetch...\n";
|
NextResult($stmt, []);
|
||||||
$result = sqlsrv_fetch_array($stmt);
|
|
||||||
print_r($result);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
sqlsrv_next_result($stmt);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
// Call next_result on a null result set
|
// Call next_result on a null result set
|
||||||
echo "Null result set, call next result first: #############################\n";
|
echo "Null result set, call next result first: #############################\n";
|
||||||
|
|
||||||
$stmt = sqlsrv_query($conn, "TestEmptySetProc @a='a', @b='c'");
|
$stmt = sqlsrv_query($conn, "TestEmptySetProc @a='a', @b='c'");
|
||||||
|
NextResult($stmt, []);
|
||||||
echo "Next result...\n";
|
Fetch($stmt, [$errorFuncSeq()]);
|
||||||
sqlsrv_next_result($stmt);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
echo "Fetch...\n";
|
|
||||||
$result = sqlsrv_fetch_array($stmt);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
// Call next_result twice in succession on a null result set
|
// Call next_result twice in succession on a null result set
|
||||||
echo "Null result set, call next result twice: #############################\n";
|
echo "Null result set, call next result twice: #############################\n";
|
||||||
|
|
||||||
$stmt = sqlsrv_query($conn, "TestEmptySetProc @a='a', @b='c'");
|
$stmt = sqlsrv_query($conn, "TestEmptySetProc @a='a', @b='c'");
|
||||||
|
NextResult($stmt, []);
|
||||||
echo "Next result...\n";
|
NextResult($stmt, [$errorNoMoreResults]);
|
||||||
sqlsrv_next_result($stmt);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
echo "Next result...\n";
|
|
||||||
sqlsrv_next_result($stmt);
|
|
||||||
print_r(sqlsrv_errors());
|
|
||||||
|
|
||||||
$stmt = sqlsrv_query($conn, "DROP TABLE TestEmptySetTable");
|
$stmt = sqlsrv_query($conn, "DROP TABLE TestEmptySetTable");
|
||||||
$stmt = sqlsrv_query($conn, "DROP PROCEDURE TestEmptySetProc");
|
$stmt = sqlsrv_query($conn, "DROP PROCEDURE TestEmptySetProc");
|
||||||
sqlsrv_free_stmt($stmt);
|
sqlsrv_free_stmt($stmt);
|
||||||
sqlsrv_close($conn);
|
sqlsrv_close($conn);
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECT--
|
||||||
Nonempty result set, call fetch first: ###############################
|
Nonempty result set, call fetch first: ###############################
|
||||||
First fetch...
|
Fetch...
|
||||||
Array
|
Array
|
||||||
(
|
(
|
||||||
[0] => a
|
[0] => a
|
||||||
|
@ -197,231 +173,32 @@ Array
|
||||||
)
|
)
|
||||||
Next result...
|
Next result...
|
||||||
Fetch...
|
Fetch...
|
||||||
Array
|
|
||||||
(
|
|
||||||
[0] => Array
|
|
||||||
(
|
|
||||||
[0] => HY010
|
|
||||||
[SQLSTATE] => HY010
|
|
||||||
[1] => 0
|
|
||||||
[code] => 0
|
|
||||||
[2] => [%rMicrosoft|unixODBC%r][%rODBC D|D%rriver Manager]Function sequence error
|
|
||||||
[message] => [%rMicrosoft|unixODBC%r][%rODBC D|D%rriver Manager]Function sequence error
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
|
||||||
Next result...
|
Next result...
|
||||||
Array
|
|
||||||
(
|
|
||||||
[0] => Array
|
|
||||||
(
|
|
||||||
[0] => IMSSP
|
|
||||||
[SQLSTATE] => IMSSP
|
|
||||||
[1] => -26
|
|
||||||
[code] => -26
|
|
||||||
[2] => There are no more results returned by the query.
|
|
||||||
[message] => There are no more results returned by the query.
|
|
||||||
)
|
|
||||||
|
|
||||||
[1] => Array
|
|
||||||
(
|
|
||||||
[0] => HY010
|
|
||||||
[SQLSTATE] => HY010
|
|
||||||
[1] => 0
|
|
||||||
[code] => 0
|
|
||||||
[2] => [%rMicrosoft|unixODBC%r][%rODBC D|D%rriver Manager]Function sequence error
|
|
||||||
[message] => [%rMicrosoft|unixODBC%r][%rODBC D|D%rriver Manager]Function sequence error
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
|
||||||
Nonempty result set, call next_result first: #########################
|
Nonempty result set, call next_result first: #########################
|
||||||
Next result...
|
Next result...
|
||||||
Fetch...
|
Fetch...
|
||||||
Array
|
|
||||||
(
|
|
||||||
[0] => Array
|
|
||||||
(
|
|
||||||
[0] => HY010
|
|
||||||
[SQLSTATE] => HY010
|
|
||||||
[1] => 0
|
|
||||||
[code] => 0
|
|
||||||
[2] => [%rMicrosoft|unixODBC%r][%rODBC D|D%rriver Manager]Function sequence error
|
|
||||||
[message] => [%rMicrosoft|unixODBC%r][%rODBC D|D%rriver Manager]Function sequence error
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
|
||||||
Next result...
|
Next result...
|
||||||
Array
|
|
||||||
(
|
|
||||||
[0] => Array
|
|
||||||
(
|
|
||||||
[0] => IMSSP
|
|
||||||
[SQLSTATE] => IMSSP
|
|
||||||
[1] => -26
|
|
||||||
[code] => -26
|
|
||||||
[2] => There are no more results returned by the query.
|
|
||||||
[message] => There are no more results returned by the query.
|
|
||||||
)
|
|
||||||
|
|
||||||
[1] => Array
|
|
||||||
(
|
|
||||||
[0] => HY010
|
|
||||||
[SQLSTATE] => HY010
|
|
||||||
[1] => 0
|
|
||||||
[code] => 0
|
|
||||||
[2] => [%rMicrosoft|unixODBC%r][%rODBC D|D%rriver Manager]Function sequence error
|
|
||||||
[message] => [%rMicrosoft|unixODBC%r][%rODBC D|D%rriver Manager]Function sequence error
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
|
||||||
Nonempty result set, call next_result twice: #########################
|
Nonempty result set, call next_result twice: #########################
|
||||||
Next result...
|
Next result...
|
||||||
Next result...
|
Next result...
|
||||||
Array
|
|
||||||
(
|
|
||||||
[0] => Array
|
|
||||||
(
|
|
||||||
[0] => IMSSP
|
|
||||||
[SQLSTATE] => IMSSP
|
|
||||||
[1] => -26
|
|
||||||
[code] => -26
|
|
||||||
[2] => There are no more results returned by the query.
|
|
||||||
[message] => There are no more results returned by the query.
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
|
||||||
Empty result set, call fetch first: ##################################
|
Empty result set, call fetch first: ##################################
|
||||||
First fetch...
|
Fetch...
|
||||||
Next result...
|
Next result...
|
||||||
Fetch...
|
Fetch...
|
||||||
Array
|
|
||||||
(
|
|
||||||
[0] => Array
|
|
||||||
(
|
|
||||||
[0] => IMSSP
|
|
||||||
[SQLSTATE] => IMSSP
|
|
||||||
[1] => -22
|
|
||||||
[code] => -22
|
|
||||||
[2] => There are no more rows in the active result set. Since this result set is not scrollable, no more data may be retrieved.
|
|
||||||
[message] => There are no more rows in the active result set. Since this result set is not scrollable, no more data may be retrieved.
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
|
||||||
Next result...
|
Next result...
|
||||||
Array
|
|
||||||
(
|
|
||||||
[0] => Array
|
|
||||||
(
|
|
||||||
[0] => IMSSP
|
|
||||||
[SQLSTATE] => IMSSP
|
|
||||||
[1] => -26
|
|
||||||
[code] => -26
|
|
||||||
[2] => There are no more results returned by the query.
|
|
||||||
[message] => There are no more results returned by the query.
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
|
||||||
Empty result set, call next_result first: ############################
|
Empty result set, call next_result first: ############################
|
||||||
First go to next result...
|
|
||||||
Fetch...
|
|
||||||
Array
|
|
||||||
(
|
|
||||||
[0] => Array
|
|
||||||
(
|
|
||||||
[0] => HY010
|
|
||||||
[SQLSTATE] => HY010
|
|
||||||
[1] => 0
|
|
||||||
[code] => 0
|
|
||||||
[2] => [%rMicrosoft|unixODBC%r][%rODBC D|D%rriver Manager]Function sequence error
|
|
||||||
[message] => [%rMicrosoft|unixODBC%r][%rODBC D|D%rriver Manager]Function sequence error
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
|
||||||
Next result...
|
Next result...
|
||||||
Array
|
Fetch...
|
||||||
(
|
Next result...
|
||||||
[0] => Array
|
|
||||||
(
|
|
||||||
[0] => IMSSP
|
|
||||||
[SQLSTATE] => IMSSP
|
|
||||||
[1] => -26
|
|
||||||
[code] => -26
|
|
||||||
[2] => There are no more results returned by the query.
|
|
||||||
[message] => There are no more results returned by the query.
|
|
||||||
)
|
|
||||||
|
|
||||||
[1] => Array
|
|
||||||
(
|
|
||||||
[0] => HY010
|
|
||||||
[SQLSTATE] => HY010
|
|
||||||
[1] => 0
|
|
||||||
[code] => 0
|
|
||||||
[2] => [%rMicrosoft|unixODBC%r][%rODBC D|D%rriver Manager]Function sequence error
|
|
||||||
[message] => [%rMicrosoft|unixODBC%r][%rODBC D|D%rriver Manager]Function sequence error
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
|
||||||
Empty result set, call next_result twice: ############################
|
Empty result set, call next_result twice: ############################
|
||||||
Next result...
|
Next result...
|
||||||
Next result...
|
Next result...
|
||||||
Array
|
|
||||||
(
|
|
||||||
[0] => Array
|
|
||||||
(
|
|
||||||
[0] => IMSSP
|
|
||||||
[SQLSTATE] => IMSSP
|
|
||||||
[1] => -26
|
|
||||||
[code] => -26
|
|
||||||
[2] => There are no more results returned by the query.
|
|
||||||
[message] => There are no more results returned by the query.
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
|
||||||
Null result set, call fetch first: ###################################
|
Null result set, call fetch first: ###################################
|
||||||
Fetch...
|
Fetch...
|
||||||
Array
|
|
||||||
(
|
|
||||||
[0] => Array
|
|
||||||
(
|
|
||||||
[0] => IMSSP
|
|
||||||
[SQLSTATE] => IMSSP
|
|
||||||
[1] => -28
|
|
||||||
[code] => -28
|
|
||||||
[2] => The active result for the query contains no fields.
|
|
||||||
[message] => The active result for the query contains no fields.
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
|
||||||
Next result...
|
Next result...
|
||||||
Null result set, call next result first: #############################
|
Null result set, call next result first: #############################
|
||||||
Next result...
|
Next result...
|
||||||
Fetch...
|
Fetch...
|
||||||
Array
|
|
||||||
(
|
|
||||||
[0] => Array
|
|
||||||
(
|
|
||||||
[0] => HY010
|
|
||||||
[SQLSTATE] => HY010
|
|
||||||
[1] => 0
|
|
||||||
[code] => 0
|
|
||||||
[2] => [%rMicrosoft|unixODBC%r][%rODBC D|D%rriver Manager]Function sequence error
|
|
||||||
[message] => [%rMicrosoft|unixODBC%r][%rODBC D|D%rriver Manager]Function sequence error
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
|
||||||
Null result set, call next result twice: #############################
|
Null result set, call next result twice: #############################
|
||||||
Next result...
|
Next result...
|
||||||
Next result...
|
Next result...
|
||||||
Array
|
|
||||||
(
|
|
||||||
[0] => Array
|
|
||||||
(
|
|
||||||
[0] => IMSSP
|
|
||||||
[SQLSTATE] => IMSSP
|
|
||||||
[1] => -26
|
|
||||||
[code] => -26
|
|
||||||
[2] => There are no more results returned by the query.
|
|
||||||
[message] => There are no more results returned by the query.
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
|
Loading…
Reference in a new issue