diff options
author | unknown <pekka@mysql.com> | 2006-05-03 23:17:16 +0200 |
---|---|---|
committer | unknown <pekka@mysql.com> | 2006-05-03 23:17:16 +0200 |
commit | b5732e7c8cb8d89ca25ed5948f457159a4adc3e0 (patch) | |
tree | e6435daebce15a6980f558389be842f1db477813 /ndb/tools | |
parent | b0ecf7046bc0e3b0fca03f768f8aa382e5b12a5e (diff) | |
parent | 6b02ec1caa35731f1532c4f4dc158a0d18a7a57a (diff) | |
download | mariadb-git-b5732e7c8cb8d89ca25ed5948f457159a4adc3e0.tar.gz |
Merge pnousiainen@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/space/pekka/ndb/version/my50
mysql-test/r/ndb_blob.result:
Auto merged
mysql-test/t/ndb_blob.test:
Auto merged
ndb/include/kernel/signaldata/TcKeyReq.hpp:
Auto merged
ndb/include/ndbapi/NdbBlob.hpp:
Auto merged
ndb/src/ndbapi/NdbBlob.cpp:
Auto merged
ndb/test/ndbapi/testBlobs.cpp:
Auto merged
sql/sql_table.cc:
Auto merged
ndb/tools/delete_all.cpp:
nuts
Diffstat (limited to 'ndb/tools')
-rw-r--r-- | ndb/tools/delete_all.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/ndb/tools/delete_all.cpp b/ndb/tools/delete_all.cpp index d6972e33cc0..6aea9f87aaa 100644 --- a/ndb/tools/delete_all.cpp +++ b/ndb/tools/delete_all.cpp @@ -23,17 +23,21 @@ #include <NDBT.hpp> static int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, - bool commit_across_open_cursor, int parallelism=240); + bool fetch_across_commit, int parallelism=240); NDB_STD_OPTS_VARS; static const char* _dbname = "TEST_DB"; +static my_bool _transactional = false; static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_desc"), { "database", 'd', "Name of database table is in", (gptr*) &_dbname, (gptr*) &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, + { "transactional", 't', "Single transaction (may run out of operations)", + (gptr*) &_transactional, (gptr*) &_transactional, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; static void usage() @@ -84,18 +88,11 @@ int main(int argc, char** argv){ ndbout << " Table " << argv[i] << " does not exist!" << endl; return NDBT_ProgramExit(NDBT_WRONGARGS); } - // Check if we have any blobs - bool commit_across_open_cursor = true; - for (int j = 0; j < pTab->getNoOfColumns(); j++) { - NdbDictionary::Column::Type t = pTab->getColumn(j)->getType(); - if (t == NdbDictionary::Column::Blob || - t == NdbDictionary::Column::Text) { - commit_across_open_cursor = false; - break; - } - } - ndbout << "Deleting all from " << argv[i] << "..."; - if(clear_table(&MyNdb, pTab, commit_across_open_cursor) == NDBT_FAILED){ + ndbout << "Deleting all from " << argv[i]; + if (! _transactional) + ndbout << " (non-transactional)"; + ndbout << " ..."; + if(clear_table(&MyNdb, pTab, ! _transactional) == NDBT_FAILED){ res = NDBT_FAILED; ndbout << "FAILED" << endl; } @@ -105,7 +102,7 @@ int main(int argc, char** argv){ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, - bool commit_across_open_cursor, int parallelism) + bool fetch_across_commit, int parallelism) { // Scan all records exclusive and delete // them one by one @@ -136,7 +133,7 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, } goto failed; } - + pOp = pTrans->getNdbScanOperation(pTab->getName()); if (pOp == NULL) { goto failed; @@ -166,7 +163,7 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, } while((check = pOp->nextResult(false)) == 0); if(check != -1){ - if (commit_across_open_cursor) { + if (fetch_across_commit) { check = pTrans->execute(NdbTransaction::Commit); pTrans->restart(); // new tx id } else { @@ -197,7 +194,7 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, } goto failed; } - if (! commit_across_open_cursor && + if (! fetch_across_commit && pTrans->execute(NdbTransaction::Commit) != 0) { err = pTrans->getNdbError(); goto failed; |