function batch_example_lowest_nid
Utility function - simply queries and loads the lowest nid.
Return value
int|NULL A nid or NULL if there are no nodes.
Related topics
2 calls to batch_example_lowest_nid()
- batch_example_batch_1 in batch_example/
batch_example.module - Batch 1 definition: Load the node with the lowest nid 1000 times.
- batch_example_simple_form in batch_example/
batch_example.module - Form builder function to allow choice of which batch to run.
File
-
batch_example/
batch_example.module, line 291
Code
function batch_example_lowest_nid() {
$select = db_select('node', 'n')->fields('n', array(
'nid',
))
->orderBy('n.nid', 'ASC')
->extend('PagerDefault')
->limit(1);
$nid = $select->execute()
->fetchField();
return $nid;
}