Ndb Class Reference

#include <Ndb.hpp>

List of all members.


Detailed Description

Represents the NDB kernel and is the main class of the NDB API.

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.

Note:
It is not allowed to call methods in the NDB API on the same Ndb object in different threads simultaneously (without special handling of the Ndb object).

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.

Public Member Functions

General
Meta Information
Event subscriptions
Starting and Closing Transactions
Error Handling

Constructor & Destructor Documentation

Ndb::Ndb Ndb_cluster_connection ndb_cluster_connection,
const char *  aCatalogName = "",
const char *  aSchemaName = "def"
 

The Ndb object represents a connection to a database.

Note:
The init() method must be called before the Ndb object may actually be used.
Parameters:
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.
Note:
The catalog name provides a namespace for the tables and indexes created in any connection from the Ndb object.
Parameters:
aSchemaName is the name of the schema you want to use.
Note:
The schema name provides an additional namespace for the tables and indexes created in a given catalog.


Member Function Documentation

void Ndb::closeTransaction NdbTransaction  ) 
 

Close a transaction.

Note:
should be called after the transaction has completed, irrespective of success or failure

NdbEventOperation* Ndb::createEventOperation const char *  eventName,
const int  bufferLength
 

Create a subcription to an event defined in the database

Parameters:
eventName unique identifier of the event
bufferLength circular buffer size for storing event data
Returns:
Object representing an event, NULL on failure

int Ndb::dropEventOperation NdbEventOperation eventOp  ) 
 

Drop a subscription to an event

Parameters:
eventOp Event operation
Returns:
0 on success

const char* Ndb::getDatabaseName  )  const
 

The current database name can be fetched by getDatabaseName.

Returns:
the current database name

const char* Ndb::getDatabaseSchemaName  )  const
 

The current database schema name can be fetched by getDatabaseSchemaName.

Returns:
the current database schema name

class NdbDictionary::Dictionary* Ndb::getDictionary  )  const
 

Get an object for retrieving or manipulating database schema information

Note:
this object operates outside any transaction
Returns:
Object containing meta information about all tables in NDB Cluster.

const NdbError& Ndb::getNdbError int  errorCode  ) 
 

Get a NdbError object for a specific error code

The NdbError object is valid until you call a new NDB API method.

const NdbError& Ndb::getNdbError  )  const
 

Get the NdbError object

Note:
The NdbError object is valid until a new NDB API method is called.

int Ndb::init int  maxNoOfTransactions = 4  ) 
 

Initializes the Ndb object

Parameters:
maxNoOfTransactions Maximum number of parallel NdbTransaction objects that can be handled by the Ndb object. Maximum value is 1024.
Note:
each scan or index scan operation uses one extra NdbTransaction object
Returns:
0 if successful, -1 otherwise.

int Ndb::pollEvents int  aMillisecondNumber  ) 
 

Wait for an event to occur. Will return as soon as an event is detected on any of the created events.

Parameters:
aMillisecondNumber maximum time to wait
Returns:
the number of events that has occured, -1 on failure

void Ndb::setDatabaseName const char *  aDatabaseName  ) 
 

The current database name can be set by setDatabaseName.

Parameters:
aDatabaseName is the new name of the current database

void Ndb::setDatabaseSchemaName const char *  aDatabaseSchemaName  ) 
 

The current database schema name can be set by setDatabaseSchemaName.

Parameters:
aDatabaseSchemaName is the new name of the current database schema

NdbTransaction* Ndb::startTransaction const NdbDictionary::Table table = 0,
const char *  keyData = 0,
Uint32  keyLen = 0
 

Start a transaction

Note:
When the transaction is completed it must be closed using Ndb::closeTransaction or NdbTransaction::close. The transaction must be closed independent of its outcome, i.e. even if there is an error.
Parameters:
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
Returns:
NdbTransaction object, or NULL on failure.


Documentation generated Wed May 4 09:45:01 2005 from mysql source files.
© 2003-2004 MySQL AB