Adds the ability to keep specific fields raw when inserting and updating #59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Usage on INSERT:
Usage on UPDATE:
The keep_raw() function allows you to use special functionality provided by MySQL (and other DBs compatible with Idiorm) without forcing the developer to write a raw query. Of course it's still up to the developer to validate and protect themselves when using any raw functionality but this make code much cleaner and easier to read.
There's a new variable in the ORM class, $_keep_raw which holds a list of column names that the dev wants to keep raw. This is used in building placeholders (used by inserts) and when building updates directly. It's also used in save() to determine which variables to prepare.