I want have added an extra field to a table and want to use
hook_update_N to populate it with a sanitized copy of a preexisting field.
Just copying a pre-existing field is trivial if one uses
db_update('my_table') ->expression('field_copyof_unsafe_value', 'field_unsafe_value') ->execute();
However, what I want to do something like this:
db_update('my_table') ->expression('field_plain_value', check_plain('field_unsafe_value')) ->execute();
I.e. pass the value of
field_unsafe_value through some function before storing it in the new field.
For avoidance of misunderstanding: I know the code above will not work (and that it will throw an exception). It is pseudo-code to illustrate what I want to achieve.
My question is: Is it possible to use a function call in
db_update() to compute value to store, and if "yes": How to do it?