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

Angela Byron drupal-devel at webchick.net
Fri May 12 17:01:52 UTC 2006


Adrian Rossouw wrote:

> The only place I could see something like this being useful is
> everywhere we do :
> 
> $result = db_query('something');
> while ($data = db_fetch_array($result) {
>    $return[$data['some_key']] = $data;
> }
> 
> AND NOTHING ELSE.

Even then, chances are you have some kind of logic done, even in this
simple of loop (for example, what is 'some_key'? the node ID? the user
ID? the free tagging term?). A 'get all the db stuff into an array'
function just means instead of doing:

while ($data = db_fetch_array($result) {
  ...
}

you're doing:

foreach ($data as $key => $value) {
  ...
}

Same difference, except you end up looping twice. :P

-Angie


More information about the development mailing list