Home » Database » DB » Bug #756
limit queries not working in peardb using odbc
Details
| Submitted | 2004-02-14 02:14 UTC |
|---|---|
| From | gerry dot rodman at ness-usa dot com |
| Assigned | danielc |
| Status | Bogus |
| Package | DB |
| PHP Version | 5CVS-2004-02-13 (dev) |
| OS | win 2003 |
| Roadmaps | (Not assigned) |
Comments
[2004-02-14 02:14 UTC] gerry dot rodman at ness-usa dot com
Description:
------------
Running a limit query return all of the records in a table, not just the requested records. As of RC3 this code was working (only returning the request rows). Now the same limit query returns all of the rows. This bug happens using both MS Access (2003) and MS SQL.
To reproduce: Create or use and existing mdb,system dsn, and data table. The table should have more then 5 records.
Plug in repective values in included code and run.
Reproduce code:
---------------
<html>
<body>
<?
require_once 'DB.php';
$user = ''; // leave blank unless mdb is secured
$pass = ''; // leave blank unless mdb is secured
$protocol = 'odbc'; // leave as is
$db_name = 'YOUR_DSN_NAME'; // change to System DSN
$dsn = $protocol . "://" . $user . ":" . $pass . "@" . $db_name;
$db = DB::connect($dsn);
if (DB::isError($db))
{
die ($db->getDebugInfo());
}
$sql = "select * from YOUR_TABLE"; // change to match your table
$start = 3;
$count = 2;
$rs = $db->limitQuery($sql,$start,$count);
while ($row = $rs->fetchRow(DB_FETCHMODE_OBJECT)) {
echo $row->YOUR_FIELD . "<br>"; // change field name to match your table
}
?>
</body>
</html>
Expected result:
----------------
Should only see rows 3-4
Actual result:
--------------
Will see all rows
[2004-02-14 19:53 UTC] gerry dot rodman at ness-usa dot com
I did an upgrade to DB Pear. It is now working for me. I am a bit surprised that running go-pear.bat after installing the snapshot did not get the latest version of peardb however. (I would not have thought it necessary to run a pear upgrade db). Is this working as intended?
In any case, thank you for your guidance.
gr