Home » Database » DB_QueryTool » Bug #5037
"setLimit" is not working properly
Details
| Submitted | 2005-08-09 10:26 UTC |
|---|---|
| From | pavol at otcenas dot org |
| Assigned | quipo |
| Status | Bogus |
| Package | DB_QueryTool |
| PHP Version | 4.3.4 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2005-08-09 10:26 UTC] pavol at otcenas dot org
Description:
------------
1) PEAR list: Installed packages:
Auth 1.2.3 stable
Auth_SASL 1.0.1 stable
Console_Getopt 1.2 stable
Crypt_CHAP 1.0.0 stable
DB 1.6.8 stable
DB_QueryTool 1.0.0 stable
File 1.0.3 stable
HTML_Common 1.2.1 stable
HTML_Form 1.2.0 stable
HTML_QuickForm 3.2.5 stable
HTML_Table 1.5 stable
Log 1.8.7 stable
Mail 1.1.4 stable
PEAR 1.3.4 stable
PHP_Compat 1.3.1 stable
XML_RPC 1.1.0 stable
Test script:
---------------
// SQL Query
$query = new DB_QueryTool_Query();
$query->reset();
$query->setSelect("PC.ident pcid, ...");
$query->setTable('logz L');
$query->addLeftJoin('comps PC', '(L.ID_Comp=PC.ID)');
$query->addWhere('L.ident="'.$_REQUEST['ident'].'"');
$query->addOrder($_REQUEST['sort']);
//void setLimit( [integer $from = 0], [integer $count = 0])
$query->setLimit(0, 20);
echo $query->getQueryString();
Expected result:
----------------
Query result limited to 20 rows...
Actual result:
--------------
Fatal error: Call to a member function on a non-object in /usr/share/php/DB/QueryTool/Query.php on line 1987
[2005-08-15 17:30 UTC] pavol at otcenas dot org
It is not a space, it's just an alias...
table
logz as L == logz L
comps as PC == comps PC
[2005-08-15 20:17 UTC] pavol at otcenas dot org
Ok.
So now it is working great...
I have added $query->setDbInstance($db);
where $db is initialized PEAR::DB
Thank you wery much.
This problem is SOLVED.
!!!BUT:
There is still direct connection between "Limit" and the database. Without setting DbInstance I am not able to call $query->getQueryString(); It won't work. But it should!
Perhaps, I don't understand the class very well. So try to explain it, please.
Simply, if I want use this class just to get my query string, it is not possible, you have to have DB instance. (Well, you don't have to, unless you are not going to use Limit.) And this should be resolved somehow...
Thanx for answer.