2008年8月8日星期五

Re: [fw-db] Left Join syntax

Hi,

You can use Zend_Db_Select to create database-independant queries. It will generate the query for you.

You can find its documentation here:
http://framework.zend.com/manual/en/zend.db.select.html
Regards,  Pieter Kokx MaakSite.net PHP Developer 


Jeroen Keppens schreef:
Hi,

We're using Zend_Db in our application and connect it to informix. For this we have written a seperate Pdo_Informix Db Adapter (the Ibm (Ids) one doesn't work for the informix version we have).

This works all fine, but we noticed some problems on performance with left joins on informix. When investigating further, it appears there is another syntax of doing a left (outer) join which is a lot more performant. Problem is getting it to work trough ZF.

An example:

LEFT JOIN syntax: 

SELECT a.*, b.* 
FROM a LEFT JOIN b on b.a_id = a.id;

OUTER syntax: 

SELECT a.*, b.* 
FROM a, OUTER b
WHERE b.a_id = a.id;

How would I do this with ZF? Is it possible to make the join syntax Db Adapter dependant?

Tnx
Jeroen

没有评论: