Commit 4ff14f6c authored by joreland@mysql.com's avatar joreland@mysql.com

wl2240 - ndb partitioning

Added create table hook for NDB API test framework
parent b593c0cc
......@@ -23,11 +23,13 @@
#include <NdbDictionary.hpp>
#include <NDBT_Table.hpp>
typedef int (* NDBT_CreateTableHook)(Ndb*, NdbDictionary::Table&, int when);
class NDBT_Tables {
public:
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);
......
......@@ -820,7 +820,7 @@ NDBT_Tables::createAllTables(Ndb* pNdb){
int
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);
if (tab == NULL){
......@@ -834,7 +834,11 @@ NDBT_Tables::createTable(Ndb* pNdb, const char* _name, bool _temp,
do {
NdbDictionary::Table tmpTab(* tab);
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);
if(r == -1){
if(!existsOk){
......@@ -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);
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