如何在 Doctrine Update 查询中设置文字字符串值?
对于原则 1.2,我发现了很多这样的例子:
$q = Doctrine_Query::create()
->update('mytable')
->set('amount', 'amount+200')
->whereIn ('id', $ids);
然而我想做的是一组不同的例子:
->set('name', 'foo bar')
然而,这会导致例外。当然,因为 foo 不是像 amount 那样的列。 '´foo bar´'
也不走运。如何澄清 foo bar 是字符串文字?
我相信这是正确的地方,但我找不到更多信息。 另外:我很想了解更多有关那里提到的“混合参数”和“字符串更新”的信息。也许有 DOCTRINE::FLAG_LITERAL 之类的?
For doctrine 1.2, I find plenty of examples like these:
$q = Doctrine_Query::create()
->update('mytable')
->set('amount', 'amount+200')
->whereIn ('id', $ids);
What I want to do however is a different set:
->set('name', 'foo bar')
This however, leads to exception. Of course, because foo is no column, like amount.
No luck with '´foo bar´'
either. How can I clarify foo bar is a string literal?
I believe this is the right place to look, but I don't find further info.
Also: I would love to know more about the 'mixed params' and 'string update' mentioned there. Perhaps there's a DOCTRINE::FLAG_LITERAL or such?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用:
这相当于在DQL中执行以下操作
Use:
This is the equivalent of doing the following in DQL
您还可以使用:
You can also use :