DB oci8 limitQuery() problem

From: Date: Sun, 14 Mar 2004 17:04:36 +0000
Subject: DB oci8 limitQuery() problem
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-26409@lists.php.net to get a copy of this message
Hi! Using limitQuery with sql statement which contins placeholders results in an error. This is because modifyLimitQuery executes "SELECT * FROM ($query) WHERE NULL = NULL" to find result column names, but at that point placeholers aren't replaced with bind vars yet. Which do you think would be the best way to solve this? 1. skip getting field names & modify user's query to $query = "SELECT * FROM".
         "  (SELECT rownum as pear_db_linenum, * FROM".
         "      ($query)".
         '  WHERE rownum <= '. ($from + $count) .
         ') WHERE pear_db_linenum >= ' . ++$from;
and then remove "pear_db_linenum" from the result obtained from database. Would fetchInto() be the right place to do this? 2. Parse field names from given sql statement. This would also return "linenum" if "*" is used for field name, so the forst option may be better. 3. Pass query params to modifyLimitQuery() and call query() with the existing "WHERE NULL=NULL" query; then get $result from the returned DB_result object and use it to get column names. 4. Call prepare() and use code from execute() for setting variables (probbably by putting that code in a separate function to avoid duplication); then continue with OCIParse(), OCIExecute, ... --- 1 & 4 look like the best way to go, to me. The first one has the additional benefit of not having to perform the query twice. It's not a lot of work, but I'd like to hear what others think before I start changing anything. Regards, Aleksander

« previous php.pear.dev (#26409) next »