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:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user