From 4ff14f6c597c94dece22b25fac2f031e72d43656 Mon Sep 17 00:00:00 2001 From: "joreland@mysql.com" <> Date: Sun, 7 Nov 2004 19:37:11 +0100 Subject: [PATCH] wl2240 - ndb partitioning Added create table hook for NDB API test framework --- ndb/test/include/NDBT_Tables.hpp | 6 ++++-- ndb/test/src/NDBT_Tables.cpp | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ndb/test/include/NDBT_Tables.hpp b/ndb/test/include/NDBT_Tables.hpp index aa78f7d4e2c..fb0df8aa35b 100644 --- a/ndb/test/include/NDBT_Tables.hpp +++ b/ndb/test/include/NDBT_Tables.hpp @@ -23,11 +23,13 @@ #include #include +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); diff --git a/ndb/test/src/NDBT_Tables.cpp b/ndb/test/src/NDBT_Tables.cpp index ff6db3e892c..b61d48b216c 100644 --- a/ndb/test/src/NDBT_Tables.cpp +++ b/ndb/test/src/NDBT_Tables.cpp @@ -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;