Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.11.5

Request #4713 builde sql use prepare feature
Submitted: 2005-06-30 02:34 UTC
From: kenchou77 at gmail dot com Assigned:
Status: Suspended Package: DB_DataObject
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2005-06-30 02:34 UTC] kenchou77 at gmail dot com
Description: ------------ prepare & execute sql(like PEAR DB Package) Reproduce code: --------------- require_once 'DB/DataObject.php'; $config = parse_ini_file('../example.ini',TRUE); foreach($config as $class=>$values) { $options = &PEAR::getStaticProperty($class,'options'); $options = $values; } $sell = DB_DataObject::factory("SELL_TABLE"); $sell->whereAdd('dele = 0'); $sell->orderBy('ID DESC'); $sell->limit(0,20); $count = $sell->find(); Expected result: ---------------- debug output: QUERY: SELECT ... FROM (SELECT rownum as linenum, ... FROM (SELECT * FROM SELL_TABLE WHERE dele = 0 ORDER BY ID DESC ) WHERE rownum <= 20) WHERE linenum >= 1 Actual result: -------------- for Oracle(and other db supported): QUERY: SELECT ... FROM (SELECT rownum as linenum, ... FROM (SELECT * FROM SELL_TABLE WHERE dele = ? ORDER BY ID DESC ) WHERE rownum <= ?) WHERE linenum >= ?

Comments

 [2005-06-30 02:47 UTC] alan_k
I dont have oracle as a test enviroment, have a look at the find method, and see if you can work out what is wrong.. I suspect it may be something to do with the modifylimitquery stuff...
 [2005-06-30 04:31 UTC] kenchou77 at gmail dot com
sorry for my mistake. Actual result: -------------- debug output: QUERY: SELECT * FROM SELL_TABLE WHERE dele = 0 ORDER BY ID DESC I hope the sql like "SELECT * FROM SELL_TABLE WHERE dele = ?" ,that can reuse by oracle.
 [2005-06-30 06:09 UTC] alan_k
ah... now I understand the request... use PEAR::DB prepare/execute rather than building the SQL for select / update etc.. - I'm open to patches...
 [2010-04-26 03:59 UTC] alan_k (Alan Knowles)
-Status: Verified +Status: Suspended
No patch available