Loading ndb/examples/ndbapi_example3/ndbapi_example3.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ // // There are many ways to program using the NDB API. In this example // we execute two inserts in the same transaction using // NdbConnection::Ndbexecute(NoCommit). // NdbConnection::execute(NoCommit). // // Transaction failing is handled by re-executing the transaction // in case of non-permanent transaction errors. Loading ndb/examples/ndbapi_example5/ndbapi_example5.cpp +22 −32 Original line number Diff line number Diff line Loading @@ -58,8 +58,8 @@ int myCreateEvent(Ndb* myNdb, const char *eventName, const char *eventTableName, const char **eventComlumnName, const int noEventComlumnName); const char **eventColumnName, const int noEventColumnName); int main() { Loading Loading @@ -93,12 +93,7 @@ int main() Ndb* myNdb= new Ndb(cluster_connection, "TEST_DB"); // Object representing the database if (myNdb->init() == -1) { APIERROR(myNdb->getNdbError()); exit(-1); } NdbDictionary::Dictionary *myDict; if (myNdb->init() == -1) APIERROR(myNdb->getNdbError()); const char *eventName= "CHNG_IN_TAB0"; const char *eventTableName= "TAB0"; Loading @@ -108,8 +103,6 @@ int main() "COL1", "COL11"}; myDict = myNdb->getDictionary(); // Create events myCreateEvent(myNdb, eventName, Loading @@ -122,10 +115,8 @@ int main() // Start "transaction" for handling events NdbEventOperation* op; printf("create EventOperation\n"); if ((op = myNdb->createEventOperation(eventName,100)) == NULL) { printf("Event operation creation failed\n"); exit(-1); } if ((op = myNdb->createEventOperation(eventName,100)) == NULL) APIERROR(myNdb->getNdbError()); printf("get values\n"); NdbRecAttr* recAttr[noEventColumnName]; Loading @@ -139,12 +130,11 @@ int main() // set up the callbacks printf("execute\n"); if (op->execute()) { // This starts changes to "start flowing" printf("operationd execution failed\n"); printf("operation execution failed\n"); exit(-1); } int i= 0; while(i < 40) { // printf("now waiting for event...\n"); int r= myNdb->pollEvents(1000); // wait for event or 1000 ms Loading @@ -154,7 +144,7 @@ int main() while (op->next(&overrun) > 0) { i++; if (!op->isConsistent()) printf("A node failiure has occured and events might be missing\n"); printf("A node failure has occured and events might be missing\n"); switch (op->getEventType()) { case NdbDictionary::Event::TE_INSERT: printf("%u INSERT: ", i); Loading Loading @@ -196,7 +186,11 @@ int main() j++; } { NdbDictionary::Dictionary *myDict = myNdb->getDictionary(); if (!myDict) APIERROR(myNdb->getNdbError()); myDict->dropEvent(eventName); // remove event from database } delete myNdb; delete cluster_connection; Loading @@ -211,11 +205,7 @@ int myCreateEvent(Ndb* myNdb, const int noEventColumnName) { NdbDictionary::Dictionary *myDict= myNdb->getDictionary(); if (!myDict) { printf("Event Creation failedDictionary not found"); exit(-1); } if (!myDict) APIERROR(myNdb->getNdbError()); NdbDictionary::Event myEvent(eventName); myEvent.setTable(eventTableName); Loading ndb/examples/ndbapi_scan_example/Makefile +2 −2 Original line number Diff line number Diff line Loading @@ -9,12 +9,12 @@ LFLAGS = -Wall TOP_SRCDIR = ../../.. INCLUDE_DIR = $(TOP_SRCDIR)/ndb/include LIB_DIR = -L$(TOP_SRCDIR)/ndb/src/.libs \ -L$(TOP_SRCDIR)/libmysql/.libs \ -L$(TOP_SRCDIR)/libmysql_r/.libs \ -L$(TOP_SRCDIR)/mysys SYS_LIB = $(TARGET): $(OBJS) $(CXX) $(CXXFLAGS) $(LFLAGS) $(LIB_DIR) $(OBJS) -lndbclient -lmysqlclient -lmysys $(SYS_LIB) -o $(TARGET) $(CXX) $(CXXFLAGS) $(LFLAGS) $(LIB_DIR) $(OBJS) -lndbclient -lmysqlclient_r -lmysys -lz $(SYS_LIB) -o $(TARGET) $(TARGET).o: $(SRCS) $(CXX) $(CFLAGS) -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/ndbapi $(SRCS) Loading ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp +7 −5 Original line number Diff line number Diff line Loading @@ -24,9 +24,12 @@ * * Classes and methods used in this example: * * Ndb_cluster_connection * connect() * wait_until_ready() * * Ndb * init() * waitUntilRead() * getDictionary() * startTransaction() * closeTransaction() Loading Loading @@ -74,7 +77,6 @@ #include <NdbApi.hpp> #include <NdbScanFilter.hpp> // Used for cout #include <iostream> Loading Loading @@ -235,7 +237,7 @@ int scan_delete(Ndb* myNdb, int deletedRows = 0; int check; NdbError err; NdbConnection *myTrans; NdbTransaction *myTrans; NdbScanOperation *myScanOp; /** Loading Loading @@ -407,7 +409,7 @@ int scan_update(Ndb* myNdb, int updatedRows = 0; int check; NdbError err; NdbConnection *myTrans; NdbTransaction *myTrans; NdbScanOperation *myScanOp; /** Loading Loading @@ -588,7 +590,7 @@ int scan_print(Ndb * myNdb) int fetchedRows = 0; int check; NdbError err; NdbConnection *myTrans; NdbTransaction *myTrans; NdbScanOperation *myScanOp; /* Result of reading attribute value, three columns: REG_NO, BRAND, and COLOR Loading Loading
ndb/examples/ndbapi_example3/ndbapi_example3.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ // // There are many ways to program using the NDB API. In this example // we execute two inserts in the same transaction using // NdbConnection::Ndbexecute(NoCommit). // NdbConnection::execute(NoCommit). // // Transaction failing is handled by re-executing the transaction // in case of non-permanent transaction errors. Loading
ndb/examples/ndbapi_example5/ndbapi_example5.cpp +22 −32 Original line number Diff line number Diff line Loading @@ -58,8 +58,8 @@ int myCreateEvent(Ndb* myNdb, const char *eventName, const char *eventTableName, const char **eventComlumnName, const int noEventComlumnName); const char **eventColumnName, const int noEventColumnName); int main() { Loading Loading @@ -93,12 +93,7 @@ int main() Ndb* myNdb= new Ndb(cluster_connection, "TEST_DB"); // Object representing the database if (myNdb->init() == -1) { APIERROR(myNdb->getNdbError()); exit(-1); } NdbDictionary::Dictionary *myDict; if (myNdb->init() == -1) APIERROR(myNdb->getNdbError()); const char *eventName= "CHNG_IN_TAB0"; const char *eventTableName= "TAB0"; Loading @@ -108,8 +103,6 @@ int main() "COL1", "COL11"}; myDict = myNdb->getDictionary(); // Create events myCreateEvent(myNdb, eventName, Loading @@ -122,10 +115,8 @@ int main() // Start "transaction" for handling events NdbEventOperation* op; printf("create EventOperation\n"); if ((op = myNdb->createEventOperation(eventName,100)) == NULL) { printf("Event operation creation failed\n"); exit(-1); } if ((op = myNdb->createEventOperation(eventName,100)) == NULL) APIERROR(myNdb->getNdbError()); printf("get values\n"); NdbRecAttr* recAttr[noEventColumnName]; Loading @@ -139,12 +130,11 @@ int main() // set up the callbacks printf("execute\n"); if (op->execute()) { // This starts changes to "start flowing" printf("operationd execution failed\n"); printf("operation execution failed\n"); exit(-1); } int i= 0; while(i < 40) { // printf("now waiting for event...\n"); int r= myNdb->pollEvents(1000); // wait for event or 1000 ms Loading @@ -154,7 +144,7 @@ int main() while (op->next(&overrun) > 0) { i++; if (!op->isConsistent()) printf("A node failiure has occured and events might be missing\n"); printf("A node failure has occured and events might be missing\n"); switch (op->getEventType()) { case NdbDictionary::Event::TE_INSERT: printf("%u INSERT: ", i); Loading Loading @@ -196,7 +186,11 @@ int main() j++; } { NdbDictionary::Dictionary *myDict = myNdb->getDictionary(); if (!myDict) APIERROR(myNdb->getNdbError()); myDict->dropEvent(eventName); // remove event from database } delete myNdb; delete cluster_connection; Loading @@ -211,11 +205,7 @@ int myCreateEvent(Ndb* myNdb, const int noEventColumnName) { NdbDictionary::Dictionary *myDict= myNdb->getDictionary(); if (!myDict) { printf("Event Creation failedDictionary not found"); exit(-1); } if (!myDict) APIERROR(myNdb->getNdbError()); NdbDictionary::Event myEvent(eventName); myEvent.setTable(eventTableName); Loading
ndb/examples/ndbapi_scan_example/Makefile +2 −2 Original line number Diff line number Diff line Loading @@ -9,12 +9,12 @@ LFLAGS = -Wall TOP_SRCDIR = ../../.. INCLUDE_DIR = $(TOP_SRCDIR)/ndb/include LIB_DIR = -L$(TOP_SRCDIR)/ndb/src/.libs \ -L$(TOP_SRCDIR)/libmysql/.libs \ -L$(TOP_SRCDIR)/libmysql_r/.libs \ -L$(TOP_SRCDIR)/mysys SYS_LIB = $(TARGET): $(OBJS) $(CXX) $(CXXFLAGS) $(LFLAGS) $(LIB_DIR) $(OBJS) -lndbclient -lmysqlclient -lmysys $(SYS_LIB) -o $(TARGET) $(CXX) $(CXXFLAGS) $(LFLAGS) $(LIB_DIR) $(OBJS) -lndbclient -lmysqlclient_r -lmysys -lz $(SYS_LIB) -o $(TARGET) $(TARGET).o: $(SRCS) $(CXX) $(CFLAGS) -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/ndbapi $(SRCS) Loading
ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp +7 −5 Original line number Diff line number Diff line Loading @@ -24,9 +24,12 @@ * * Classes and methods used in this example: * * Ndb_cluster_connection * connect() * wait_until_ready() * * Ndb * init() * waitUntilRead() * getDictionary() * startTransaction() * closeTransaction() Loading Loading @@ -74,7 +77,6 @@ #include <NdbApi.hpp> #include <NdbScanFilter.hpp> // Used for cout #include <iostream> Loading Loading @@ -235,7 +237,7 @@ int scan_delete(Ndb* myNdb, int deletedRows = 0; int check; NdbError err; NdbConnection *myTrans; NdbTransaction *myTrans; NdbScanOperation *myScanOp; /** Loading Loading @@ -407,7 +409,7 @@ int scan_update(Ndb* myNdb, int updatedRows = 0; int check; NdbError err; NdbConnection *myTrans; NdbTransaction *myTrans; NdbScanOperation *myScanOp; /** Loading Loading @@ -588,7 +590,7 @@ int scan_print(Ndb * myNdb) int fetchedRows = 0; int check; NdbError err; NdbConnection *myTrans; NdbTransaction *myTrans; NdbScanOperation *myScanOp; /* Result of reading attribute value, three columns: REG_NO, BRAND, and COLOR Loading