使用原始SQL与原则 [英] Using Raw SQL with Doctrine
问题描述
我有一些非常复杂的查询,我需要用来在我的应用程序中生成报告。我用symfony作为我的框架和教义作为我的ORM。
I have some extremely complex queries that I need to use to generate a report in my application. I'm using symfony as my framework and doctrine as my ORM.
我的问题是:
将高度复杂的SQL查询直接传递到没有将它们转化为教义查询语言的原则?我一直在阅读关于 Raw_SQL
扩展名的内容,但似乎您仍然需要在部分中传递查询(如 from()
)。有没有什么东西只是倾倒在一堆原始的sql命令?
What is the best way to pass in highly-complex sql queries directly to Doctrine without converting them to the Doctrine Query Language? I've been reading about the Raw_SQL
extension but it appears that you still need to pass the query in sections (like from()
). Is there anything for just dumping in a bunch of raw sql commands?
推荐答案
$q = Doctrine_Manager::getInstance()->getCurrentConnection();
$result = $q->execute(" -- RAW SQL HERE -- ");
有关不同的执行方法,请参阅Doctrine API文档。
See the Doctrine API documentation for different execution methods.
这篇关于使用原始SQL与原则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!