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

Bug #4856 isManip bug with 'SELECT .* INTO'
Submitted: 2005-07-19 09:29 UTC
From: sebab at info dot com dot pl Assigned:
Status: Duplicate Package: DB
PHP Version: DB 1.7.6 OS: all
Roadmaps: (Not assigned)    
Subscription  


 [2005-07-19 09:29 UTC] sebab at info dot com dot pl
Description: ------------ calling any query execution method of DB with SELECT somefunction('something INTO') FROM table causes Fatal error: Call to a member function fetchInto() on a non-object in %path_to_pear%\PEAR\DB\common.php on line 1242 It's because such query is recognized as manipulation query and it's obviously not true. Reproduce code: --------------- for PGSQL DB, using built-in lower() function: $test=$dbh->getOne(" SELECT lower('something INTO something') "); var_dump($test); or if anyone doubt in usefulness of such query, something more real: $prj=$this->dbh->getOne(" SELECT project.project_name||lower('something INTO something') FROM project where id=1 "); where "INTO" string could came from user input for example. Expected result: ---------------- for the first case: 'something into something' for the second one: 'project_namesomething into something' for project with id=1 Actual result: -------------- Fatal error: Call to a member function fetchInto() on a non-object in %path_to_pear%\PEAR\DB\common.php on line 1242

Comments

 [2005-07-19 09:31 UTC] sebab at info dot com dot pl
updated version field
 [2005-09-28 16:01 UTC] lsmith
I presume this bug is caused by DB::isManip() and I dont see an easy way to fix this issue.
 [2005-10-13 09:01 UTC] lsmith
This bug is related, but not a duplicate, to bug #3895
 [2005-10-17 08:19 UTC] lsmith
Maybe the solution to all of this is to allow explicit hinting of if there query is a manipulation query or not.
 [2006-01-04 18:04 UTC] dustymugs dot p at dspiral dot net
A short term workaround is to modify the $manips string and append the phrase "SELECT .* INTO" with ".* FROM" so that the complete phrase is "SELECT .* INTO .* FROM". But this will still cause problems as any query that has "INTO" and then "FROM" in the statement will still error out. What is required to comprehensively fix this issue is to expand the scope of the isManip() function by accounting for single-quoted strings within the statement.
 [2006-03-11 10:10 UTC] lsmith
I am unifying all isManip bugs in bug #3895.