0
votes

I wonder how to add a function into the "SET" block of an SQL UPDATE with Propel 1.6. E.g. UPDATE foo SET myfield = length(:param) WHERE x = 3;

Such functions can be embedded into "->where()" but apparently not into "->update()". What I'm looking for would be a syntax similar to this:

FooQuery::create()
        ->filterByX(3)
        ->update(array("MyField" => array("length(?)", 42));

Can I do this somehow or do I have to write my query as "custom SQL"?

1

1 Answers

0
votes

The update array is a series of column names and values. The values are quoted values and hence whatever you put in there will be treated as a string (rather than a function).

Sorry, I can't see any other solution for you.