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

Bug #31 Ampersand in WHERE clause of Autoexecute statement causes error
Submitted: 2003-09-23 12:36 UTC
From: craiglarmer at hotmail dot com Assigned: danielc
Status: Closed Package: DB
PHP Version: 4.3.2 OS: Win NT4
Roadmaps: (Not assigned)    
Subscription  


 [2003-09-23 12:36 UTC] craiglarmer at hotmail dot com
Description: ------------ Including an Ampersand (&) in the WHERE clause of an Autoexecute statement causes error. Suggested solution is to build the WHERE clause after the prepare statement to avoid any special characters (&,?,!) in the WHERE clause being tokenised into extra array entries Reproduce code: --------------- assuming a table called WEB_CODES of structure NARR CHAR(10),MAIN_CD CHAR(3), SUB_CD CHAR(3), TYP CHAR(1) $db = DB::connect(DB_DSN); $field_list = array('narr' => 'test'); $query = $db->autoExecute('WEB_CODES',$field_list,DB_AUTOQUERY_UPDATE,"typ = '1' AND main_cd = 'B&W' AND sub_cd = 'AF4'"); Expected result: ---------------- Table to be correctly updated Actual result: -------------- DB Error: insufficient data supplied tracing thru common.php we get intermediary results as follows: in the autoPrepare function after BuildManipSQL call $query is: UPDATE WEB_CODES SET narr = ?,typ = ? WHERE typ = '1' AND main_cd = 'B&W' AND sub_cd = 'AF4' which is correct after call to prepare (as part of the return the prepare_tokens variable is: Array ( [0] => Array ( [0] => UPDATE WEB_CODES SET narr = [1] => ,typ = [2] => WHERE typ = '1' AND main_cd = 'B [3] => W' AND sub_cd = 'AF4' ) ) Where you can see that the extra [3] has been created by splitting the WHERE clause into two (at the ampersand point)

Comments

 [2003-12-20 16:55 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2004-01-04 05:54 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2004-01-21 18:44 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!