Abstract
This class represents the NDB
kernel; it is the
primary class of the NDB API.
Parent class. None
Child classes. None
Description.
Any nontrivial NDB API program makes use of at least one instance
of Ndb
. By using several Ndb
objects, it is possible to implement a multi-threaded application.
You should remember that one Ndb
object cannot
be shared between threads; however, it is possible for a single
thread to use multiple Ndb
objects. A single
application process can support a maximum of 128
Ndb
objects.
The Ndb object is multi-thread safe in that each
Ndb
object can be handled by one thread at a
time. If an Ndb
object is handed over to
another thread, then the application must ensure that a memory
barrier is used to ensure that the new thread sees all updates
performed by the previous thread.
Semaphores and mutexes are examples of easy ways to provide memory barriers without having to bother about the memory barrier concept.
It is also possible to use multiple Ndb
objects
to perform operations on different clusters in a single application.
See the Note on
Application-Level Partitioning for conditions and
restrictions applying to such usage.
Methods. The following table lists the public methods of this class and the purpose or use of each method:
Method | Purpose / Use |
---|---|
Ndb() |
Class constructor; represents a connection to a MySQL Cluster. |
~Ndb() |
Class destructor; terminates a Cluster connection when it is no longer to be used |
init() |
Initialises an Ndb object and makes it ready for use. |
getDictionary() |
Gets a dictionary, which is used for working with database schema information. |
getDatabaseName() |
Gets the name of the current database. |
setDatabaseName() |
Sets the name of the current database. |
getDatabaseSchemaName() |
Gets the name of the current database schema. |
setDatabaseSchemaName() |
Sets the name of the current database schema. |
startTransaction() |
Begins a transaction. (See Section 2.3.19, “The NdbTransaction Class”.) |
closeTransaction() |
Closes a transaction. |
computeHash() |
Computes a distribution hash value. |
createEventOperation() |
Creates a subscription to a database event. (See
Section 2.3.11, “The NdbEventOperation Class”.) |
dropEventOperation() |
Drops a subscription to a database event. |
pollEvents() |
Waits for an event to occur. |
getNdbError() |
Retrieves an error. (See Section 2.3.31, “The NdbError Structure”.) |
getNdbErrorDetail() |
Retrieves extra error details. Added in MySQL Cluster NDB 6.2.19, MySQL Cluster NDB 6.3.29, and MySQL Cluster NDB 7.0.10. |
getReference() |
Retrieves a reference or identifier for the Ndb
object instance. |
For detailed descriptions, signatures, and examples of use for each
of these methods, see Section 2.3.8.1, “Ndb
Methods”.
Class diagram.
This diagram shows all the available members of the
Ndb
class: