added skip create option to bank test program

parent 0bdfbfe8
...@@ -29,6 +29,7 @@ public: ...@@ -29,6 +29,7 @@ public:
Bank(Ndb_cluster_connection&, bool init = true, const char *dbase="BANK"); Bank(Ndb_cluster_connection&, bool init = true, const char *dbase="BANK");
int setSkipCreate(bool skip) { m_skip_create = skip; }
int createAndLoadBank(bool overWrite, bool disk= false, int num_accounts=10); int createAndLoadBank(bool overWrite, bool disk= false, int num_accounts=10);
int dropBank(); int dropBank();
...@@ -140,6 +141,7 @@ private: ...@@ -140,6 +141,7 @@ private:
Ndb m_ndb; Ndb m_ndb;
int m_maxAccount; int m_maxAccount;
bool m_initialized; bool m_initialized;
bool m_skip_create;
}; };
#endif #endif
...@@ -58,7 +58,7 @@ int Bank::createAndLoadBank(bool ovrWrt, bool disk, int num_accounts){ ...@@ -58,7 +58,7 @@ int Bank::createAndLoadBank(bool ovrWrt, bool disk, int num_accounts){
m_ndb.init(); m_ndb.init();
if (m_ndb.waitUntilReady() != 0) if (m_ndb.waitUntilReady() != 0)
return NDBT_FAILED; return NDBT_FAILED;
const NdbDictionary::Table* pSysValTab = const NdbDictionary::Table* pSysValTab =
m_ndb.getDictionary()->getTable("SYSTEM_VALUES"); m_ndb.getDictionary()->getTable("SYSTEM_VALUES");
if (pSysValTab != NULL){ if (pSysValTab != NULL){
...@@ -69,7 +69,7 @@ int Bank::createAndLoadBank(bool ovrWrt, bool disk, int num_accounts){ ...@@ -69,7 +69,7 @@ int Bank::createAndLoadBank(bool ovrWrt, bool disk, int num_accounts){
} }
} }
if (createTables(disk) != NDBT_OK) if (!m_skip_create && createTables(disk) != NDBT_OK)
return NDBT_FAILED; return NDBT_FAILED;
if (clearTables() != NDBT_OK) if (clearTables() != NDBT_OK)
......
...@@ -31,10 +31,12 @@ int main(int argc, const char** argv){ ...@@ -31,10 +31,12 @@ int main(int argc, const char** argv){
int _help = 0; int _help = 0;
char * _database = "BANK"; char * _database = "BANK";
int disk = 0; int disk = 0;
int skip_create = 0;
struct getargs args[] = { struct getargs args[] = {
{ "database", 'd', arg_string, &_database, "Database name", ""}, { "database", 'd', arg_string, &_database, "Database name", ""},
{ "disk", 0, arg_flag, &disk, "Use disk tables", "" }, { "disk", 0, arg_flag, &disk, "Use disk tables", "" },
{ "skip-create", 0, arg_flag, &skip_create, "Skip create", "" },
{ "usage", '?', arg_flag, &_help, "Print help", "" } { "usage", '?', arg_flag, &_help, "Print help", "" }
}; };
int num_args = sizeof(args) / sizeof(args[0]); int num_args = sizeof(args) / sizeof(args[0]);
...@@ -55,6 +57,7 @@ int main(int argc, const char** argv){ ...@@ -55,6 +57,7 @@ int main(int argc, const char** argv){
Bank bank(con,_database); Bank bank(con,_database);
int overWriteExisting = true; int overWriteExisting = true;
bank.setSkipCreate(skip_create);
if (bank.createAndLoadBank(overWriteExisting, disk) != NDBT_OK) if (bank.createAndLoadBank(overWriteExisting, disk) != NDBT_OK)
return NDBT_ProgramExit(NDBT_FAILED); return NDBT_ProgramExit(NDBT_FAILED);
return NDBT_ProgramExit(NDBT_OK); return NDBT_ProgramExit(NDBT_OK);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment