-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Bug: A wrong escape on BaseBuilder::set() #3127
Comments
Can you show how do you assign the |
That has been an issue with CI'q query builder for many years, AFAIK. You should use the increment and decrement functions instead. |
Note: Sorry my bad english and thank you your reply. @michalsn Just I wrote only my column name in MyModel::$updatedField Full code are...
CI4 built follow SQL: but, wrong(i guess) SQL was built when I wrote follow code:
@lonnieezell Thank you for point a guide! I replaced my code to increment and decrement function. maybe it is my mistake. but I want to know that this is a bug or the user's mistake. I can not see and find the warning about it. and I confused! Again, thank you a lot for reply my question! |
@smartse0k to make the story short - enabling/disabling escaping works as it should when you work directly with BaseBuilder class. That's why I asked the follow-up question. As for Model class, you should use |
I solved this problem. First, BaseBuilder is working perfectly. My mistake is that. CI4's controller and another class object can not get the BaseBuilder of model.
When I coded without builder():
Thank you again for CI4's developer! |
Describe the bug
I guess it is a bug that the function named BaseBuilder::set() building wrong escape character
CodeIgniter 4 version
4.0.3 on master branch.
Affected module(s)
i don't know
Expected behavior, and steps to reproduce if appropriate
I expected follow compiled SQL with code:
source code in my model
$this->where('ID', $id)->set('VIEW_COUNT', 'VIEW_COUNT + 1', false)->update();
expected SQL
UPDATE TABLENAME SET VIEW_COUNT = VIEW_COUNT + 1, UPDATE_FIELD = 'date' WHERE ID = '1'
but, complied SQL (also the escape character in updatedField has been removed.)
UPDATE TABLENAME SET VIEW_COUNT = VIEW_COUNT + 1, UPDATE_FIELD = date WHERE ID = '1'
Context
The text was updated successfully, but these errors were encountered: