I had never used Doctrine_RawSql before, but I was making raw SQL queries through Doctrine using either of these two methods:
Doctrine_Manager::getInstance()->getCurrentConnection()->fetchAssoc("YOUR SQL QUERY HERE");
and
$doctrine = Doctrine_Manager::getInstance()->getCurrentConnection()->getDbh(); $result = $doctrine->query('YOUR SQL QUERY HERE');
These two methods seem to leave your original SQL intact.
I should note that I use Doctrine 1.2 in the context of Symfony 1.4 applications, but AFAIK, this will work for you, no matter what other frameworks you can use.
source share