Documentation Home
MySQL NDB Cluster API Developer Guide
Download this Manual Ndb_cluster_connection::get_next_ndb_object()

Description.  This method is used to iterate over a set of Ndb objects, retrieving them one at a time.


const Ndb* get_next_ndb_object
      const Ndb* p

Parameters.  This method takes a single parameter, a pointer to the last Ndb object to have been retrieved or NULL.

Return value.  Returns the next Ndb object, or NULL if no more Ndb objects are available.

Iterating over Ndb objects.  To retrieve all existing Ndb objects, perform the following three steps:

  1. Invoke the lock_ndb_objects() method. This prevents the creation of any new instances of Ndb until the unlock_ndb_objects() method is called.

  2. Retrieve the first available Ndb object by passing NULL to get_next_ndb_object(). You can retrieve the second Ndb object by passing the pointer retrieved by the first call to the next get_next_ndb_object() call, and so on. When a pointer to the last available Ndb instance is used, the method returns NULL.

  3. After you have retrieved all desired Ndb objects, you should re-enable Ndb object creation by calling the unlock_ndb_objects() method.