engines can change if need be without too much trouble.
Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com
dele454 wrote:
> Indeed PDO is much more readable - with a good indentation implemented. I
> think there is definitely a place for Db Object Models one just has to find
> a balance between the two ie. when it is appropriate and convienient to go
> the object way or to simply stick to plain sql. I find plain sql much more
> simpler especially when you have written and testing your queries before
> hand. You simply copy and paste and not have to worry about the intricacies
> of how a Frameworks interpretes nested joins or queries :)
>
> Am using a combination of both for now.
>
>
>
> monk.e.boy wrote:
>
>> >> Your query is this:
>>
>> I ask thee, which is easier to read and understand? ::
>>
>>
>> $sql = <<<EOT
>>
>>
>> SELECT e.eventName, v.VenueName, c.City
>> FROM EventVenue ev
>> LEFT JOIN Event e ON ev.eventid=e.eventid
>> LEFT JOIN Venue v ON ev.venueid=v.venueid
>> LEFT JOIN Area a ON e.areaid=a.areaid
>> LEFT JOIN City c ON a.cityid=c.cityid;
>>
>> EOT;
>>
>> ---- or ----
>>
>> $sql = $this->select()->setIntegrityCheck(false)
>> ->from($this, array() )
>> ->joinLeftUsing( array('e'=>'Event'), 'EventId', array('EventName') )
>> ->joinLeftUsing( array('v'=>'Venue'), 'VenueId', array('VenueName') )
>> ->joinLeft( array('a'=>'Area'), 'e.AreaId = a.AreaId', array() )
>> ->joinLeft( array('c'=>'City'), 'a.CityId = c.CityId', array('City')
>> );
>>
>> Object models are a neat idea, but good god, the code is a mess. It's
>> starting to look like Perl....
>>
>> monk.e.boy
>>
>>
>
>
> -----
> dee
>
没有评论:
发表评论