#include <Ndb.hpp>
Always start your application program by creating an Ndb object. By using several Ndb objects it is possible to design a multi-threaded application, but note that Ndb objects cannot be shared by several threads. Different threads should use different Ndb objects. A thread might however use multiple Ndb objects. Currently there is a limit of maximum 128 Ndb objects per application process.
The Ndb object is multi-thread safe in the following manner. Each Ndb object can ONLY be handled in one thread. 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 see all updates performed by the previous thread. Semaphores, mutexes and so forth are easy ways of issuing memory barriers without having to bother about the memory barrier concept.
Ndb::Ndb | ( | Ndb_cluster_connection * | ndb_cluster_connection, | |
const char * | aCatalogName = "" , |
|||
const char * | aSchemaName = "def" | |||
) |
The Ndb object represents a connection to a database.
ndb_cluster_connection | is a connection to the cluster containing the database to be used | |
aCatalogName | is the name of the catalog to be used. |
aSchemaName | is the name of the schema you want to use. |
const char* Ndb::getDatabaseName | ( | ) | const |
The current database name can be fetched by getDatabaseName.
int Ndb::setDatabaseName | ( | const char * | aDatabaseName | ) |
The current database name can be set by setDatabaseName.
aDatabaseName | is the new name of the current database |
const char* Ndb::getDatabaseSchemaName | ( | ) | const |
The current database schema name can be fetched by getDatabaseSchemaName.
int Ndb::setDatabaseSchemaName | ( | const char * | aDatabaseSchemaName | ) |
The current database schema name can be set by setDatabaseSchemaName.
aDatabaseSchemaName | is the new name of the current database schema |
int Ndb::init | ( | int | maxNoOfTransactions = 4 |
) |
Initializes the Ndb object
maxNoOfTransactions | Maximum number of parallel NdbTransaction objects that can be handled by the Ndb object. Maximum value is 1024. |
class NdbDictionary::Dictionary* Ndb::getDictionary | ( | ) | const |
Get an object for retrieving or manipulating database schema information
NdbTransaction* Ndb::startTransaction | ( | const NdbDictionary::Table * | table = 0 , |
|
const char * | keyData = 0 , |
|||
Uint32 | keyLen = 0 | |||
) |
Start a transaction
table | Pointer to table object used for deciding which node to run the Transaction Coordinator on | |
keyData | Pointer to partition key corresponding to table | |
keyLen | Length of partition key expressed in bytes |
void Ndb::closeTransaction | ( | NdbTransaction * | ) |
Close a transaction.
const NdbError& Ndb::getNdbError | ( | ) | const |
const NdbError& Ndb::getNdbError | ( | int | errorCode | ) |