Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing WHERE object when update field has hashtag (#) in value #298

Open
swslive opened this issue Dec 11, 2018 · 1 comment
Open

Missing WHERE object when update field has hashtag (#) in value #298

swslive opened this issue Dec 11, 2018 · 1 comment

Comments

@swslive
Copy link

swslive commented Dec 11, 2018

Example:

UPDATE table SET `fname` = 'Peter #2', 
                                  dateUpdated = NOW(),
                                  updatedBy = '43'
                                WHERE tableID = '10100'

With hashtag(#) response:

object(PHPSQLParser\PHPSQLParser)#268 (2) { ["parsed"]=> array(2) { ["UPDATE"]=> array(1) { [0]=> array(10) { ["expr_type"]=> string(5) "table" ["table"]=> string(2) "table" ["no_quotes"]=> array(2) { ["delim"]=> bool(false) ["parts"]=> array(1) { [0]=> string(2) "table" } } ["alias"]=> bool(false) ["hints"]=> bool(false) ["join_type"]=> string(4) "JOIN" ["ref_type"]=> bool(false) ["ref_clause"]=> bool(false) ["base_expr"]=> string(2) "table" ["sub_tree"]=> bool(false) } } ["SET"]=> array(1) { [0]=> array(3) { ["expr_type"]=> string(10) "expression" ["base_expr"]=> string(241) "fname = 'Peter #2', dateUpdated = NOW(), updatedBy = '43' WHERE tableID = '10100' AND companiesID = 1" ["sub_tree"]=> array(7) { [0]=> array(4) { ["expr_type"]=> string(6) "colref" ["base_expr"]=> string(7) "fname" ["no_quotes"]=> array(2) { ["delim"]=> bool(false) ["parts"]=> array(1) { [0]=> string(5) "fname" } } ["sub_tree"]=> bool(false) } [1]=> array(3) { ["expr_type"]=> string(8) "operator" ["base_expr"]=> string(1) "=" ["sub_tree"]=> bool(false) } [2]=> array(3) { ["expr_type"]=> string(5) "const" ["base_expr"]=> string(117) "'Peter #2', dateUpdated = NOW(), updatedBy = '" ["sub_tree"]=> bool(false) } [3]=> array(3) { ["expr_type"]=> string(5) "const" ["base_expr"]=> string(2) "43" ["sub_tree"]=> bool(false) } [4]=> array(3) { ["expr_type"]=> string(5) "const" ["base_expr"]=> string(49) "' WHERE tableID = '" ["sub_tree"]=> bool(false) } [5]=> array(3) { ["expr_type"]=> string(5) "const" ["base_expr"]=> string(5) "10100" ["sub_tree"]=> bool(false) } [6]=> array(3) { ["expr_type"]=> string(5) "const" ["base_expr"]=> string(58) "' AND companiesID = 1" ["sub_tree"]=> bool(false) } } } } } ["options":"PHPSQLParser\PHPSQLParser":private]=> object(PHPSQLParser\Options)#266 (1) { ["options":"PHPSQLParser\Options":private]=> array(0) { } } }
No hashtag(#) response:

object(PHPSQLParser\PHPSQLParser)#268 (2) { ["parsed"]=> array(3) { ["UPDATE"]=> array(1) { [0]=> array(10) { ["expr_type"]=> string(5) "table" ["table"]=> string(2) "table" ["no_quotes"]=> array(2) { ["delim"]=> bool(false) ["parts"]=> array(1) { [0]=> string(2) "table" } } ["alias"]=> bool(false) ["hints"]=> bool(false) ["join_type"]=> string(4) "JOIN" ["ref_type"]=> bool(false) ["ref_clause"]=> bool(false) ["base_expr"]=> string(2) "table" ["sub_tree"]=> bool(false) } } ["SET"]=> array(3) { [0]=> array(3) { ["expr_type"]=> string(10) "expression" ["base_expr"]=> string(19) "fname = 'Peter 2'" ["sub_tree"]=> array(3) { [0]=> array(4) { ["expr_type"]=> string(6) "colref" ["base_expr"]=> string(7) "fname" ["no_quotes"]=> array(2) { ["delim"]=> bool(false) ["parts"]=> array(1) { [0]=> string(5) "fname" } } ["sub_tree"]=> bool(false) } [1]=> array(3) { ["expr_type"]=> string(8) "operator" ["base_expr"]=> string(1) "=" ["sub_tree"]=> bool(false) } [2]=> array(3) { ["expr_type"]=> string(5) "const" ["base_expr"]=> string(9) "'Peter 2'" ["sub_tree"]=> bool(false) } } } [1]=> array(3) { ["expr_type"]=> string(10) "expression" ["base_expr"]=> string(19) "dateUpdated = NOW()" ["sub_tree"]=> array(3) { [0]=> array(4) { ["expr_type"]=> string(6) "colref" ["base_expr"]=> string(11) "dateUpdated" ["no_quotes"]=> array(2) { ["delim"]=> bool(false) ["parts"]=> array(1) { [0]=> string(11) "dateUpdated" } } ["sub_tree"]=> bool(false) } [1]=> array(3) { ["expr_type"]=> string(8) "operator" ["base_expr"]=> string(1) "=" ["sub_tree"]=> bool(false) } [2]=> array(3) { ["expr_type"]=> string(8) "function" ["base_expr"]=> string(3) "NOW" ["sub_tree"]=> bool(false) } } } [2]=> array(3) { ["expr_type"]=> string(10) "expression" ["base_expr"]=> string(16) "updatedBy = '43'" ["sub_tree"]=> array(3) { [0]=> array(4) { ["expr_type"]=> string(6) "colref" ["base_expr"]=> string(9) "updatedBy" ["no_quotes"]=> array(2) { ["delim"]=> bool(false) ["parts"]=> array(1) { [0]=> string(9) "updatedBy" } } ["sub_tree"]=> bool(false) } [1]=> array(3) { ["expr_type"]=> string(8) "operator" ["base_expr"]=> string(1) "=" ["sub_tree"]=> bool(false) } [2]=> array(3) { ["expr_type"]=> string(5) "const" ["base_expr"]=> string(4) "'43'" ["sub_tree"]=> bool(false) } } } } ["WHERE"]=> array(7) { [0]=> array(4) { ["expr_type"]=> string(6) "colref" ["base_expr"]=> string(4) "tableID" ["no_quotes"]=> array(2) { ["delim"]=> bool(false) ["parts"]=> array(1) { [0]=> string(4) "tableID" } } ["sub_tree"]=> bool(false) } [1]=> array(3) { ["expr_type"]=> string(8) "operator" ["base_expr"]=> string(1) "=" ["sub_tree"]=> bool(false) } [2]=> array(3) { ["expr_type"]=> string(5) "const" ["base_expr"]=> string(7) "'10100'" ["sub_tree"]=> bool(false) } [3]=> array(3) { ["expr_type"]=> string(8) "operator" ["base_expr"]=> string(3) "AND" ["sub_tree"]=> bool(false) } [4]=> array(4) { ["expr_type"]=> string(6) "colref" ["base_expr"]=> string(11) "companiesID" ["no_quotes"]=> array(2) { ["delim"]=> bool(false) ["parts"]=> array(1) { [0]=> string(11) "companiesID" } } ["sub_tree"]=> bool(false) } [5]=> array(3) { ["expr_type"]=> string(8) "operator" ["base_expr"]=> string(1) "=" ["sub_tree"]=> bool(false) } [6]=> array(3) { ["expr_type"]=> string(5) "const" ["base_expr"]=> string(1) "1" ["sub_tree"]=> bool(false) } } } ["options":"PHPSQLParser\PHPSQLParser":private]=> object(PHPSQLParser\Options)#266 (1) { ["options":"PHPSQLParser\Options":private]=> array(0) { } } }

@barbazul
Copy link

barbazul commented Jul 3, 2019

I can confirm this issue used to happen, but not since 4.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants