added skip create option to bank test program

parent 0bdfbfe8
......@@ -29,6 +29,7 @@ public:
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 dropBank();
......@@ -140,6 +141,7 @@ private:
Ndb m_ndb;
int m_maxAccount;
bool m_initialized;
bool m_skip_create;
};
#endif
......@@ -58,7 +58,7 @@ int Bank::createAndLoadBank(bool ovrWrt, bool disk, int num_accounts){
m_ndb.init();
if (m_ndb.waitUntilReady() != 0)
return NDBT_FAILED;
const NdbDictionary::Table* pSysValTab =
m_ndb.getDictionary()->getTable("SYSTEM_VALUES");
if (pSysValTab != NULL){
......@@ -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;
if (clearTables() != NDBT_OK)
......
......@@ -31,10 +31,12 @@ int main(int argc, const char** argv){
int _help = 0;
char * _database = "BANK";
int disk = 0;
int skip_create = 0;
struct getargs args[] = {
{ "database", 'd', arg_string, &_database, "Database name", ""},
{ "disk", 0, arg_flag, &disk, "Use disk tables", "" },
{ "skip-create", 0, arg_flag, &skip_create, "Skip create", "" },
{ "usage", '?', arg_flag, &_help, "Print help", "" }
};
int num_args = sizeof(args) / sizeof(args[0]);
......@@ -55,6 +57,7 @@ int main(int argc, const char** argv){
Bank bank(con,_database);
int overWriteExisting = true;
bank.setSkipCreate(skip_create);
if (bank.createAndLoadBank(overWriteExisting, disk) != NDBT_OK)
return NDBT_ProgramExit(NDBT_FAILED);
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