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

Request #4713 builde sql use prepare feature
Submitted: 2005-06-29 21:34 UTC Modified: 2005-06-30 01:09 UTC
From: kenchou77 at gmail dot com Assigned:
Status: Verified Package: DB_DataObject
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kenchou77 at gmail dot com
New email:
PHP Version: Package Version: OS:

 

 [2005-06-29 21: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-29 21: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-29 23: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 01: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...