1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-31 22:22:30 +03:00

updated ndbapi examples

This commit is contained in:
tomas@poseidon.ndb.mysql.com
2005-01-03 11:31:05 +01:00
parent 864b3b2080
commit c3f03a3801
12 changed files with 128 additions and 148 deletions

View File

@@ -45,7 +45,18 @@
int main()
{
ndb_init();
Ndb* myNdb = new Ndb( "TEST_DB_1" ); // Object representing the database
Ndb_cluster_connection *cluster_connection=
new Ndb_cluster_connection(); // Object representing the cluster
if (cluster_connection->wait_until_ready(30,30))
{
std::cout << "Cluster was not ready within 30 secs." << std::endl;
exit(-1);
}
Ndb* myNdb = new Ndb( cluster_connection,
"TEST_DB_1" ); // Object representing the database
NdbDictionary::Table myTable;
NdbDictionary::Column myColumn;
@@ -56,16 +67,11 @@ int main()
/********************************************
* Initialize NDB and wait until it's ready *
********************************************/
if (myNdb->init() == -1) {
if (myNdb->init()) {
APIERROR(myNdb->getNdbError());
exit(-1);
}
if (myNdb->waitUntilReady(30) != 0) {
std::cout << "NDB was not ready within 30 secs." << std::endl;
exit(-1);
}
NdbDictionary::Dictionary* myDict = myNdb->getDictionary();
/*********************************************************
@@ -190,5 +196,10 @@ int main()
}
myNdb->closeTransaction(myConnection);
}
delete myNdb;
delete cluster_connection;
ndb_end(0);
return 0;
}