-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix crash from getting the numrow of a null buffered result set; add …
…test
- Loading branch information
1 parent
7434d06
commit c1a1a06
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--TEST-- | ||
GitHub issue #330 - get numrow of null buffered result set | ||
--DESCRIPTION-- | ||
A variation of the example in GitHub issue 330. A -1 value returned as numrow of a null buffered result set. | ||
--SKIPIF-- | ||
--FILE-- | ||
<?php | ||
require_once("tools.inc"); | ||
|
||
require_once("autonomous_setup.php"); | ||
|
||
// Connect | ||
$conn = sqlsrv_connect($serverName, $connectionInfo) ?: FatalError("Failed to connect"); | ||
|
||
$stmt = sqlsrv_query($conn, "IF EXISTS (SELECT * FROM [sys].[objects] WHERE (name LIKE 'non_existent_table_name%') AND type in (N'U')) | ||
BEGIN | ||
select 0 | ||
END", [], ['Scrollable' => SQLSRV_CURSOR_CLIENT_BUFFERED]); | ||
|
||
if ($stmt) { | ||
$hasRows = sqlsrv_has_rows($stmt); | ||
$numRows = sqlsrv_num_rows($stmt); | ||
echo "hasRows: "; | ||
var_dump($hasRows); | ||
echo "numRows: "; | ||
var_dump($numRows); | ||
} | ||
?> | ||
--EXPECT-- | ||
hasRows: bool(false) | ||
numRows: int(-1) |