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
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

const char* Ndb::getDatabaseName (  )  const

The current database name can be fetched by getDatabaseName.

Returns:
the current database name

int Ndb::setDatabaseName ( const char *  aDatabaseName  ) 

The current database name can be set by setDatabaseName.

Parameters:
aDatabaseName is the new name of the current database

const char* Ndb::getDatabaseSchemaName (  )  const

The current database schema name can be fetched by getDatabaseSchemaName.

Returns:
the current database schema name

int 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

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.

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.

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.

void Ndb::closeTransaction ( NdbTransaction  ) 

Close a transaction.

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

const NdbError& Ndb::getNdbError (  )  const

Get the NdbError object

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

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.


Documentation generated Mon Sep 29 08:17:50 2008 from mysql source files.
© 2003-2004 MySQL AB