1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-13 18:02:43 +03:00

wl2240 - ndb partitioning

Added create table hook for NDB API test framework
This commit is contained in:
joreland@mysql.com
2004-11-07 19:37:11 +01:00
parent b593c0cc8e
commit 4ff14f6c59
2 changed files with 17 additions and 6 deletions

View File

@@ -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);

View File

@@ -820,21 +820,25 @@ 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){
ndbout << "Could not create table " << _name
<< ", it doesn't exist in list of tables "\
"that NDBT_Tables can create!" << endl;
"that NDBT_Tables can create!" << endl;
return NDBT_WRONGARGS;
}
int r = 0;
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;