Doc #62764 [Com]: documented return value incorrect
| From: | frozenfire@php.net | Date: | Sat, 08 Sep 2012 16:56:47 +0000 |
| Subject: | Doc #62764 [Com]: documented return value incorrect | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-8835@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62764&edit=1
ID: 62764
Comment by: frozenfire@php.net
Reported by: doug dot pe at gmail dot com
Summary: documented return value incorrect
Status: Open
Type: Documentation Problem
Package: Documentation problem
Operating System: Ubuntu 10.04
PHP Version: 5.3.15
Block user comment: N
Private report: N
New Comment:
https://github.com/php/php-src/blob/master/ext/mssql/php_mssql.c#L1313
mssql_fetch_batch returns the number of rows in the fetched batch. Docs should be
updated to reflect that.
Previous Comments:
------------------------------------------------------------------------
[2012-08-07 00:28:51] doug dot pe at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.mssql-fetch-batch
---
(Actually, my version is listed as 5.3.2, but that's not one of the options in your drop-down.)
The documentation states that the return value is the batch number.
The comment in the example states that the return value is the number of records remaining before
the fetch.
These can't both be correct.
Test script:
---------------
<?
$connect = mssql_connect("servername", "username", "password");
// or die ("could not connect to the server");
mssql_select_db("myDatabase")
or die ("could not select a database");
$SQL = "select * from myTable"; // mytable contains 4700 rows
$result = mssql_query($SQL, $connect, 1000)
or die ("An error occurred: " . mssql_get_last_message());
$count = mssql_num_rows($result);
do {
print $count . "<br />\n";
// }
} while ($count = mssql_fetch_batch($result));
mssql_close($connect);
?>
Expected result:
----------------
If the return value is the batch number:
1000
1
2
3
4
If the return value is the number of rows remaining before the fetch:
1000
3700
2700
1700
700
Actual result:
--------------
1000
1
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62764&edit=1