diff options
author | unknown <magnus@neptunus.(none)> | 2004-05-25 11:53:07 +0200 |
---|---|---|
committer | unknown <magnus@neptunus.(none)> | 2004-05-25 11:53:07 +0200 |
commit | af81ff81b9610b446152171544474d3a3464397f (patch) | |
tree | f542d4418f9afce707a4fe5a728fef5bfcdb1497 /ndb/test | |
parent | 88a3b3bca81656e94ea5eca77172045d551f1411 (diff) | |
download | mariadb-git-af81ff81b9610b446152171544474d3a3464397f.tar.gz |
Removed AttrType.hpp and moved the "internal" datatypes to their corresponding class.
Moved NdbSchemaCon and NdbSchemaOp out of the public NdbApi, it can however still be used by old test programs.
Added print oof indexes to desc.
ndb/BinDist.sh:
Removed AttrType.hpp from BinDist.sh
ndb/include/ndbapi/Ndb.hpp:
Removed NdbSchemaCon and NdbSchemaOp includes from public NdbApi
Removed AttrType.hpp
ndb/include/ndbapi/NdbApi.hpp:
Removed NdbSchemaCon and NdbSchemaOp includes from public NdbApi
Removed AttrType.hpp
ndb/include/ndbapi/NdbConnection.hpp:
Removed NdbSchemaCon and NdbSchemaOp includes from public NdbApi
Removed AttrType.hpp
Moved internal types to the class where they are used
ndb/include/ndbapi/NdbIndexOperation.hpp:
Use limit from ndbapi_limit.h
ndb/include/ndbapi/NdbOperation.hpp:
Removed NdbSchemaCon and NdbSchemaOp includes from public NdbApi
Removed AttrType.hpp
Remove faulty comment about how many attributes a key is allowed to consist of
Removed unused member variables
ndb/include/ndbapi/NdbRecAttr.hpp:
Removed NdbSchemaCon and NdbSchemaOp includes from public NdbApi
Removed AttrType.hpp
ndb/include/ndbapi/NdbSchemaCon.hpp:
Removed NdbSchemaCon and NdbSchemaOp includes from public NdbApi
Removed AttrType.hpp
ndb/include/ndbapi/NdbSchemaOp.hpp:
Removed NdbSchemaCon and NdbSchemaOp includes from public NdbApi
Removed AttrType.hpp
Moved all "old" datatypes here, so if a test program is still using old type, include NdbSchemaCon.hpp
ndb/include/ndbapi/ndbapi_limits.h:
Corrected limitations, added some from AttrTyp.hpp
ndb/src/Makefile:
Remove newtonapi from Makefile
ndb/src/kernel/blocks/backup/restore/Restore.hpp:
Removed AttrType
Include NdbSchemaCon since restore uses old types
ndb/src/kernel/blocks/backup/restore/main.cpp:
Include NdbOut
ndb/src/mgmsrv/MgmtSrvr.cpp:
Remov AttrType.hpp
ndb/src/ndbapi/ClusterMgr.cpp:
Remov AttrType.hpp
ndb/src/ndbapi/Ndb.cpp:
Removed NdbSchemaCon and NdbSchemaOp includes from public NdbApi
Removed AttrType.hpp
Moved internal types to the class where they are used
ndb/src/ndbapi/NdbApiSignal.cpp:
Removed AttrType.hpp
ndb/src/ndbapi/NdbApiSignal.hpp:
Removed AttrType.hpp
ndb/src/ndbapi/NdbConnection.cpp:
Moved internal type s to the class where they belong
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
RemovedAttrType.hpp
Use limits from ndbapi_limits.h
ndb/src/ndbapi/NdbEventOperationImpl.cpp:
Removed AttrType.hpp
Moved printRecAttr to end since it depends on old types and need to include "NdbSchemaCon", function will be rewritten and moved to NdbRecAttr. It's also useful from other places where an attribute has been read into an NdbRecAttr.
ndb/src/ndbapi/NdbIndexOperation.cpp:
Use limitations from ndbapi_limits.h
Moved internal tyeps to the class where they belongs
ndb/src/ndbapi/NdbOperation.cpp:
Use limits from ndbapi_limits.h
ndb/src/ndbapi/NdbOperationDefine.cpp:
Remove AttrType.hpp
ndb/src/ndbapi/NdbOperationExec.cpp:
Moved internal tyeps to the class where they belongs
ndb/src/ndbapi/NdbOperationInt.cpp:
RemovedAttrType.hpp
Use limits from ndbapi_limits.h
ndb/src/ndbapi/NdbOperationScan.cpp:
RemovedAttrType.hpp
Use limits from ndbapi_limits.h
ndb/src/ndbapi/NdbOperationSearch.cpp:
Removed AttrType.hpp
Use limits from ndbapi_limits.h
ndb/src/ndbapi/NdbResultSet.cpp:
Moved the "internal" types to corresponding class
ndb/src/ndbapi/NdbSchemaCon.cpp:
Updated not to be included in public NdbApi
ndb/src/ndbapi/NdbSchemaOp.cpp:
Updated not to be included in public NdbApi
ndb/src/ndbapi/NdbUtil.hpp:
Removed AttrType.hpp
ndb/src/ndbapi/Ndbif.cpp:
Removed AttrType.hpp
Removed NdbSchemaCon and NdbSchemaOp from public NdbApi
Moved "interal" types to their corresponding class
ndb/src/ndbapi/Ndbinit.cpp:
Removed NdbSchemaCon and NdbSchemaOp from public NdbApi
ndb/src/ndbapi/Ndblist.cpp:
Removed NdbSchemaCon and NdbSchemaOp from public NdbApi
Moved "internal" types to their corresponding class
ndb/src/ndbapi/TransporterFacade.cpp:
Removed AttrType.hpp
ndb/src/ndbapi/TransporterFacade.hpp:
Removed AttrType.hpp
Moved internal definition of how many Ndb objects to create to here
ndb/test/include/NDBT_Table.hpp:
Removed old NdbSchema*
Added function to print information about an index
ndb/test/ndbapi/acid/acid.cpp:
This test program uses old NdbScheaCon.hpp
ndb/test/ndbapi/flexAsynch/flexAsynch.cpp:
This test program uses old NdbScheaCon.hpp
ndb/test/ndbapi/flexScan/flexScan.cpp:
This test program uses old NdbScheaCon.hpp
ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp:
This test program uses old NdbScheaCon.hpp
ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp:
This test program uses old NdbScheaCon.hpp
ndb/test/ndbapi/ronja/initronja/initronja.cpp:
This test program uses old NdbScheaCon.hpp
ndb/test/ndbapi/telco/msa.cpp:
This test program uses old NdbScheaCon.hpp
ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp:
This test program uses old NdbScheaCon.hpp
ndb/test/ndbapi/testNdbApi/testNdbApi.cpp:
Remove AttrType.hpp
Define max number of Ndb objects test should "try" to create.
ndb/test/ndbapi/testRestartGci/testRestartGci.cpp:
Moved "internal" datatypes to corresponding class, in this case Ndb class
ndb/test/src/NDBT_ResultRow.cpp:
This test program uses old NdbScheaCon.hpp
But should soon use "printer" from NdbRecAttr
ndb/test/src/NDBT_Table.cpp:
Print table info more SQL like
ndb/test/src/UtilTransactions.cpp:
When AttrType.hpp, this hidden bug was discovered. Using wrong enum types in switch.
ndb/tools/desc/desc.cpp:
Alos print info about indexes for a table
Diffstat (limited to 'ndb/test')
-rw-r--r-- | ndb/test/include/NDBT_Table.hpp | 69 | ||||
-rw-r--r-- | ndb/test/ndbapi/acid/acid.cpp | 15 | ||||
-rw-r--r-- | ndb/test/ndbapi/flexAsynch/flexAsynch.cpp | 9 | ||||
-rw-r--r-- | ndb/test/ndbapi/flexScan/flexScan.cpp | 25 | ||||
-rw-r--r-- | ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp | 45 | ||||
-rw-r--r-- | ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp | 61 | ||||
-rw-r--r-- | ndb/test/ndbapi/ronja/initronja/initronja.cpp | 11 | ||||
-rw-r--r-- | ndb/test/ndbapi/telco/msa.cpp | 6 | ||||
-rw-r--r-- | ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp | 6 | ||||
-rw-r--r-- | ndb/test/ndbapi/testNdbApi/testNdbApi.cpp | 4 | ||||
-rw-r--r-- | ndb/test/ndbapi/testRestartGci/testRestartGci.cpp | 2 | ||||
-rw-r--r-- | ndb/test/src/NDBT_ResultRow.cpp | 12 | ||||
-rw-r--r-- | ndb/test/src/NDBT_Table.cpp | 40 | ||||
-rw-r--r-- | ndb/test/src/UtilTransactions.cpp | 4 |
14 files changed, 143 insertions, 166 deletions
diff --git a/ndb/test/include/NDBT_Table.hpp b/ndb/test/include/NDBT_Table.hpp index 950c1f15ff7..eee76773106 100644 --- a/ndb/test/include/NDBT_Table.hpp +++ b/ndb/test/include/NDBT_Table.hpp @@ -25,66 +25,6 @@ class NDBT_Attribute : public NdbDictionary::Column { friend class NdbOut& operator <<(class NdbOut&, const NDBT_Attribute &); public: - NDBT_Attribute(const char* anAttrName, - AttrType type, - int sz = 4, - KeyType key = NoKey, - bool nullable = false, - StorageAttributeType indexOnly = NormalStorageAttribute, - StorageMode _sm = MMBased) : - NdbDictionary::Column(anAttrName) - { - assert(anAttrName != 0); - - setNullable(nullable); - setIndexOnlyStorage(indexOnly == IndexStorageAttribute); - setPrimaryKey(key != NoKey); - setTupleKey(key == TupleId); - setLength(1); - switch(type){ - case ::Signed: - if(sz == 8) - setType(NdbDictionary::Column::Bigint); - else if (sz == 4) - setType(NdbDictionary::Column::Int); - else { - setType(NdbDictionary::Column::Int); - setLength(sz); - } - break; - - case ::UnSigned: - if(sz == 8) - setType(NdbDictionary::Column::Bigunsigned); - else if (sz == 4) - setType(NdbDictionary::Column::Unsigned); - else { - setType(NdbDictionary::Column::Unsigned); - setLength(sz); - } - break; - - case ::Float: - if(sz == 8) - setType(NdbDictionary::Column::Double); - else if (sz == 4) - setType(NdbDictionary::Column::Float); - else{ - setType(NdbDictionary::Column::Float); - setLength(sz); - } - break; - - case ::String: - setType(NdbDictionary::Column::Char); - setLength(sz); - break; - - case ::NoAttrTypeDef: - break; - } - } - NDBT_Attribute(const char* _name, Column::Type _type, int _length = 1, @@ -132,4 +72,13 @@ NDBT_Table::discoverTableFromDb(Ndb* ndb, const char * name){ return ndb->getDictionary()->getTable(name); } + +/** + * Print meta information about index + * (information on how it is strored, what the attributes look like etc.) + */ +class NdbOut& operator <<(class NdbOut&, const NdbDictionary::Index &); + + + #endif diff --git a/ndb/test/ndbapi/acid/acid.cpp b/ndb/test/ndbapi/acid/acid.cpp index 49961531a1c..157b3c7b3ef 100644 --- a/ndb/test/ndbapi/acid/acid.cpp +++ b/ndb/test/ndbapi/acid/acid.cpp @@ -15,6 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <NdbApi.hpp> +#include <NdbSchemaCon.hpp> #include <NdbMutex.h> #include <NdbOut.hpp> #include <NdbSleep.h> @@ -230,7 +231,6 @@ extern "C" void* NdbThreadFuncInsert(void* pArg) VerifyMethodInt(pNdbOperationW, setValue(c_szWarehouseSum, nWarehouseSum)); int iExec = pNdbConnection->execute(Commit); int iError = pNdbConnection->getNdbError().code; - CommitStatusType cs = pNdbConnection->commitStatus(); if(iExec<0 && iError!=0 && iError!=266 && iError!=630) { ReportMethodInt(iExec, pNdbConnection, "pNdbConnection", "execute(Commit)", __FILE__, __LINE__); @@ -285,7 +285,6 @@ extern "C" void* NdbThreadFuncUpdate(void* pArg) VerifyMethodInt(pNdbOperationW, setValue(c_szWarehouseSum, nWarehouseSum)); int iExec = pNdbConnection->execute(Commit); int iError = pNdbConnection->getNdbError().code; - CommitStatusType cs = pNdbConnection->commitStatus(); if(iExec<0 && iError!=0 && iError!=266 && iError!=626) { ReportMethodInt(iExec, pNdbConnection, "pNdbConnection", "execute(Commit)", __FILE__, __LINE__); @@ -333,7 +332,6 @@ extern "C" void* NdbThreadFuncDelete(void* pArg) } int iExec = pNdbConnection->execute(Commit); int iError = pNdbConnection->getNdbError().code; - CommitStatusType cs = pNdbConnection->commitStatus(); if(iExec<0 && iError!=0 && iError!=266 && iError!=626) { ReportMethodInt(iExec, pNdbConnection, "pNdbConnection", "execute(Commit)", __FILE__, __LINE__); @@ -389,7 +387,7 @@ extern "C" void* NdbThreadFuncRead(void* pArg) } int iExec = pNdbConnection->execute(Commit); int iError = pNdbConnection->getNdbError().code; - CommitStatusType cs = pNdbConnection->commitStatus(); + if(iExec<0 && iError!=0 && iError!=266 && iError!=626) { ReportMethodInt(iExec, pNdbConnection, "pNdbConnection", "execute(Commit)", __FILE__, __LINE__); } @@ -465,8 +463,7 @@ NDB_COMMAND(acid, "acid", "acid", "acid", 65535) VerifyMethodInt(pNdb, init()); VerifyMethodInt(pNdb, waitUntilReady()); - NdbSchemaCon* pNdbSchemaCon = NULL ; - VerifyMethodPtr(pNdbSchemaCon, pNdb, startSchemaTransaction()); + NdbSchemaCon* pNdbSchemaCon= NdbSchemaCon::startSchemaTrans(pNdb); if(!pNdbSchemaCon){ ndbout <<"startSchemaTransaction failed, exiting now" << endl ; delete pNdb ; @@ -497,9 +494,9 @@ NDB_COMMAND(acid, "acid", "acid", "acid", 65535) VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szWarehouseSum, NoKey, 32, 1, UnSigned, MMBased, false)); VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szWarehouseCount, NoKey, 32, 1, UnSigned, MMBased, false)); VerifyMethodInt(pNdbSchemaCon, execute()); - VerifyMethodVoid(pNdb, closeSchemaTransaction(pNdbSchemaCon)); + NdbSchemaCon::closeSchemaTrans(pNdbSchemaCon); - VerifyMethodPtr(pNdbSchemaCon, pNdb, startSchemaTransaction()); + pNdbSchemaCon= NdbSchemaCon::startSchemaTrans(pNdb); VerifyMethodPtr(pNdbSchemaOp, pNdbSchemaCon, getNdbSchemaOp()); #if defined NDB_OSE || defined NDB_SOFTOSE VerifyMethodInt(pNdbSchemaOp, createTable( @@ -526,7 +523,7 @@ NDB_COMMAND(acid, "acid", "acid", "acid", 65535) VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szDistrictSum, NoKey, 32, 1, UnSigned, MMBased, false)); VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szDistrictCount, NoKey, 32, 1, UnSigned, MMBased, false)); VerifyMethodInt(pNdbSchemaCon, execute()); - VerifyMethodVoid(pNdb, closeSchemaTransaction(pNdbSchemaCon)); + NdbSchemaCon::closeSchemaTrans(pNdbSchemaCon); g_pNdbMutex = NdbMutex_Create(); NdbMutex_Lock(g_pNdbMutex); diff --git a/ndb/test/ndbapi/flexAsynch/flexAsynch.cpp b/ndb/test/ndbapi/flexAsynch/flexAsynch.cpp index 0822f3ee999..396ac06c87a 100644 --- a/ndb/test/ndbapi/flexAsynch/flexAsynch.cpp +++ b/ndb/test/ndbapi/flexAsynch/flexAsynch.cpp @@ -15,7 +15,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "NdbApi.hpp" +#include <NdbSchemaCon.hpp> #include <NdbMain.h> #include <md5_hash.hpp> @@ -738,7 +740,7 @@ createTables(Ndb* pMyNdb){ if (theTableCreateFlag == 0) { for(int i=0; i < 1 ;i++) { ndbout << "Creating " << tableName[i] << "..." << endl; - MySchemaTransaction = pMyNdb->startSchemaTransaction(); + MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pMyNdb); if(MySchemaTransaction == NULL && (!error_handler(MySchemaTransaction->getNdbError()))) @@ -748,7 +750,8 @@ createTables(Ndb* pMyNdb){ if(MySchemaOp == NULL && (!error_handler(MySchemaTransaction->getNdbError()))) return -1; - + + check = MySchemaOp->createTable( tableName[i] ,8 // Table Size ,TupleKey // Key Type @@ -793,7 +796,7 @@ createTables(Ndb* pMyNdb){ (!error_handler(MySchemaTransaction->getNdbError()))) return -1; - pMyNdb->closeSchemaTransaction(MySchemaTransaction); + NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); } } diff --git a/ndb/test/ndbapi/flexScan/flexScan.cpp b/ndb/test/ndbapi/flexScan/flexScan.cpp index 19fb6dc5ab0..5b5b4dde730 100644 --- a/ndb/test/ndbapi/flexScan/flexScan.cpp +++ b/ndb/test/ndbapi/flexScan/flexScan.cpp @@ -62,6 +62,7 @@ #include <NdbMain.h> #include <NdbTest.hpp> #include <NDBT_Error.hpp> +#include <NdbSchemaCon.hpp> #define PKSIZE 1 #define FOREVER 1 @@ -151,7 +152,6 @@ static void UpdateArray(int *attrValue) int attrCount = 0; int opCount = 0; int sizeCount = 0; - int Index = 0; int* pValue = attrValue; for (tableCount = 0; tableCount < tNoOfTables; tableCount++) { @@ -179,7 +179,6 @@ static void Compare(int* attrValue, int* readValue) int attrCount = 0; int OpCount = 0; int first = 0; - int sizeCount = 0; for (tableCount = 0; tableCount < tNoOfTables; tableCount++) { for (attrCount = 0; attrCount < tNoOfAttributes-1; attrCount++) { @@ -592,19 +591,14 @@ flexScanThread(void* ThreadData) ThreadNdb* pThreadData = (ThreadNdb*)ThreadData; unsigned int thread_no = pThreadData->ThreadNo; unsigned int thread_base = (thread_no * 2000000) + (tNodeId * 26000); - int NrOfScannedRecords = 0; int tThreadResult = 0; Ndb* MyNdb = NULL; - NdbConnection *MyTransaction = NULL; - NdbOperation* MyOperation[MAXTABLES]; int check = 0; StartType tType = stLast; int* pkValue = NULL; int* attrValue = NULL; int* readValue = NULL; int AllocSize = 0; - NdbRecAttr* tTmp = NULL; - OperationType opType; AllocSize = tNoOfTables * (tNoOfAttributes-1) * tNoOfOperations * tAttributeSize * sizeof(int); @@ -770,15 +764,15 @@ static int createTables(Ndb* pMyNdb) do { i++; ndbout << endl << "Creating " << tableName[i - 1] << "..." << endl; - - MySchemaTransaction = pMyNdb->startSchemaTransaction(); + + MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pMyNdb); if( MySchemaTransaction == NULL ) { return (-1); } // if MySchemaOp = MySchemaTransaction->getNdbSchemaOp(); if( MySchemaOp == NULL ) { - pMyNdb->closeSchemaTransaction(MySchemaTransaction); + NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); return (-1); } // if @@ -800,14 +794,14 @@ static int createTables(Ndb* pMyNdb) ,40); // Nr of Pages #endif if (check == -1) { - pMyNdb->closeSchemaTransaction(MySchemaTransaction); + NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); return -1; } // if check = MySchemaOp->createAttribute( (char*)attrName[0], TupleKey, 32, PKSIZE, UnSigned, MMBased, NotNullAttribute ); if (check == -1) { - pMyNdb->closeSchemaTransaction(MySchemaTransaction); + NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); return -1; } // if @@ -815,7 +809,7 @@ static int createTables(Ndb* pMyNdb) check = MySchemaOp->createAttribute( (char*)attrName[j], NoKey, 32, tAttributeSize, UnSigned, MMBased, NotNullAttribute ); if (check == -1) { - pMyNdb->closeSchemaTransaction(MySchemaTransaction); + NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); return -1; } // if } // for @@ -825,7 +819,7 @@ static int createTables(Ndb* pMyNdb) ndbout << "Probably, " << tableName[i - 1] << " already exist" << endl; } // if - pMyNdb->closeSchemaTransaction(MySchemaTransaction); + NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); } while (tNoOfTables > i); } @@ -1058,7 +1052,6 @@ static int insertRows(Ndb* pNdb, // NDB object int attrCount = 0; NdbConnection* MyTransaction = NULL; NdbOperation* MyOperations[MAXTABLES] = {NULL}; - int Index = 0; int opCount = 0; for (opCount = 0; opCount < tNoOfOperations; opCount++) { @@ -1099,7 +1092,7 @@ static int insertRows(Ndb* pNdb, // NDB object } // if for (attrCount = 0; attrCount < tNoOfAttributes - 1; attrCount++) { - Index = tableCount * (tNoOfAttributes - 1) * tNoOfOperations * tAttributeSize + + int Index = tableCount * (tNoOfAttributes - 1) * tNoOfOperations * tAttributeSize + attrCount * tNoOfOperations * tAttributeSize + opCount * tAttributeSize; check = MyOperations[tableCount]-> setValue((char*)attrName[attrCount + 1], diff --git a/ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp b/ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp index a2352edf707..47960cd5d12 100644 --- a/ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp +++ b/ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp @@ -58,6 +58,7 @@ #include <NdbThread.h> #include <NdbMutex.h> #include <NdbApi.hpp> +#include <NdbSchemaCon.hpp> #include <NDBT.hpp> #define MAXATTR 3 @@ -93,8 +94,8 @@ TTYPE t_addReg(int, NdbOperation*); TTYPE t_subReg(int, NdbOperation*); TTYPE t_subroutineWithBranchLabel(int, NdbOperation*); -char tableName[MAXTABLES][MAXSTRLEN+1] = {0}; -char attrName[MAXATTR][MAXSTRLEN+1] = {0}; +char tableName[MAXSTRLEN+1]; +char attrName[MAXATTR][MAXSTRLEN+1]; int attrValue[NUMBEROFRECORDS] = {0}; int pkValue[NUMBEROFRECORDS] = {0}; const int tAttributeSize = 1 ; @@ -105,11 +106,9 @@ int bTestPassed = 0; int main(int argc, const char** argv) { - int tTableId = 0; int operationType = 0; - int tupTest = 0 ; - int scanTest = 0 ; - bool loop = 0 ; + int tupTest = 0; + int scanTest = 0; Ndb* pNdb = new Ndb("TEST_DB"); pNdb->init(); @@ -140,7 +139,7 @@ int main(int argc, const char** argv) { setAttrNames() ; setTableNames() ; - const void * p = NDBT_Table::discoverTableFromDb(pNdb, tableName[0]); + const void * p = NDBT_Table::discoverTableFromDb(pNdb, tableName); if (p != 0){ create_table(pNdb); } @@ -252,18 +251,17 @@ void create_table(Ndb* pMyNdb) { ***************************************************************/ int check = -1 ; - NdbSchemaCon *MySchemaTransaction = NULL ; NdbSchemaOp *MySchemaOp = NULL ; - ndbout << endl << "Creating " << tableName[0] << " ... " << endl; + ndbout << endl << "Creating " << tableName << " ... " << endl; - MySchemaTransaction = pMyNdb->startSchemaTransaction(); + NdbSchemaCon* MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pMyNdb); if(!MySchemaTransaction) error_handler(MySchemaTransaction->getNdbError(), NO_FAIL); MySchemaOp = MySchemaTransaction->getNdbSchemaOp(); if( !MySchemaOp ) error_handler(MySchemaTransaction->getNdbError(), NO_FAIL); // Create table - check = MySchemaOp->createTable( tableName[0], + check = MySchemaOp->createTable( tableName, 8, // Table size TupleKey, // Key Type 40 // Nr of Pages @@ -305,7 +303,8 @@ void create_table(Ndb* pMyNdb) { ndbout << tableName[0] << " created" << endl; } - pMyNdb->closeSchemaTransaction(MySchemaTransaction); + + NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); return; @@ -333,7 +332,7 @@ void write_rows (Ndb* pMyNdb) { error_handler(pMyNdb->getNdbError(), NO_FAIL); }//if - MyOperation = MyTransaction->getNdbOperation(tableName[0]); + MyOperation = MyTransaction->getNdbOperation(tableName); if (!MyOperation) { error_handler(pMyNdb->getNdbError(), NO_FAIL); }//if @@ -366,9 +365,6 @@ void verify_deleted(Ndb* pMyNdb) { int check = -1 ; int loop_count_ops = nRecords; - NdbRecAttr* tTmp; - int readValue[MAXATTR]; - NdbConnection* pMyTransaction = NULL ; NdbOperation* pMyOperation = NULL ; ndbout << "Verifying deleted records..."<< flush; @@ -378,7 +374,7 @@ void verify_deleted(Ndb* pMyNdb) { NdbConnection* pMyTransaction = pMyNdb->startTransaction(); if (!pMyTransaction) error_handler(pMyNdb->getNdbError(), NO_FAIL); - pMyOperation = pMyTransaction->getNdbOperation(tableName[0]); + pMyOperation = pMyTransaction->getNdbOperation(tableName); if (!pMyOperation) error_handler(pMyNdb->getNdbError(), NO_FAIL); check = pMyOperation->readTuple(); @@ -421,7 +417,7 @@ void read_and_verify_rows(Ndb* pMyNdb, bool pre) { pMyTransaction = pMyNdb->startTransaction(); if (!pMyTransaction) error_handler(pMyNdb->getNdbError(), NO_FAIL); - MyOp = pMyTransaction->getNdbOperation(tableName[0]); + MyOp = pMyTransaction->getNdbOperation(tableName); if (!MyOp) error_handler( pMyTransaction->getNdbError(), NO_FAIL); @@ -1232,14 +1228,13 @@ void scan_rows(Ndb* pMyNdb, int opType, int tupleType, int scanType) { int readValue = 0 ; int readValue2 = 0 ; int scanCount = 0 ; - NdbRecAttr* tTmp = NULL ; TTYPE fail = NO_FAIL ; for (int count=0 ; count < loop_count_ops ; count++) { NdbConnection* MyTransaction = pMyNdb->startTransaction(); if (!MyTransaction) error_handler(pMyNdb->getNdbError(), NO_FAIL); - NdbOperation* MyOperation = MyTransaction->getNdbOperation(tableName[0]); + NdbOperation* MyOperation = MyTransaction->getNdbOperation(tableName); if (!MyOperation) error_handler(pMyNdb->getNdbError(), NO_FAIL); if (opType == 1) @@ -1306,7 +1301,7 @@ void scan_rows(Ndb* pMyNdb, int opType, int tupleType, int scanType) { }else{ // Sends the SCAN_NEXTREQ signal(s) and reads the answer in TRANS_ID signals. // SCAN_TABCONF or SCAN_TABREF is the confirmation. - while (eOf = MyTransaction->nextScanResult() == 0) { + while ((eOf = MyTransaction->nextScanResult()) == 0) { ndbout << readValue <<"; "; // Here we call takeOverScanOp for update of the tuple. } @@ -1348,7 +1343,7 @@ void update_rows(Ndb* pMyNdb, int tupleType, int opType) { return; }//if - MyOperation = MyTransaction->getNdbOperation(tableName[0]); + MyOperation = MyTransaction->getNdbOperation(tableName); if (MyOperation == NULL) { error_handler(pMyNdb->getNdbError(), NO_FAIL); return; @@ -1442,7 +1437,7 @@ void delete_rows(Ndb* pMyNdb, int tupleTest, int opType) { MyTransaction = pMyNdb->startTransaction(); if (!MyTransaction) error_handler(pMyNdb->getNdbError(), NO_FAIL) ; - MyOperation = MyTransaction->getNdbOperation(tableName[0]); + MyOperation = MyTransaction->getNdbOperation(tableName); if (!MyOperation) error_handler(pMyNdb->getNdbError(), NO_FAIL) ; check = MyOperation->interpretedDeleteTuple(); @@ -1517,8 +1512,6 @@ inline void setAttrNames(){ inline void setTableNames(){ - for (int i = 0; i < MAXTABLES; i++){ - snprintf(tableName[i], MAXSTRLEN, "TAB%d", i); - } + snprintf(tableName, MAXSTRLEN, "TAB1"); } diff --git a/ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp b/ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp index 67c4e037215..fe3c17acbf5 100644 --- a/ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp +++ b/ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp @@ -32,6 +32,7 @@ #include <NdbSleep.h> #include "ndb_schema.hpp" #include <NDBT.hpp> +#include <NdbSchemaCon.hpp> /*************************************************************** * L O C A L C O N S T A N T S * @@ -141,13 +142,11 @@ extern int useIndexTables; int -create_table_server(Ndb * pNDB){ - +create_table_server(Ndb * pNdb){ int check; - - NdbSchemaCon * MySchemaTransaction = pNDB->startSchemaTransaction(); + NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb); if( MySchemaTransaction == NULL ) - error_handler("startSchemaTransaction", pNDB->getNdbError(), 0); + error_handler("startSchemaTransaction", pNdb->getNdbError(), 0); NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp(); if( MySchemaOp == NULL ) @@ -246,17 +245,17 @@ create_table_server(Ndb * pNDB){ error_handler("schemaTransaction->execute()", MySchemaTransaction->getNdbError(), 0); } - pNDB->closeSchemaTransaction(MySchemaTransaction); + NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); return 0; } int -create_table_group(Ndb * pNDB){ +create_table_group(Ndb * pNdb){ int check; - NdbSchemaCon * MySchemaTransaction = pNDB->startSchemaTransaction(); + NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb); if( MySchemaTransaction == NULL ) - error_handler("startSchemaTransaction", pNDB->getNdbError(), 0); + error_handler("startSchemaTransaction", pNdb->getNdbError(), 0); NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp(); if( MySchemaOp == NULL ) @@ -340,16 +339,16 @@ create_table_group(Ndb * pNDB){ error_handler("schemaTransaction->execute()", MySchemaTransaction->getNdbError(), 0); } - pNDB->closeSchemaTransaction(MySchemaTransaction); + NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); return 0; } int -create_table_subscriber(Ndb * pNDB){ +create_table_subscriber(Ndb * pNdb){ int check; - NdbSchemaCon * MySchemaTransaction = pNDB->startSchemaTransaction(); + NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb); if( MySchemaTransaction == NULL ) - error_handler("startSchemaTransaction", pNDB->getNdbError(), 0); + error_handler("startSchemaTransaction", pNdb->getNdbError(), 0); NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp(); if( MySchemaOp == NULL ) @@ -459,16 +458,16 @@ create_table_subscriber(Ndb * pNDB){ error_handler("schemaTransaction->execute()", MySchemaTransaction->getNdbError(), 0); } - pNDB->closeSchemaTransaction(MySchemaTransaction); + NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); return 0; } int -create_table_session(Ndb * pNDB){ +create_table_session(Ndb * pNdb){ int check; - NdbSchemaCon * MySchemaTransaction = pNDB->startSchemaTransaction(); + NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb); if( MySchemaTransaction == NULL ) - error_handler("startSchemaTransaction", pNDB->getNdbError(), 0); + error_handler("startSchemaTransaction", pNdb->getNdbError(), 0); NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp(); if( MySchemaOp == NULL ) @@ -533,29 +532,29 @@ create_table_session(Ndb * pNDB){ error_handler("schemaTransaction->execute()", MySchemaTransaction->getNdbError(), 0); } - pNDB->closeSchemaTransaction(MySchemaTransaction); + NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); return 0; } void -create_table(const char * name, int (* function)(Ndb * pNDB), Ndb* pNDB){ +create_table(const char * name, int (* function)(Ndb * pNdb), Ndb* pNdb){ printf("creating table %s...", name); - if(pNDB->getDictionary()->getTable(name) != 0){ + if(pNdb->getDictionary()->getTable(name) != 0){ printf(" it already exists\n"); return; } else { printf("\n"); } - function(pNDB); + function(pNdb); printf("creating table %s... done\n", name); } -static int dbCreate(Ndb * pNDB) +static int dbCreate(Ndb * pNdb) { - create_table(SUBSCRIBER_TABLE, create_table_subscriber, pNDB); - create_table(GROUP_TABLE , create_table_group, pNDB); - create_table(SESSION_TABLE , create_table_session, pNDB); - create_table(SERVER_TABLE , create_table_server, pNDB); + create_table(SUBSCRIBER_TABLE, create_table_subscriber, pNdb); + create_table(GROUP_TABLE , create_table_group, pNdb); + create_table(SESSION_TABLE , create_table_session, pNdb); + create_table(SERVER_TABLE , create_table_server, pNdb); return 0; } @@ -570,23 +569,23 @@ userDbConnect(uint32 createDb, char *dbName) { NdbMutex_Lock(startupMutex); - Ndb * pNDB = new Ndb(""); + Ndb * pNdb = new Ndb(""); //printf("Initializing...\n"); - pNDB->init(); + pNdb->init(); //printf("Waiting..."); - while(pNDB->waitUntilReady() != 0){ + while(pNdb->waitUntilReady() != 0){ //printf("..."); } // printf("done\n"); if( createDb ) - dbCreate(pNDB); + dbCreate(pNdb); UserHandle * uh = new UserHandle; - uh->pNDB = pNDB; + uh->pNDB = pNdb; uh->pCurrTrans = 0; NdbMutex_Unlock(startupMutex); diff --git a/ndb/test/ndbapi/ronja/initronja/initronja.cpp b/ndb/test/ndbapi/ronja/initronja/initronja.cpp index f3f4d9628e2..b3215104822 100644 --- a/ndb/test/ndbapi/ronja/initronja/initronja.cpp +++ b/ndb/test/ndbapi/ronja/initronja/initronja.cpp @@ -21,6 +21,7 @@ * *************************************************** */ #include "NdbApi.hpp" +#include "NdbSchemaCon.hpp" #include <NdbOut.hpp> #include <NdbMain.h> #include <NdbTest.hpp> @@ -90,7 +91,7 @@ NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){ ndbout << endl << "Creating the table SHORT_REC" << "..." << endl; - MySchemaTransaction = pNdb->startSchemaTransaction(); + MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb); if(!MySchemaTransaction) goto error_handler; MySchemaOp = MySchemaTransaction->getNdbSchemaOp(); if(!MySchemaOp) goto error_handler; @@ -148,11 +149,11 @@ NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){ ndbout << "SHORT_REC created " << endl; }// if - pNdb->closeSchemaTransaction(MySchemaTransaction); + NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); ndbout << endl << "Creating the table LONG_REC..." << endl; - MySchemaTransaction = pNdb->startSchemaTransaction(); + MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb); if(!MySchemaTransaction) goto error_handler; MySchemaOp = MySchemaTransaction->getNdbSchemaOp(); @@ -212,7 +213,7 @@ NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){ ndbout << "LONG_REC created" << endl; }// if - pNdb->closeSchemaTransaction(MySchemaTransaction); + NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); check = InsertRecords(pNdb, tNoOfRecords); @@ -234,7 +235,7 @@ NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){ error_handler: ndbout << "SchemaTransaction returned error:" ; ndbout << MySchemaTransaction->getNdbError() << endl; - pNdb->closeSchemaTransaction(MySchemaTransaction); + NdbSchemaCon::closeSchemaTrans(MySchemaTransaction); delete pNdb ; NDBT_ProgramExit(NDBT_FAILED) ; exit(-1); diff --git a/ndb/test/ndbapi/telco/msa.cpp b/ndb/test/ndbapi/telco/msa.cpp index 39ddaac2019..7a734f9cb79 100644 --- a/ndb/test/ndbapi/telco/msa.cpp +++ b/ndb/test/ndbapi/telco/msa.cpp @@ -17,6 +17,7 @@ #include <ndb_global.h> #include <NdbApi.hpp> +#include <NdbSchemaCon.hpp> #include <NdbCondition.h> #include <NdbMutex.h> #include <NdbSleep.h> @@ -849,7 +850,7 @@ int CreateCallContextTable(Ndb* pNdb, const char* szTableName, bool bStored) NdbError err; memset(&err, 0, sizeof(err)); - NdbSchemaCon* pNdbSchemaCon = pNdb->startSchemaTransaction(); + NdbSchemaCon* pNdbSchemaCon = NdbSchemaCon::startSchemaTrans(pNdb); if(pNdbSchemaCon) { NdbSchemaOp* pNdbSchemaOp = pNdbSchemaCon->getNdbSchemaOp(); @@ -874,7 +875,8 @@ int CreateCallContextTable(Ndb* pNdb, const char* szTableName, bool bStored) } else err = pNdbSchemaCon->getNdbError(); - pNdb->closeSchemaTransaction(pNdbSchemaCon); + + NdbSchemaCon::closeSchemaTrans(pNdbSchemaCon); } else err = pNdb->getNdbError(); diff --git a/ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp b/ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp index b8e0fef6cef..75773040113 100644 --- a/ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp +++ b/ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp @@ -34,7 +34,7 @@ #include <NdbOut.hpp> #include <NdbApi.hpp> #include <NdbTest.hpp> - +#include <NdbSchemaCon.hpp> // limits static int const MaxAttr = 64; static int const MaxOper = 1000; @@ -99,7 +99,7 @@ ndberror(char const* fmt, ...) if (tcon) ndbout << "tcon: " << tcon->getNdbError() << endl; if (top) - ndbout << "top : " << top->getNdbError() << endl; + ndbout << "top: " << top->getNdbError() << endl; if (con) ndbout << "con : " << con->getNdbError() << endl; if (op) @@ -258,7 +258,7 @@ testcase(int flag) if (ndb->waitUntilReady(30) < 0) return ndberror("waitUntilReady"); - if ((tcon = ndb->startSchemaTransaction()) == 0) + if ((tcon = NdbSchemaCon::startSchemaTrans(ndb)) == 0) return ndberror("startSchemaTransaction"); if ((top = tcon->getNdbSchemaOp()) == 0) return ndberror("getNdbSchemaOp"); diff --git a/ndb/test/ndbapi/testNdbApi/testNdbApi.cpp b/ndb/test/ndbapi/testNdbApi/testNdbApi.cpp index c0e262f590f..2e08ebbed4e 100644 --- a/ndb/test/ndbapi/testNdbApi/testNdbApi.cpp +++ b/ndb/test/ndbapi/testNdbApi/testNdbApi.cpp @@ -23,8 +23,8 @@ #include <Vector.hpp> #include <random.h> #include <NdbTick.h> -#include <AttrType.hpp> +#define MAX_NDB_OBJECTS 32678 #define CHECK(b) if (!(b)) { \ ndbout << "ERR: "<< step->getName() \ @@ -79,7 +79,7 @@ int runTestMaxNdb(NDBT_Context* ctx, NDBT_Step* step){ ndbout << i << " ndb objects created" << endl; - if (l > 0 && i != oldi && init != MAX_NO_THREADS){ + if (l > 0 && i != oldi && init != MAX_NDB_OBJECTS){ ndbout << l << ": not as manyNdb objects created" << endl << i << " != " << oldi << endl; result = NDBT_FAILED; diff --git a/ndb/test/ndbapi/testRestartGci/testRestartGci.cpp b/ndb/test/ndbapi/testRestartGci/testRestartGci.cpp index 1e36368ba62..e3dd1f8e2ce 100644 --- a/ndb/test/ndbapi/testRestartGci/testRestartGci.cpp +++ b/ndb/test/ndbapi/testRestartGci/testRestartGci.cpp @@ -121,7 +121,7 @@ int runVerifyInserts(NDBT_Context* ctx, NDBT_Step* step){ HugoOperations hugoOps(*ctx->getTab()); NdbRestarter restarter; - int restartGCI = pNdb->NdbTamper(ReadRestartGCI, 0); + int restartGCI = pNdb->NdbTamper(Ndb::ReadRestartGCI, 0); ndbout << "restartGCI = " << restartGCI << endl; int count = 0; diff --git a/ndb/test/src/NDBT_ResultRow.cpp b/ndb/test/src/NDBT_ResultRow.cpp index ba46be203e1..c16b8968097 100644 --- a/ndb/test/src/NDBT_ResultRow.cpp +++ b/ndb/test/src/NDBT_ResultRow.cpp @@ -17,6 +17,7 @@ #include <ndb_global.h> #include "NDBT_ResultRow.hpp" #include <NdbOut.hpp> +#include <NdbSchemaCon.hpp> NDBT_ResultRow::NDBT_ResultRow(const NdbDictionary::Table& tab, char attrib_delimiter) @@ -109,6 +110,12 @@ BaseString NDBT_ResultRow::c_str() { return str; } + +/** + * TODO This could chare the sanme printer function as in + * NdbEventOperationImpl.cpp, using new types of course :) + */ + NdbOut & operator << (NdbOut& ndbout, const NDBT_ResultRow & res) { for(int i = 0; i<res.cols; i++){ @@ -117,7 +124,7 @@ operator << (NdbOut& ndbout, const NDBT_ResultRow & res) { else{ const int size = res.data[i]->attrSize(); const int aSize = res.data[i]->arraySize(); - switch(res.data[i]->attrType()){ + switch(convertColumnTypeToAttrType(res.data[i]->getType())){ case UnSigned: switch(size){ case 8: @@ -174,7 +181,8 @@ operator << (NdbOut& ndbout, const NDBT_ResultRow & res) { break; default: - ndbout << "Unknown(" << res.data[i]->attrType() << ")"; + ndbout << "Unknown(" << + convertColumnTypeToAttrType(res.data[i]->getType()) << ")"; break; } } diff --git a/ndb/test/src/NDBT_Table.cpp b/ndb/test/src/NDBT_Table.cpp index c520b01c990..48c8567e10e 100644 --- a/ndb/test/src/NDBT_Table.cpp +++ b/ndb/test/src/NDBT_Table.cpp @@ -26,7 +26,7 @@ operator <<(class NdbOut& ndbout, const NDBT_Attribute & attr){ bool key = attr.getPrimaryKey(); bool null = attr.getNullable(); - ndbout << attr.getName() << "\t"; + ndbout << attr.getName() << " "; char tmp[100]; if(attr.getLength() != 1) snprintf(tmp, 100," [%d]", attr.getLength()); @@ -103,16 +103,16 @@ operator <<(class NdbOut& ndbout, const NDBT_Attribute & attr){ ndbout << "Unknown(" << type << ")"; } - ndbout << "\t"; + ndbout << " "; if(null){ ndbout << "NULL"; } else { ndbout << "NOT NULL"; } - ndbout << "\t"; + ndbout << " "; if(key) - ndbout << "\tprimary key"; + ndbout << "PRIMARY KEY"; return ndbout; } @@ -130,6 +130,9 @@ operator <<(class NdbOut& ndbout, const NDBT_Table & tab) ndbout << "Temporary table: " << (tab.getStoredTable() ? "no" : "yes") << endl; ndbout << "Number of attributes: " << tab.getNoOfColumns() << endl; ndbout << "Number of primary keys: " << tab.getNoOfPrimaryKeys() << endl; + ndbout << "Length of frm data: " << tab.getFrmLength() << endl; + + //<< ((tab.getTupleKey() == TupleId) ? " tupleid" : "") <<endl; ndbout << "TableStatus: "; switch(tab.getObjectStatus()){ @@ -154,3 +157,32 @@ operator <<(class NdbOut& ndbout, const NDBT_Table & tab) return ndbout; } + +class NdbOut& operator <<(class NdbOut&, const NdbDictionary::Index & idx) +{ + ndbout << idx.getName(); + ndbout << "("; + for (unsigned i=0; i < idx.getNoOfColumns(); i++) + { + const NdbDictionary::Column *col = idx.getColumn(i); + ndbout << col->getName(); + if (i < idx.getNoOfColumns()-1) + ndbout << ", "; + } + ndbout << ")"; + + ndbout << " - "; + switch (idx.getType()) { + case NdbDictionary::Object::UniqueHashIndex: + ndbout << "UniqueHashIndex"; + break; + case NdbDictionary::Object::OrderedIndex: + ndbout << "OrderedIndex"; + break; + default: + ndbout << "Type " << idx.getType(); + break; + } + return ndbout; +} + diff --git a/ndb/test/src/UtilTransactions.cpp b/ndb/test/src/UtilTransactions.cpp index 2e6ff360123..3ef31a2f535 100644 --- a/ndb/test/src/UtilTransactions.cpp +++ b/ndb/test/src/UtilTransactions.cpp @@ -980,8 +980,8 @@ UtilTransactions::verifyIndex(Ndb* pNdb, } switch (pIndex->getType()){ - case UniqueHashIndex: - case OrderedIndex: + case NdbDictionary::Index::UniqueHashIndex: + case NdbDictionary::Index::OrderedIndex: return verifyUniqueIndex(pNdb, indexName, parallelism, transactional); break; default: |