Commit 1cb424f1 authored by unknown's avatar unknown

wl2240 - ndb partitioning

Added create table hook for NDB API test framework


ndb/test/include/NDBT_Tables.hpp:
  Added create table hook for NDB API test framework
ndb/test/src/NDBT_Tables.cpp:
  Added create table hook for NDB API test framework
parent 532b97c9
...@@ -23,11 +23,13 @@ ...@@ -23,11 +23,13 @@
#include <NdbDictionary.hpp> #include <NdbDictionary.hpp>
#include <NDBT_Table.hpp> #include <NDBT_Table.hpp>
typedef int (* NDBT_CreateTableHook)(Ndb*, NdbDictionary::Table&, int when);
class NDBT_Tables { class NDBT_Tables {
public: public:
static int createTable(Ndb* pNdb, const char* _name, bool _temp = false, static int createTable(Ndb* pNdb, const char* _name, bool _temp = false,
bool existsOK = false); bool existsOK = false, NDBT_CreateTableHook = 0);
static int createAllTables(Ndb* pNdb, bool _temp, bool existsOK = false); static int createAllTables(Ndb* pNdb, bool _temp, bool existsOK = false);
static int createAllTables(Ndb* pNdb); static int createAllTables(Ndb* pNdb);
......
...@@ -820,21 +820,25 @@ NDBT_Tables::createAllTables(Ndb* pNdb){ ...@@ -820,21 +820,25 @@ NDBT_Tables::createAllTables(Ndb* pNdb){
int int
NDBT_Tables::createTable(Ndb* pNdb, const char* _name, bool _temp, NDBT_Tables::createTable(Ndb* pNdb, const char* _name, bool _temp,
bool existsOk){ bool existsOk, NDBT_CreateTableHook f){
const NdbDictionary::Table* tab = NDBT_Tables::getTable(_name); const NdbDictionary::Table* tab = NDBT_Tables::getTable(_name);
if (tab == NULL){ if (tab == NULL){
ndbout << "Could not create table " << _name ndbout << "Could not create table " << _name
<< ", it doesn't exist in list of tables "\ << ", it doesn't exist in list of tables "\
"that NDBT_Tables can create!" << endl; "that NDBT_Tables can create!" << endl;
return NDBT_WRONGARGS; return NDBT_WRONGARGS;
} }
int r = 0; int r = 0;
do { do {
NdbDictionary::Table tmpTab(* tab); NdbDictionary::Table tmpTab(* tab);
tmpTab.setStoredTable(_temp ? 0 : 1); tmpTab.setStoredTable(_temp ? 0 : 1);
if(f != 0 && f(pNdb, tmpTab, 0))
{
ndbout << "Failed to create table" << endl;
return NDBT_FAILED;
}
r = pNdb->getDictionary()->createTable(tmpTab); r = pNdb->getDictionary()->createTable(tmpTab);
if(r == -1){ if(r == -1){
if(!existsOk){ if(!existsOk){
...@@ -883,6 +887,11 @@ NDBT_Tables::createTable(Ndb* pNdb, const char* _name, bool _temp, ...@@ -883,6 +887,11 @@ NDBT_Tables::createTable(Ndb* pNdb, const char* _name, bool _temp,
} }
} }
} }
if(f != 0 && f(pNdb, tmpTab, 1))
{
ndbout << "Failed to create table" << endl;
return NDBT_FAILED;
}
} while(false); } while(false);
return r; return r;
......
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