37 #define APIERROR(error) \
38 { ndbout << "Error in " << __FILE__ << ", line:" << __LINE__ << ", code:" \
39 << error.code << ", msg: " << error.message << "." << endl; \
42 static void callback(
int result,
NdbTransaction* NdbObject,
void* aObject);
53 ndbout <<
"Cluster was not ready within 30 secs." << endl;
57 int r= cluster_connection->
connect(5 ,
63 <<
"Cluster connect failed, possibly resolved with more retries.\n";
69 <<
"Cluster connect failed.\n";
75 ndbout <<
"Cluster was not ready within 30 secs." << endl;
79 Ndb* myNdb =
new Ndb( cluster_connection,
85 if (myNdb->
init(2) == -1) {
97 for (
int i = 0;
i < 2;
i++) {
99 if (myNdbTransaction[
i] == NULL) APIERROR(myNdb->
getNdbError());
102 if (myNdbOperation == NULL) APIERROR(myNdbTransaction[
i]->getNdbError());
104 myNdbOperation->insertTuple();
105 myNdbOperation->equal(
"ATTR1", 20 +
i);
106 myNdbOperation->setValue(
"ATTR2", 20 +
i);
120 for (
int i = 0;
i < 2;
i++)
124 delete cluster_connection;
143 ndbout <<
"Poll error: " << endl;
146 ndbout <<
"Successful insert." << endl;