[support] db_select()->condition()

Earnie Boyd earnie at users.sourceforge.net
Fri May 25 20:16:57 UTC 2012


For others who are later looking at this thread, one consideration is
that db_select()->execute() returns an array of rows of objects
matching the select.  You could quickly consume all memory pulling all
nodes so don't do something stupid like

$nodes = db_select('nodes', 'n')->fields('n')->execute();

To process one row at a time from the DB you must use db_query() which
has an appropriate fetch() method to retrieve the data from the DB one
row at a time.

Thanks for the responses David and Jamie, sounds like a heated debate
but I now understand when db_select should be used and when not to.

-- 
Earnie
-- https://sites.google.com/site/earnieboyd


More information about the support mailing list