The QueryBuilder just assembles strings, it won't check for their validity, nor parse anything.
If you need to build cross-platform generic queries, you typically use the ORM. In case you don't, you should look at how the ORM uses the platforms internally in order to generate database adapter specific SQL: https://github.com/doctrine/doctrine2/tree/4185a9ce4b205e683097842916c8a8929659c6d1/lib/Doctrine/ORM/Persisters Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On 23 April 2014 11:07, Ulrich Lichtenegger <[email protected]> wrote: > Hi, > > i am new in the doctrine world. I'd like to use Doctrine DBAL (without the > ORM part). Is it somehow possible to write DQL Statements in Doctrine DBAL? > > I'd like to develop an application which works with different Databases > (MySQL; PostgreSQL, MS SQL, Oracle...) so i am searching for a way to write > database independent queries. DBAL does not warn me, when i add for example > a MySQL specific function to a QueryBuilder instance. > > e.g. this works very well with the mysql backend, but not with a > postgresql backend because postgres does not support IFNULL (but uses > COALESCE): > >> $qb->addSelect('IFNULL(user.phone,123456)'); >> $qb->from('mydb.usertable', 'user'); >> > > How can Doctrine DBAL help me to do this? Or do i need to use Doctrine ORM > to get database independent queries? > > Thank you for your help! > > -- > You received this message because you are subscribed to the Google Groups > "doctrine-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/doctrine-user. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/d/optout.
