开发者

Propel: Concatenate text and field content

I am currently refactoring some stuff to use Propel.

We currently have a function that adds text to a "history" field like this:

UPDATE tablename 
  SET history = CONCAT(history, NOW(), "add this text to history") 
  WHERE ...;

We do this using the CONCAT() function to make the change atomic. Othe开发者_如何转开发rwise (if we would read the field-value somewhere before and then concatenate within PHP and update the row), it's possible that another script comes in between and modifies the field, and those changes would then be lost.

How can I accomplish this CONCAT(..) in Propel? We're using MySQL and MyISAM, so simply wrapping it all in a transaction won't work.


You could execute the raw SQL using Propel. I don't think this is possible in any other way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜