[development] Extend database abstraction layer, to include table creation.

Larry Garfield larry at garfieldtech.com
Fri May 12 19:12:41 UTC 2006


On Fri, May 12, 2006 1:28 pm, Chris Johnson said:
> Earl Miles wrote:
>> Bèr Kessels wrote:
>>>
>>> db_fetch_all()
>>> This "whiling" over the db_fetch_object is driving me nuts :)
>>
>> Uggh. Adding extra loops because you don't like 'while' is nothing more
>> than a performance hit that is unnecessary.
>
> Yeah, I'm pretty -1 on the idea of adding these to the database
> abstraction.
> If one is coding PHP for Drupal, one should be a competent enough
> programmer
> to deal with a while loop over a database fetch.
>
> ..chrisxj

It's not a matter of competence, but of convenience.  In my non-Drupal
work (which currently is far more time than my Drupal work, sadly), I need
to get a series of query result rows as objects first, then pass them
around, surprisingly often.  Same for getting just one column of a result
set as an array.  Sure, that's 4-5 lines of simple code, but it's the same
5 lines 100 times.  If you're doing that several times, that's a clear
sign that you should be abstracting it.  It makes the code easier to read
later, too.

--Larry Garfield



More information about the development mailing list