summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpekka@mysql.com <>2004-09-15 19:26:00 +0200
committerpekka@mysql.com <>2004-09-15 19:26:00 +0200
commit083e4f475aa55c5bb63f36eac3e53a586df6353a (patch)
treeaf33d53e80d6667d99e2016e6a5eb182b604c5af
parent0b83acb8dfd5ea92e5c8a2a5cd49577d26d73978 (diff)
parent0caba84b46fa28cddab1cfdc257f2600fbd3791a (diff)
downloadmariadb-git-083e4f475aa55c5bb63f36eac3e53a586df6353a.tar.gz
Merge
-rw-r--r--ndb/examples/ndbapi_async_example/ndbapi_async.cpp11
-rw-r--r--ndb/examples/ndbapi_example1/ndbapi_example1.cpp5
-rw-r--r--ndb/examples/ndbapi_example2/ndbapi_example2.cpp1
-rw-r--r--ndb/examples/ndbapi_example3/ndbapi_example3.cpp1
-rw-r--r--ndb/examples/ndbapi_example4/ndbapi_example4.cpp5
-rw-r--r--ndb/examples/ndbapi_example5/ndbapi_example5.cpp1
-rw-r--r--ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp10
-rw-r--r--ndb/examples/select_all/select_all.cpp1
-rw-r--r--ndb/include/kernel/signaldata/DictTabInfo.hpp4
-rw-r--r--ndb/include/ndb_global.h3
-rw-r--r--ndb/include/ndbapi/NdbDictionary.hpp26
-rw-r--r--ndb/include/util/NdbSqlUtil.hpp7
-rw-r--r--ndb/src/common/util/Makefile.am2
-rw-r--r--ndb/src/common/util/NdbSqlUtil.cpp77
-rw-r--r--ndb/src/common/util/ndb_init.c29
-rw-r--r--ndb/src/kernel/blocks/backup/read.cpp1
-rw-r--r--ndb/src/kernel/blocks/backup/restore/main.cpp1
-rw-r--r--ndb/src/kernel/blocks/dbdict/Dbdict.cpp2
-rw-r--r--ndb/src/kernel/main.cpp1
-rw-r--r--ndb/src/kernel/vm/Configuration.cpp2
-rw-r--r--ndb/src/mgmclient/main.cpp1
-rw-r--r--ndb/src/mgmsrv/main.cpp3
-rw-r--r--ndb/src/mgmsrv/mkconfig/mkconfig.cpp1
-rw-r--r--ndb/src/ndbapi/NdbDictionary.cpp58
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.cpp163
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.hpp12
-rw-r--r--ndb/src/ndbapi/Ndbinit.cpp2
-rw-r--r--ndb/src/ndbapi/ndberror.c3
-rw-r--r--ndb/test/include/NDBT_Table.hpp4
-rw-r--r--ndb/test/ndbapi/acid.cpp1
-rw-r--r--ndb/test/ndbapi/acid2.cpp1
-rw-r--r--ndb/test/ndbapi/bank/bankCreator.cpp1
-rw-r--r--ndb/test/ndbapi/bank/bankMakeGL.cpp1
-rw-r--r--ndb/test/ndbapi/bank/bankSumAccounts.cpp1
-rw-r--r--ndb/test/ndbapi/bank/bankTimer.cpp1
-rw-r--r--ndb/test/ndbapi/bank/bankTransactionMaker.cpp1
-rw-r--r--ndb/test/ndbapi/bank/bankValidateAllGLs.cpp1
-rw-r--r--ndb/test/ndbapi/bank/testBank.cpp1
-rw-r--r--ndb/test/ndbapi/benchronja.cpp1
-rw-r--r--ndb/test/ndbapi/bulk_copy.cpp1
-rw-r--r--ndb/test/ndbapi/cdrserver.cpp1
-rw-r--r--ndb/test/ndbapi/celloDb.cpp1
-rw-r--r--ndb/test/ndbapi/create_all_tabs.cpp1
-rw-r--r--ndb/test/ndbapi/create_tab.cpp1
-rw-r--r--ndb/test/ndbapi/drop_all_tabs.cpp1
-rw-r--r--ndb/test/ndbapi/flexAsynch.cpp1
-rw-r--r--ndb/test/ndbapi/flexBench.cpp1
-rw-r--r--ndb/test/ndbapi/flexHammer.cpp1
-rw-r--r--ndb/test/ndbapi/flexScan.cpp1
-rw-r--r--ndb/test/ndbapi/flexTT.cpp1
-rw-r--r--ndb/test/ndbapi/flexTimedAsynch.cpp1
-rw-r--r--ndb/test/ndbapi/flex_bench_mysql.cpp1
-rw-r--r--ndb/test/ndbapi/index.cpp17
-rw-r--r--ndb/test/ndbapi/index2.cpp5
-rw-r--r--ndb/test/ndbapi/initronja.cpp1
-rw-r--r--ndb/test/ndbapi/interpreterInTup.cpp1
-rw-r--r--ndb/test/ndbapi/mainAsyncGenerator.cpp1
-rw-r--r--ndb/test/ndbapi/msa.cpp1
-rw-r--r--ndb/test/ndbapi/restarter.cpp1
-rw-r--r--ndb/test/ndbapi/restarter2.cpp1
-rw-r--r--ndb/test/ndbapi/restarts.cpp1
-rw-r--r--ndb/test/ndbapi/size.cpp1
-rw-r--r--ndb/test/ndbapi/slow_select.cpp1
-rw-r--r--ndb/test/ndbapi/testBackup.cpp1
-rw-r--r--ndb/test/ndbapi/testBasic.cpp1
-rw-r--r--ndb/test/ndbapi/testBasicAsynch.cpp1
-rw-r--r--ndb/test/ndbapi/testBlobs.cpp1
-rw-r--r--ndb/test/ndbapi/testDataBuffers.cpp1
-rw-r--r--ndb/test/ndbapi/testDeadlock.cpp1
-rw-r--r--ndb/test/ndbapi/testDict.cpp3
-rw-r--r--ndb/test/ndbapi/testGrep.cpp1
-rw-r--r--ndb/test/ndbapi/testGrepVerify.cpp1
-rw-r--r--ndb/test/ndbapi/testIndex.cpp1
-rw-r--r--ndb/test/ndbapi/testInterpreter.cpp1
-rw-r--r--ndb/test/ndbapi/testMgm.cpp1
-rw-r--r--ndb/test/ndbapi/testNdbApi.cpp1
-rw-r--r--ndb/test/ndbapi/testNodeRestart.cpp1
-rw-r--r--ndb/test/ndbapi/testOIBasic.cpp6
-rw-r--r--ndb/test/ndbapi/testOperations.cpp1
-rw-r--r--ndb/test/ndbapi/testOrderedIndex.cpp1
-rw-r--r--ndb/test/ndbapi/testReadPerf.cpp1
-rw-r--r--ndb/test/ndbapi/testRestartGci.cpp1
-rw-r--r--ndb/test/ndbapi/testScan.cpp1
-rw-r--r--ndb/test/ndbapi/testScanInterpreter.cpp1
-rw-r--r--ndb/test/ndbapi/testScanPerf.cpp1
-rw-r--r--ndb/test/ndbapi/testSystemRestart.cpp1
-rw-r--r--ndb/test/ndbapi/testTimeout.cpp1
-rw-r--r--ndb/test/ndbapi/testTransactions.cpp1
-rw-r--r--ndb/test/ndbapi/test_event.cpp1
-rw-r--r--ndb/test/run-test/main.cpp1
-rw-r--r--ndb/test/src/NDBT_Test.cpp2
-rw-r--r--ndb/test/tools/copy_tab.cpp1
-rw-r--r--ndb/test/tools/cpcc.cpp1
-rw-r--r--ndb/test/tools/create_index.cpp1
-rw-r--r--ndb/test/tools/hugoCalculator.cpp1
-rw-r--r--ndb/test/tools/hugoFill.cpp1
-rw-r--r--ndb/test/tools/hugoLoad.cpp1
-rw-r--r--ndb/test/tools/hugoLockRecords.cpp1
-rw-r--r--ndb/test/tools/hugoPkDelete.cpp1
-rw-r--r--ndb/test/tools/hugoPkRead.cpp1
-rw-r--r--ndb/test/tools/hugoPkReadRecord.cpp1
-rw-r--r--ndb/test/tools/hugoPkUpdate.cpp1
-rw-r--r--ndb/test/tools/hugoScanRead.cpp1
-rw-r--r--ndb/test/tools/hugoScanUpdate.cpp1
-rw-r--r--ndb/test/tools/restart.cpp1
-rw-r--r--ndb/test/tools/transproxy.cpp1
-rw-r--r--ndb/test/tools/verify_index.cpp1
-rw-r--r--ndb/tools/delete_all.cpp1
-rw-r--r--ndb/tools/desc.cpp1
-rw-r--r--ndb/tools/drop_index.cpp1
-rw-r--r--ndb/tools/drop_tab.cpp1
-rw-r--r--ndb/tools/listTables.cpp3
-rw-r--r--ndb/tools/ndbsql.cpp1
-rw-r--r--ndb/tools/select_all.cpp3
-rw-r--r--ndb/tools/select_count.cpp1
-rw-r--r--ndb/tools/waiter.cpp1
-rw-r--r--sql/ha_ndbcluster.cc26
117 files changed, 466 insertions, 116 deletions
diff --git a/ndb/examples/ndbapi_async_example/ndbapi_async.cpp b/ndb/examples/ndbapi_async_example/ndbapi_async.cpp
index 7abebcc832d..76ce1a8efe3 100644
--- a/ndb/examples/ndbapi_async_example/ndbapi_async.cpp
+++ b/ndb/examples/ndbapi_async_example/ndbapi_async.cpp
@@ -46,9 +46,9 @@
*
* NdbDictionary::Column
* setName()
- * setPrimaryKey()
* setType()
* setLength()
+ * setPrimaryKey()
* setNullable()
*
* NdbDictionary::Table
@@ -234,9 +234,9 @@ int create_table(Ndb * myNdb)
* Column REG_NO
*/
myColumn.setName("REG_NO");
- myColumn.setPrimaryKey(true);
myColumn.setType(NdbDictionary::Column::Unsigned);
myColumn.setLength(1);
+ myColumn.setPrimaryKey(true);
myColumn.setNullable(false);
myTable.addColumn(myColumn);
@@ -244,9 +244,9 @@ int create_table(Ndb * myNdb)
* Column BRAND
*/
myColumn.setName("BRAND");
- myColumn.setPrimaryKey(false);
myColumn.setType(NdbDictionary::Column::Char);
myColumn.setLength(20);
+ myColumn.setPrimaryKey(false);
myColumn.setNullable(false);
myTable.addColumn(myColumn);
@@ -254,9 +254,9 @@ int create_table(Ndb * myNdb)
* Column COLOR
*/
myColumn.setName("COLOR");
- myColumn.setPrimaryKey(false);
myColumn.setType(NdbDictionary::Column::Char);
myColumn.setLength(20);
+ myColumn.setPrimaryKey(false);
myColumn.setNullable(false);
myTable.addColumn(myColumn);
@@ -454,6 +454,7 @@ int populate(Ndb * myNdb, int data, async_callback_t * cbData)
int main()
{
+ ndb_init();
Ndb* myNdb = new Ndb( "TEST_DB" ); // Object representing the database
/*******************************************
@@ -493,5 +494,3 @@ int main()
std::cout << "Number of temporary errors: " << tempErrors << std::endl;
delete myNdb;
}
-
-
diff --git a/ndb/examples/ndbapi_example1/ndbapi_example1.cpp b/ndb/examples/ndbapi_example1/ndbapi_example1.cpp
index 879d86de824..03a84aa249b 100644
--- a/ndb/examples/ndbapi_example1/ndbapi_example1.cpp
+++ b/ndb/examples/ndbapi_example1/ndbapi_example1.cpp
@@ -44,6 +44,7 @@
int main()
{
+ ndb_init();
Ndb* myNdb = new Ndb( "TEST_DB_1" ); // Object representing the database
NdbDictionary::Table myTable;
NdbDictionary::Column myColumn;
@@ -78,16 +79,16 @@ int main()
myTable.setName("MYTABLENAME");
myColumn.setName("ATTR1");
- myColumn.setPrimaryKey(true);
myColumn.setType(NdbDictionary::Column::Unsigned);
myColumn.setLength(1);
+ myColumn.setPrimaryKey(true);
myColumn.setNullable(false);
myTable.addColumn(myColumn);
myColumn.setName("ATTR2");
- myColumn.setPrimaryKey(false);
myColumn.setType(NdbDictionary::Column::Unsigned);
myColumn.setLength(1);
+ myColumn.setPrimaryKey(false);
myColumn.setNullable(false);
myTable.addColumn(myColumn);
diff --git a/ndb/examples/ndbapi_example2/ndbapi_example2.cpp b/ndb/examples/ndbapi_example2/ndbapi_example2.cpp
index 1c61721c037..95a7bae66b8 100644
--- a/ndb/examples/ndbapi_example2/ndbapi_example2.cpp
+++ b/ndb/examples/ndbapi_example2/ndbapi_example2.cpp
@@ -39,6 +39,7 @@ static void callback(int result, NdbConnection* NdbObject, void* aObject);
int main()
{
+ ndb_init();
Ndb* myNdb = new Ndb( "TEST_DB_2" ); // Object representing the database
NdbConnection* myNdbConnection[2]; // For transactions
diff --git a/ndb/examples/ndbapi_example3/ndbapi_example3.cpp b/ndb/examples/ndbapi_example3/ndbapi_example3.cpp
index 36d2cf1608c..91d9ff122ba 100644
--- a/ndb/examples/ndbapi_example3/ndbapi_example3.cpp
+++ b/ndb/examples/ndbapi_example3/ndbapi_example3.cpp
@@ -176,6 +176,7 @@ int executeInsertTransaction(int transactionId, Ndb* myNdb) {
int main()
{
+ ndb_init();
Ndb* myNdb = new Ndb( "TEST_DB_1" ); // Object representing the database
/*******************************************
diff --git a/ndb/examples/ndbapi_example4/ndbapi_example4.cpp b/ndb/examples/ndbapi_example4/ndbapi_example4.cpp
index 520172b9b0c..fcb770d49e9 100644
--- a/ndb/examples/ndbapi_example4/ndbapi_example4.cpp
+++ b/ndb/examples/ndbapi_example4/ndbapi_example4.cpp
@@ -44,6 +44,7 @@
int main()
{
+ ndb_init();
Ndb* myNdb = new Ndb( "TEST_DB_1" ); // Object representing the database
NdbDictionary::Table myTable;
NdbDictionary::Column myColumn;
@@ -79,16 +80,16 @@ int main()
myTable.setName("MYTABLENAME");
myColumn.setName("ATTR1");
- myColumn.setPrimaryKey(true);
myColumn.setType(NdbDictionary::Column::Unsigned);
myColumn.setLength(1);
+ myColumn.setPrimaryKey(true);
myColumn.setNullable(false);
myTable.addColumn(myColumn);
myColumn.setName("ATTR2");
- myColumn.setPrimaryKey(false);
myColumn.setType(NdbDictionary::Column::Unsigned);
myColumn.setLength(1);
+ myColumn.setPrimaryKey(false);
myColumn.setNullable(false);
myTable.addColumn(myColumn);
diff --git a/ndb/examples/ndbapi_example5/ndbapi_example5.cpp b/ndb/examples/ndbapi_example5/ndbapi_example5.cpp
index a9d3099883c..77f74e7bb63 100644
--- a/ndb/examples/ndbapi_example5/ndbapi_example5.cpp
+++ b/ndb/examples/ndbapi_example5/ndbapi_example5.cpp
@@ -65,6 +65,7 @@ int myCreateEvent(Ndb* myNdb,
int main()
{
+ ndb_init();
Ndb* myNdb = myCreateNdb();
NdbDictionary::Dictionary *myDict;
diff --git a/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp b/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
index 7c3a66326c6..22641bc5b57 100644
--- a/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
+++ b/ndb/examples/ndbapi_scan_example/ndbapi_scan.cpp
@@ -47,9 +47,9 @@
*
* NdbDictionary::Column
* setName()
- * setPrimaryKey()
* setType()
* setLength()
+ * setPrimaryKey()
* setNullable()
*
* NdbDictionary::Table
@@ -165,24 +165,24 @@ int create_table(Ndb * myNdb)
myTable.setName("GARAGE");
myColumn.setName("REG_NO");
- myColumn.setPrimaryKey(true);
myColumn.setType(NdbDictionary::Column::Unsigned);
myColumn.setLength(1);
+ myColumn.setPrimaryKey(true);
myColumn.setNullable(false);
myTable.addColumn(myColumn);
myColumn.setName("BRAND");
- myColumn.setPrimaryKey(false);
myColumn.setType(NdbDictionary::Column::Char);
myColumn.setLength(20);
+ myColumn.setPrimaryKey(false);
myColumn.setNullable(false);
myTable.addColumn(myColumn);
myColumn.setName("COLOR");
- myColumn.setPrimaryKey(false);
myColumn.setType(NdbDictionary::Column::Char);
myColumn.setLength(20);
+ myColumn.setPrimaryKey(false);
myColumn.setNullable(false);
myTable.addColumn(myColumn);
@@ -761,6 +761,7 @@ int scan_print(Ndb * myNdb, int parallelism,
int main()
{
+ ndb_init();
Ndb* myNdb = new Ndb( "TEST_DB" ); // Object representing the database
@@ -813,4 +814,3 @@ int main()
delete myNdb;
}
-
diff --git a/ndb/examples/select_all/select_all.cpp b/ndb/examples/select_all/select_all.cpp
index 3cdbdc47e62..bd25fb60128 100644
--- a/ndb/examples/select_all/select_all.cpp
+++ b/ndb/examples/select_all/select_all.cpp
@@ -112,6 +112,7 @@ const char* ResultSetContainer::getAttrName(int i) const {return m_names[i];}
int main(int argc, const char** argv)
{
+ ndb_init();
Ndb* myNdb = new Ndb("ndbapi_example4"); // Object representing the database
NdbConnection* myNdbConnection; // For transactions
NdbOperation* myNdbOperation; // For operations
diff --git a/ndb/include/kernel/signaldata/DictTabInfo.hpp b/ndb/include/kernel/signaldata/DictTabInfo.hpp
index dec7145c897..a9a50f19fbc 100644
--- a/ndb/include/kernel/signaldata/DictTabInfo.hpp
+++ b/ndb/include/kernel/signaldata/DictTabInfo.hpp
@@ -438,8 +438,8 @@ public:
case DictTabInfo::ExtText:
AttributeType = DictTabInfo::StringType;
AttributeSize = DictTabInfo::an8Bit;
- // head + inline part [ attr precision ]
- AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + AttributeExtPrecision;
+ // head + inline part [ attr precision lower half ]
+ AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + (AttributeExtPrecision & 0xFFFF);
return true;
};
return false;
diff --git a/ndb/include/ndb_global.h b/ndb/include/ndb_global.h
index 0ae781ba5c2..19bd387c457 100644
--- a/ndb/include/ndb_global.h
+++ b/ndb/include/ndb_global.h
@@ -76,6 +76,9 @@ extern "C" {
#include <assert.h>
+/* call in main() - does not return on error */
+extern int ndb_init(void);
+
#ifndef HAVE_STRDUP
extern char * strdup(const char *s);
#endif
diff --git a/ndb/include/ndbapi/NdbDictionary.hpp b/ndb/include/ndbapi/NdbDictionary.hpp
index 5c470c1d25f..51a6895648f 100644
--- a/ndb/include/ndbapi/NdbDictionary.hpp
+++ b/ndb/include/ndbapi/NdbDictionary.hpp
@@ -32,6 +32,8 @@
#include <ndb_types.h>
class Ndb;
+struct charset_info_st;
+typedef struct charset_info_st CHARSET_INFO;
/**
* @class NdbDictionary
@@ -257,6 +259,10 @@ public:
/**
* Set type of column
* @param type Type of column
+ *
+ * @note setType resets <em>all</em> column attributes
+ * to (type dependent) defaults and should be the first
+ * method to call. Default type is Unsigned.
*/
void setType(Type type);
@@ -302,27 +308,35 @@ public:
int getLength() const;
/**
+ * For Char or Varchar or Text, set or get MySQL CHARSET_INFO. This
+ * specifies both character set and collation. See get_charset()
+ * etc in MySQL. (The cs is not "const" in MySQL).
+ */
+ void setCharset(CHARSET_INFO* cs);
+ CHARSET_INFO* getCharset() const;
+
+ /**
* For blob, set or get "inline size" i.e. number of initial bytes
* to store in table's blob attribute. This part is normally in
* main memory and can be indexed and interpreted.
*/
- void setInlineSize(int size) { setPrecision(size); }
- int getInlineSize() const { return getPrecision(); }
+ void setInlineSize(int size);
+ int getInlineSize() const;
/**
* For blob, set or get "part size" i.e. number of bytes to store in
* each tuple of the "blob table". Can be set to zero to omit parts
* and to allow only inline bytes ("tinyblob").
*/
- void setPartSize(int size) { setScale(size); }
- int getPartSize() const { return getScale(); }
+ void setPartSize(int size);
+ int getPartSize() const;
/**
* For blob, set or get "stripe size" i.e. number of consecutive
* <em>parts</em> to store in each node group.
*/
- void setStripeSize(int size) { setLength(size); }
- int getStripeSize() const { return getLength(); }
+ void setStripeSize(int size);
+ int getStripeSize() const;
/**
* Get size of element
diff --git a/ndb/include/util/NdbSqlUtil.hpp b/ndb/include/util/NdbSqlUtil.hpp
index 1d3e96d5c7e..df1cb716f93 100644
--- a/ndb/include/util/NdbSqlUtil.hpp
+++ b/ndb/include/util/NdbSqlUtil.hpp
@@ -90,6 +90,13 @@ public:
*/
static const Type& getType(Uint32 typeId);
+ /**
+ * Check character set.
+ */
+ static bool usable_in_pk(Uint32 typeId, const void* cs);
+ static bool usable_in_hash_index(Uint32 typeId, const void* cs);
+ static bool usable_in_ordered_index(Uint32 typeId, const void* cs);
+
private:
/**
* List of all types. Must match Type::Enum.
diff --git a/ndb/src/common/util/Makefile.am b/ndb/src/common/util/Makefile.am
index 678added01e..efb249dd330 100644
--- a/ndb/src/common/util/Makefile.am
+++ b/ndb/src/common/util/Makefile.am
@@ -9,7 +9,7 @@ libgeneral_la_SOURCES = \
NdbSqlUtil.cpp new.cpp \
uucode.c random.c getarg.c version.c \
strdup.c strlcat.c strlcpy.c \
- ConfigValues.cpp
+ ConfigValues.cpp ndb_init.c
include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_util.mk.am
diff --git a/ndb/src/common/util/NdbSqlUtil.cpp b/ndb/src/common/util/NdbSqlUtil.cpp
index 84a6f6e6c21..afb9bcfff62 100644
--- a/ndb/src/common/util/NdbSqlUtil.cpp
+++ b/ndb/src/common/util/NdbSqlUtil.cpp
@@ -529,6 +529,83 @@ NdbSqlUtil::cmpText(const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size
return CmpUnknown;
}
+// check charset
+
+bool
+NdbSqlUtil::usable_in_pk(Uint32 typeId, const void* info)
+{
+ const Type& type = getType(typeId);
+ switch (type.m_typeId) {
+ case Type::Undefined:
+ break;
+ case Type::Char:
+ {
+ const CHARSET_INFO *cs = (const CHARSET_INFO*)info;
+ return
+ cs != 0 &&
+ cs->cset != 0 &&
+ cs->coll != 0 &&
+ cs->coll->strnxfrm != 0 &&
+ cs->strxfrm_multiply == 1; // current limitation
+ }
+ break;
+ case Type::Varchar:
+ return true; // Varchar not used via MySQL
+ case Type::Blob:
+ case Type::Text:
+ break;
+ default:
+ return true;
+ }
+ return false;
+}
+
+bool
+NdbSqlUtil::usable_in_hash_index(Uint32 typeId, const void* info)
+{
+ return usable_in_pk(typeId, info);
+}
+
+bool
+NdbSqlUtil::usable_in_ordered_index(Uint32 typeId, const void* info)
+{
+ const Type& type = getType(typeId);
+ switch (type.m_typeId) {
+ case Type::Undefined:
+ break;
+ case Type::Char:
+ {
+ const CHARSET_INFO *cs = (const CHARSET_INFO*)info;
+ return
+ cs != 0 &&
+ cs->cset != 0 &&
+ cs->coll != 0 &&
+ cs->coll->strnxfrm != 0 &&
+ cs->coll->strnncollsp != 0 &&
+ cs->strxfrm_multiply == 1; // current limitation
+ }
+ break;
+ case Type::Varchar:
+ return true; // Varchar not used via MySQL
+ case Type::Text:
+ {
+ const CHARSET_INFO *cs = (const CHARSET_INFO*)info;
+ return
+ cs != 0 &&
+ cs->mbmaxlen == 1 && // extra limitation
+ cs->cset != 0 &&
+ cs->coll != 0 &&
+ cs->coll->strnxfrm != 0 &&
+ cs->coll->strnncollsp != 0 &&
+ cs->strxfrm_multiply == 1; // current limitation
+ }
+ break;
+ default:
+ return true;
+ }
+ return false;
+}
+
#ifdef NDB_SQL_UTIL_TEST
#include <NdbTick.h>
diff --git a/ndb/src/common/util/ndb_init.c b/ndb/src/common/util/ndb_init.c
new file mode 100644
index 00000000000..b160ed3636b
--- /dev/null
+++ b/ndb/src/common/util/ndb_init.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include <ndb_global.h>
+#include <my_sys.h>
+
+int
+ndb_init()
+{
+ if (my_init()) {
+ const char* err = "my_init() failed - exit\n";
+ write(2, err, strlen(err));
+ exit(1);
+ }
+ return 0;
+}
diff --git a/ndb/src/kernel/blocks/backup/read.cpp b/ndb/src/kernel/blocks/backup/read.cpp
index 921c352ea13..89cc08ee9de 100644
--- a/ndb/src/kernel/blocks/backup/read.cpp
+++ b/ndb/src/kernel/blocks/backup/read.cpp
@@ -48,6 +48,7 @@ static Uint32 logEntryNo;
int
main(int argc, const char * argv[]){
+ ndb_init();
if(argc <= 1){
printf("Usage: %s <filename>", argv[0]);
exit(1);
diff --git a/ndb/src/kernel/blocks/backup/restore/main.cpp b/ndb/src/kernel/blocks/backup/restore/main.cpp
index db0b0405b4c..5708415c61e 100644
--- a/ndb/src/kernel/blocks/backup/restore/main.cpp
+++ b/ndb/src/kernel/blocks/backup/restore/main.cpp
@@ -206,6 +206,7 @@ free_data_callback()
int
main(int argc, const char** argv)
{
+ ndb_init();
if (!readArguments(argc, argv))
{
return -1;
diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
index 7126842459e..d82083684b7 100644
--- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
+++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
@@ -6317,6 +6317,8 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr)
w.add(DictTabInfo::AttributeStoredInd, (Uint32)DictTabInfo::Stored);
// ext type overrides
w.add(DictTabInfo::AttributeExtType, aRec->extType);
+ w.add(DictTabInfo::AttributeExtPrecision, aRec->extPrecision);
+ w.add(DictTabInfo::AttributeExtScale, aRec->extScale);
w.add(DictTabInfo::AttributeExtLength, aRec->extLength);
w.add(DictTabInfo::AttributeEnd, (Uint32)true);
}
diff --git a/ndb/src/kernel/main.cpp b/ndb/src/kernel/main.cpp
index 491733975a8..20844db75b6 100644
--- a/ndb/src/kernel/main.cpp
+++ b/ndb/src/kernel/main.cpp
@@ -56,6 +56,7 @@ const char programName[] = "NDB Kernel";
NDB_MAIN(ndb_kernel){
+ ndb_init();
// Print to stdout/console
g_eventLogger.createConsoleHandler();
g_eventLogger.setCategory("NDB");
diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp
index 8907cb9f640..c0015172512 100644
--- a/ndb/src/kernel/vm/Configuration.cpp
+++ b/ndb/src/kernel/vm/Configuration.cpp
@@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
-#include <my_sys.h>
#include "Configuration.hpp"
#include <ErrorHandlingMacros.hpp>
@@ -105,7 +104,6 @@ Configuration::init(int argc, const char** argv){
}
// check for depricated flag '-i'
- my_init();
#ifndef DBUG_OFF
if (debug_option)
DBUG_PUSH(debug_option);
diff --git a/ndb/src/mgmclient/main.cpp b/ndb/src/mgmclient/main.cpp
index df6659df0b1..69f968677cd 100644
--- a/ndb/src/mgmclient/main.cpp
+++ b/ndb/src/mgmclient/main.cpp
@@ -44,6 +44,7 @@ handler(int sig){
}
int main(int argc, const char** argv){
+ ndb_init();
int optind = 0;
const char *_host = 0;
int _port = 0;
diff --git a/ndb/src/mgmsrv/main.cpp b/ndb/src/mgmsrv/main.cpp
index cecf1c1e499..40385219faf 100644
--- a/ndb/src/mgmsrv/main.cpp
+++ b/ndb/src/mgmsrv/main.cpp
@@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
-#include <my_sys.h>
#include "MgmtSrvr.hpp"
#include "EventLogger.hpp"
@@ -129,6 +128,7 @@ int num_args = sizeof(args) / sizeof(args[0]);
* MAIN
*/
NDB_MAIN(mgmsrv){
+ ndb_init();
/**
* OSE specific. Enable shared ownership of file system resources.
* This is needed in order to use the cluster log since the events
@@ -151,7 +151,6 @@ NDB_MAIN(mgmsrv){
glob.daemon= 0;
}
- my_init();
#ifndef DBUG_OFF
if (debug_option)
DBUG_PUSH(debug_option);
diff --git a/ndb/src/mgmsrv/mkconfig/mkconfig.cpp b/ndb/src/mgmsrv/mkconfig/mkconfig.cpp
index 3b2046d7b49..28823aaa35e 100644
--- a/ndb/src/mgmsrv/mkconfig/mkconfig.cpp
+++ b/ndb/src/mgmsrv/mkconfig/mkconfig.cpp
@@ -32,6 +32,7 @@ void usage(const char * prg){
NDB_COMMAND(mkconfig,
"mkconfig", "mkconfig",
"Make a binary configuration from a config file", 16384){
+ ndb_init();
if(argc < 3){
usage(argv[0]);
return 0;
diff --git a/ndb/src/ndbapi/NdbDictionary.cpp b/ndb/src/ndbapi/NdbDictionary.cpp
index 8000b53d3be..6396cb6bb1d 100644
--- a/ndb/src/ndbapi/NdbDictionary.cpp
+++ b/ndb/src/ndbapi/NdbDictionary.cpp
@@ -65,7 +65,7 @@ NdbDictionary::Column::getName() const {
void
NdbDictionary::Column::setType(Type t){
- m_impl.m_type = t;
+ m_impl.init(t);
}
NdbDictionary::Column::Type
@@ -103,6 +103,54 @@ NdbDictionary::Column::getLength() const{
return m_impl.m_length;
}
+void
+NdbDictionary::Column::setInlineSize(int size)
+{
+ m_impl.m_precision = size;
+}
+
+void
+NdbDictionary::Column::setCharset(CHARSET_INFO* cs)
+{
+ m_impl.m_cs = cs;
+}
+
+CHARSET_INFO*
+NdbDictionary::Column::getCharset() const
+{
+ return m_impl.m_cs;
+}
+
+int
+NdbDictionary::Column::getInlineSize() const
+{
+ return m_impl.m_precision;
+}
+
+void
+NdbDictionary::Column::setPartSize(int size)
+{
+ m_impl.m_scale = size;
+}
+
+int
+NdbDictionary::Column::getPartSize() const
+{
+ return m_impl.m_scale;
+}
+
+void
+NdbDictionary::Column::setStripeSize(int size)
+{
+ m_impl.m_length = size;
+}
+
+int
+NdbDictionary::Column::getStripeSize() const
+{
+ return m_impl.m_length;
+}
+
int
NdbDictionary::Column::getSize() const{
return m_impl.m_attrSize;
@@ -820,6 +868,8 @@ NdbDictionary::Dictionary::getNdbError() const {
NdbOut&
operator<<(NdbOut& out, const NdbDictionary::Column& col)
{
+ const CHARSET_INFO *cs = col.getCharset();
+ const char *csname = cs ? cs->name : "?";
out << col.getName() << " ";
switch (col.getType()) {
case NdbDictionary::Column::Tinyint:
@@ -862,10 +912,10 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col)
out << "Decimal(" << col.getScale() << "," << col.getPrecision() << ")";
break;
case NdbDictionary::Column::Char:
- out << "Char(" << col.getLength() << ")";
+ out << "Char(" << col.getLength() << ";" << csname << ")";
break;
case NdbDictionary::Column::Varchar:
- out << "Varchar(" << col.getLength() << ")";
+ out << "Varchar(" << col.getLength() << ";" << csname << ")";
break;
case NdbDictionary::Column::Binary:
out << "Binary(" << col.getLength() << ")";
@@ -885,7 +935,7 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col)
break;
case NdbDictionary::Column::Text:
out << "Text(" << col.getInlineSize() << "," << col.getPartSize()
- << ";" << col.getStripeSize() << ")";
+ << ";" << col.getStripeSize() << ";" << csname << ")";
break;
case NdbDictionary::Column::Undefined:
out << "Undefined";
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
index 78a363c1a5f..c2c987f3bdb 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
@@ -36,6 +36,7 @@
#include "NdbEventOperationImpl.hpp"
#include "NdbBlob.hpp"
#include <AttributeHeader.hpp>
+#include <my_sys.h>
#define DEBUG_PRINT 0
#define INCOMPATIBLE_VERSION -2
@@ -64,6 +65,7 @@ NdbColumnImpl::operator=(const NdbColumnImpl& col)
m_name = col.m_name;
m_type = col.m_type;
m_precision = col.m_precision;
+ m_cs = col.m_cs;
m_scale = col.m_scale;
m_length = col.m_length;
m_pk = col.m_pk;
@@ -87,10 +89,66 @@ NdbColumnImpl::operator=(const NdbColumnImpl& col)
}
void
-NdbColumnImpl::init()
+NdbColumnImpl::init(Type t)
{
+ // do not use default_charset_info as it may not be initialized yet
+ // use binary collation until NDB tests can handle charsets
+ CHARSET_INFO* default_cs = &my_charset_latin1_bin;
m_attrId = -1;
- m_type = NdbDictionary::Column::Unsigned;
+ m_type = t;
+ switch (m_type) {
+ case Tinyint:
+ case Tinyunsigned:
+ case Smallint:
+ case Smallunsigned:
+ case Mediumint:
+ case Mediumunsigned:
+ case Int:
+ case Unsigned:
+ case Bigint:
+ case Bigunsigned:
+ case Float:
+ case Double:
+ m_precision = 0;
+ m_scale = 0;
+ m_length = 1;
+ m_cs = NULL;
+ break;
+ case Decimal:
+ m_precision = 10;
+ m_scale = 0;
+ m_length = 1;
+ m_cs = NULL;
+ break;
+ case Char:
+ case Varchar:
+ m_precision = 0;
+ m_scale = 0;
+ m_length = 1;
+ m_cs = default_cs;
+ break;
+ case Binary:
+ case Varbinary:
+ case Datetime:
+ case Timespec:
+ m_precision = 0;
+ m_scale = 0;
+ m_length = 1;
+ m_cs = NULL;
+ break;
+ case Blob:
+ m_precision = 256;
+ m_scale = 8000;
+ m_length = 4;
+ m_cs = NULL;
+ break;
+ case Text:
+ m_precision = 256;
+ m_scale = 8000;
+ m_length = 4;
+ m_cs = default_cs;
+ break;
+ }
m_pk = false;
m_nullable = false;
m_tupleKey = false;
@@ -98,12 +156,10 @@ NdbColumnImpl::init()
m_distributionKey = false;
m_distributionGroup = false;
m_distributionGroupBits = 8;
- m_length = 1;
- m_scale = 5;
- m_precision = 5;
m_keyInfoPos = 0;
- m_attrSize = 4,
- m_arraySize = 1,
+ // next 2 are set at run time
+ m_attrSize = 0;
+ m_arraySize = 0;
m_autoIncrement = false;
m_autoIncrementInitialValue = 1;
m_blobTable = NULL;
@@ -146,52 +202,12 @@ NdbColumnImpl::equal(const NdbColumnImpl& col) const
return false;
}
}
- if(m_length != col.m_length){
+ if (m_precision != col.m_precision ||
+ m_scale != col.m_scale ||
+ m_length != col.m_length ||
+ m_cs != col.m_cs) {
return false;
}
-
- switch(m_type){
- case NdbDictionary::Column::Undefined:
- break;
- case NdbDictionary::Column::Tinyint:
- case NdbDictionary::Column::Tinyunsigned:
- case NdbDictionary::Column::Smallint:
- case NdbDictionary::Column::Smallunsigned:
- case NdbDictionary::Column::Mediumint:
- case NdbDictionary::Column::Mediumunsigned:
- case NdbDictionary::Column::Int:
- case NdbDictionary::Column::Unsigned:
- case NdbDictionary::Column::Float:
- break;
- case NdbDictionary::Column::Decimal:
- if(m_scale != col.m_scale ||
- m_precision != col.m_precision){
- return false;
- }
- break;
- case NdbDictionary::Column::Char:
- case NdbDictionary::Column::Varchar:
- case NdbDictionary::Column::Binary:
- case NdbDictionary::Column::Varbinary:
- if(m_length != col.m_length){
- return false;
- }
- break;
- case NdbDictionary::Column::Bigint:
- case NdbDictionary::Column::Bigunsigned:
- case NdbDictionary::Column::Double:
- case NdbDictionary::Column::Datetime:
- case NdbDictionary::Column::Timespec:
- break;
- case NdbDictionary::Column::Blob:
- case NdbDictionary::Column::Text:
- if (m_precision != col.m_precision ||
- m_scale != col.m_scale ||
- m_length != col.m_length) {
- return false;
- }
- break;
- }
if (m_autoIncrement != col.m_autoIncrement){
return false;
}
@@ -209,14 +225,18 @@ NdbColumnImpl::create_psuedo(const char * name){
if(!strcmp(name, "NDB$FRAGMENT")){
col->setType(NdbDictionary::Column::Unsigned);
col->m_impl.m_attrId = AttributeHeader::FRAGMENT;
+ col->m_impl.m_attrSize = 4;
+ col->m_impl.m_arraySize = 1;
} else if(!strcmp(name, "NDB$ROW_COUNT")){
col->setType(NdbDictionary::Column::Bigunsigned);
col->m_impl.m_attrId = AttributeHeader::ROW_COUNT;
col->m_impl.m_attrSize = 8;
+ col->m_impl.m_arraySize = 1;
} else if(!strcmp(name, "NDB$COMMIT_COUNT")){
col->setType(NdbDictionary::Column::Bigunsigned);
col->m_impl.m_attrId = AttributeHeader::COMMIT_COUNT;
col->m_impl.m_attrSize = 8;
+ col->m_impl.m_arraySize = 1;
} else {
abort();
}
@@ -1127,6 +1147,7 @@ indexTypeMapping[] = {
{ -1, -1 }
};
+// TODO: remove, api-kernel type codes must match now
static const
ApiKernelMapping
columnTypeMapping[] = {
@@ -1233,9 +1254,23 @@ NdbDictInterface::parseTableInfo(NdbTableImpl ** ret,
return 703;
}
col->m_extType = attrDesc.AttributeExtType;
- col->m_precision = attrDesc.AttributeExtPrecision;
+ col->m_precision = (attrDesc.AttributeExtPrecision & 0xFFFF);
col->m_scale = attrDesc.AttributeExtScale;
col->m_length = attrDesc.AttributeExtLength;
+ // charset in upper half of precision
+ unsigned cs_number = (attrDesc.AttributeExtPrecision >> 16);
+ // charset is defined exactly for char types
+ if (col->getCharType() != (cs_number != 0)) {
+ delete impl;
+ return 703;
+ }
+ if (col->getCharType()) {
+ col->m_cs = get_charset(cs_number, MYF(0));
+ if (col->m_cs == NULL) {
+ delete impl;
+ return 743;
+ }
+ }
// translate to old kernel types and sizes
if (! attrDesc.translateExtType()) {
@@ -1486,9 +1521,23 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
getKernelConstant(col->m_type,
columnTypeMapping,
DictTabInfo::ExtUndefined);
- tmpAttr.AttributeExtPrecision = col->m_precision;
+ tmpAttr.AttributeExtPrecision = ((unsigned)col->m_precision & 0xFFFF);
tmpAttr.AttributeExtScale = col->m_scale;
tmpAttr.AttributeExtLength = col->m_length;
+ // charset is defined exactly for char types
+ if (col->getCharType() != (col->m_cs != NULL)) {
+ m_error.code = 703;
+ return -1;
+ }
+ // primary key type check
+ if (col->m_pk && ! NdbSqlUtil::usable_in_pk(col->m_type, col->m_cs)) {
+ m_error.code = 743;
+ return -1;
+ }
+ // charset in upper half of precision
+ if (col->getCharType()) {
+ tmpAttr.AttributeExtPrecision |= (col->m_cs->number << 16);
+ }
// DICT will ignore and recompute this
(void)tmpAttr.translateExtType();
@@ -1950,6 +1999,14 @@ NdbDictInterface::createIndex(Ndb & ndb,
m_error.code = 4245;
return -1;
}
+ // index key type check
+ if (it == DictTabInfo::UniqueHashIndex &&
+ ! NdbSqlUtil::usable_in_hash_index(col->m_type, col->m_cs) ||
+ it == DictTabInfo::OrderedIndex &&
+ ! NdbSqlUtil::usable_in_ordered_index(col->m_type, col->m_cs)) {
+ m_error.code = 743;
+ return -1;
+ }
attributeList.id[i] = col->m_attrId;
}
if (it == DictTabInfo::UniqueHashIndex) {
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.hpp b/ndb/src/ndbapi/NdbDictionaryImpl.hpp
index da5e7e45c36..cf659c71397 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.hpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.hpp
@@ -52,7 +52,7 @@ public:
NdbColumnImpl(NdbDictionary::Column &); // This is not a copy constructor
~NdbColumnImpl();
NdbColumnImpl& operator=(const NdbColumnImpl&);
- void init();
+ void init(Type t = Unsigned);
int m_attrId;
BaseString m_name;
@@ -60,6 +60,7 @@ public:
int m_precision;
int m_scale;
int m_length;
+ CHARSET_INFO * m_cs; // not const in MySQL
bool m_pk;
bool m_tupleKey;
@@ -82,6 +83,7 @@ public:
Uint32 m_keyInfoPos;
Uint32 m_extType; // used by restore (kernel type in versin v2x)
bool getInterpretableType() const ;
+ bool getCharType() const;
bool getBlobType() const;
/**
@@ -448,6 +450,14 @@ NdbColumnImpl::getInterpretableType() const {
inline
bool
+NdbColumnImpl::getCharType() const {
+ return (m_type == NdbDictionary::Column::Char ||
+ m_type == NdbDictionary::Column::Varchar ||
+ m_type == NdbDictionary::Column::Text);
+}
+
+inline
+bool
NdbColumnImpl::getBlobType() const {
return (m_type == NdbDictionary::Column::Blob ||
m_type == NdbDictionary::Column::Text);
diff --git a/ndb/src/ndbapi/Ndbinit.cpp b/ndb/src/ndbapi/Ndbinit.cpp
index 8e3bf69c7f5..9495c05cef2 100644
--- a/ndb/src/ndbapi/Ndbinit.cpp
+++ b/ndb/src/ndbapi/Ndbinit.cpp
@@ -16,7 +16,6 @@
#include <ndb_global.h>
-#include <my_sys.h>
#include "NdbApiSignal.hpp"
#include "NdbImpl.hpp"
@@ -62,7 +61,6 @@ Ndb::Ndb( const char* aDataBase , const char* aSchema) {
abort(); // old and new Ndb constructor used mixed
theNoOfNdbObjects++;
if (global_ndb_cluster_connection == 0) {
- my_init();
global_ndb_cluster_connection= new Ndb_cluster_connection(ndbConnectString);
global_ndb_cluster_connection->connect();
}
diff --git a/ndb/src/ndbapi/ndberror.c b/ndb/src/ndbapi/ndberror.c
index 7991004e3d0..2ebcf4be444 100644
--- a/ndb/src/ndbapi/ndberror.c
+++ b/ndb/src/ndbapi/ndberror.c
@@ -280,6 +280,9 @@ ErrorBundle ErrorCodes[] = {
{ 739, SE, "Unsupported primary key length" },
{ 740, SE, "Nullable primary key not supported" },
{ 741, SE, "Unsupported alter table" },
+ { 742, SE, "Unsupported attribute type in index" },
+ { 743, SE, "Unsupported character set in table or index" },
+ { 744, SE, "Character conversion error" },
{ 241, SE, "Invalid schema object version" },
{ 283, SE, "Table is being dropped" },
{ 284, SE, "Table not defined in transaction coordinator" },
diff --git a/ndb/test/include/NDBT_Table.hpp b/ndb/test/include/NDBT_Table.hpp
index 59db3ed1092..d2f99b85187 100644
--- a/ndb/test/include/NDBT_Table.hpp
+++ b/ndb/test/include/NDBT_Table.hpp
@@ -33,10 +33,10 @@ public:
{
assert(_name != 0);
+ setType(_type);
+ setLength(_length);
setNullable(_nullable);
setPrimaryKey(_pk);
- setLength(_length);
- setType(_type);
}
};
diff --git a/ndb/test/ndbapi/acid.cpp b/ndb/test/ndbapi/acid.cpp
index 157b3c7b3ef..3eb1625be26 100644
--- a/ndb/test/ndbapi/acid.cpp
+++ b/ndb/test/ndbapi/acid.cpp
@@ -434,6 +434,7 @@ extern "C" void* NdbThreadFuncRead(void* pArg)
NDB_COMMAND(acid, "acid", "acid", "acid", 65535)
{
+ ndb_init();
long nSeconds = 60;
int rc = NDBT_OK;
diff --git a/ndb/test/ndbapi/acid2.cpp b/ndb/test/ndbapi/acid2.cpp
index 434a0450daa..7bd7ec00ac5 100644
--- a/ndb/test/ndbapi/acid2.cpp
+++ b/ndb/test/ndbapi/acid2.cpp
@@ -610,6 +610,7 @@ extern "C" void* ThreadFunc(void*)
int main(int argc, char* argv[])
{
+ ndb_init();
Uint32 nSeconds = 1;
Uint32 nThread = 1;
diff --git a/ndb/test/ndbapi/bank/bankCreator.cpp b/ndb/test/ndbapi/bank/bankCreator.cpp
index 5331ec6ba69..301d8bda6d2 100644
--- a/ndb/test/ndbapi/bank/bankCreator.cpp
+++ b/ndb/test/ndbapi/bank/bankCreator.cpp
@@ -27,6 +27,7 @@
int main(int argc, const char** argv){
+ ndb_init();
int _help = 0;
struct getargs args[] = {
diff --git a/ndb/test/ndbapi/bank/bankMakeGL.cpp b/ndb/test/ndbapi/bank/bankMakeGL.cpp
index 54bc559fbf9..9e2762ed8ae 100644
--- a/ndb/test/ndbapi/bank/bankMakeGL.cpp
+++ b/ndb/test/ndbapi/bank/bankMakeGL.cpp
@@ -27,6 +27,7 @@
int main(int argc, const char** argv){
+ ndb_init();
int _help = 0;
struct getargs args[] = {
diff --git a/ndb/test/ndbapi/bank/bankSumAccounts.cpp b/ndb/test/ndbapi/bank/bankSumAccounts.cpp
index c0a903f9034..b576161b27b 100644
--- a/ndb/test/ndbapi/bank/bankSumAccounts.cpp
+++ b/ndb/test/ndbapi/bank/bankSumAccounts.cpp
@@ -27,6 +27,7 @@
int main(int argc, const char** argv){
+ ndb_init();
int _help = 0;
struct getargs args[] = {
diff --git a/ndb/test/ndbapi/bank/bankTimer.cpp b/ndb/test/ndbapi/bank/bankTimer.cpp
index ba3165fccb4..874afd9c21e 100644
--- a/ndb/test/ndbapi/bank/bankTimer.cpp
+++ b/ndb/test/ndbapi/bank/bankTimer.cpp
@@ -28,6 +28,7 @@
int main(int argc, const char** argv){
+ ndb_init();
int _help = 0;
int _wait = 30;
diff --git a/ndb/test/ndbapi/bank/bankTransactionMaker.cpp b/ndb/test/ndbapi/bank/bankTransactionMaker.cpp
index fe9b53e0c8d..e5ff9aeb918 100644
--- a/ndb/test/ndbapi/bank/bankTransactionMaker.cpp
+++ b/ndb/test/ndbapi/bank/bankTransactionMaker.cpp
@@ -28,6 +28,7 @@
int main(int argc, const char** argv){
+ ndb_init();
int _help = 0;
int _wait = 20;
diff --git a/ndb/test/ndbapi/bank/bankValidateAllGLs.cpp b/ndb/test/ndbapi/bank/bankValidateAllGLs.cpp
index f9d974bb5f7..cf298ecc8e3 100644
--- a/ndb/test/ndbapi/bank/bankValidateAllGLs.cpp
+++ b/ndb/test/ndbapi/bank/bankValidateAllGLs.cpp
@@ -28,6 +28,7 @@
int main(int argc, const char** argv){
+ ndb_init();
int _help = 0;
struct getargs args[] = {
diff --git a/ndb/test/ndbapi/bank/testBank.cpp b/ndb/test/ndbapi/bank/testBank.cpp
index 77ac1172d7c..3ef2799cd3c 100644
--- a/ndb/test/ndbapi/bank/testBank.cpp
+++ b/ndb/test/ndbapi/bank/testBank.cpp
@@ -141,6 +141,7 @@ TESTCASE("Bank",
NDBT_TESTSUITE_END(testBank);
int main(int argc, const char** argv){
+ ndb_init();
// Tables should not be auto created
testBank.setCreateTable(false);
diff --git a/ndb/test/ndbapi/benchronja.cpp b/ndb/test/ndbapi/benchronja.cpp
index ce0aee35e8f..91b2a041186 100644
--- a/ndb/test/ndbapi/benchronja.cpp
+++ b/ndb/test/ndbapi/benchronja.cpp
@@ -66,6 +66,7 @@ static int ThreadReady[MAXTHREADS];
static int ThreadStart[MAXTHREADS];
NDB_COMMAND(benchronja, "benchronja", "benchronja", "benchronja", 65535){
+ ndb_init();
ThreadNdb tabThread[MAXTHREADS];
int i = 0 ;
diff --git a/ndb/test/ndbapi/bulk_copy.cpp b/ndb/test/ndbapi/bulk_copy.cpp
index 18881cae216..8821a92fb27 100644
--- a/ndb/test/ndbapi/bulk_copy.cpp
+++ b/ndb/test/ndbapi/bulk_copy.cpp
@@ -221,6 +221,7 @@ int insertFile(Ndb* pNdb,
int main(int argc, const char** argv){
+ ndb_init();
const char* _tabname = NULL;
int _help = 0;
diff --git a/ndb/test/ndbapi/cdrserver.cpp b/ndb/test/ndbapi/cdrserver.cpp
index 8354d28f53f..8d15061e94b 100644
--- a/ndb/test/ndbapi/cdrserver.cpp
+++ b/ndb/test/ndbapi/cdrserver.cpp
@@ -113,6 +113,7 @@ using namespace std;
int main(int argc, const char** argv)
{
+ ndb_init();
/******** NDB ***********/
/*
Ndb MyNdb( "TEST_DB" );
diff --git a/ndb/test/ndbapi/celloDb.cpp b/ndb/test/ndbapi/celloDb.cpp
index ec61e783585..2d6401c355a 100644
--- a/ndb/test/ndbapi/celloDb.cpp
+++ b/ndb/test/ndbapi/celloDb.cpp
@@ -73,6 +73,7 @@ static int failed = 0 ;
NDB_COMMAND(celloDb, "celloDb", "celloDb", "celloDb", 65535)
{
+ ndb_init();
int tTableId;
int i;
diff --git a/ndb/test/ndbapi/create_all_tabs.cpp b/ndb/test/ndbapi/create_all_tabs.cpp
index 55d04888144..97236b98b36 100644
--- a/ndb/test/ndbapi/create_all_tabs.cpp
+++ b/ndb/test/ndbapi/create_all_tabs.cpp
@@ -25,6 +25,7 @@
int main(int argc, const char** argv){
+ ndb_init();
int _temp = false;
int _help = 0;
diff --git a/ndb/test/ndbapi/create_tab.cpp b/ndb/test/ndbapi/create_tab.cpp
index c2e3b7f64ea..f3f18982ed0 100644
--- a/ndb/test/ndbapi/create_tab.cpp
+++ b/ndb/test/ndbapi/create_tab.cpp
@@ -25,6 +25,7 @@
int main(int argc, const char** argv){
+ ndb_init();
int _temp = false;
int _help = 0;
diff --git a/ndb/test/ndbapi/drop_all_tabs.cpp b/ndb/test/ndbapi/drop_all_tabs.cpp
index 59c57396acd..c024a81a5e6 100644
--- a/ndb/test/ndbapi/drop_all_tabs.cpp
+++ b/ndb/test/ndbapi/drop_all_tabs.cpp
@@ -23,6 +23,7 @@
#include <getarg.h>
int main(int argc, const char** argv){
+ ndb_init();
int _help = 0;
struct getargs args[] = {
diff --git a/ndb/test/ndbapi/flexAsynch.cpp b/ndb/test/ndbapi/flexAsynch.cpp
index 9192ec21b93..8c0ba46130c 100644
--- a/ndb/test/ndbapi/flexAsynch.cpp
+++ b/ndb/test/ndbapi/flexAsynch.cpp
@@ -145,6 +145,7 @@ tellThreads(StartType what)
NDB_COMMAND(flexAsynch, "flexAsynch", "flexAsynch", "flexAsynch", 65535)
{
+ ndb_init();
ThreadNdb* pThreadData;
int tLoops=0, i;
int returnValue = NDBT_OK;
diff --git a/ndb/test/ndbapi/flexBench.cpp b/ndb/test/ndbapi/flexBench.cpp
index 38c8f6e280f..b19944498f4 100644
--- a/ndb/test/ndbapi/flexBench.cpp
+++ b/ndb/test/ndbapi/flexBench.cpp
@@ -281,6 +281,7 @@ tellThreads(ThreadData* pt, StartType what)
NDB_COMMAND(flexBench, "flexBench", "flexBench", "flexbench", 65535)
{
+ ndb_init();
ThreadData* pThreadsData;
int tLoops = 0, i;
int returnValue = NDBT_OK;
diff --git a/ndb/test/ndbapi/flexHammer.cpp b/ndb/test/ndbapi/flexHammer.cpp
index c1c47923de9..80cc7c5a53f 100644
--- a/ndb/test/ndbapi/flexHammer.cpp
+++ b/ndb/test/ndbapi/flexHammer.cpp
@@ -178,6 +178,7 @@ tellThreads(ThreadNdb* threadArrayP, const StartType what)
NDB_COMMAND(flexHammer, "flexHammer", "flexHammer", "flexHammer", 65535)
//main(int argc, const char** argv)
{
+ ndb_init();
ThreadNdb* pThreads = NULL; // Pointer to thread data array
Ndb* pMyNdb = NULL; // Pointer to Ndb object
int tLoops = 0;
diff --git a/ndb/test/ndbapi/flexScan.cpp b/ndb/test/ndbapi/flexScan.cpp
index 5b5b4dde730..b09d71fb010 100644
--- a/ndb/test/ndbapi/flexScan.cpp
+++ b/ndb/test/ndbapi/flexScan.cpp
@@ -297,6 +297,7 @@ static int checkThreadResults(ThreadNdb *threadArrayP, char *action)
NDB_COMMAND(flexScan, "flexScan", "flexScan", "flexScan", 65535)
{
+ ndb_init();
ThreadNdb* pThreads = NULL;
Ndb* pMyNdb = NULL;
int tLoops = 0;
diff --git a/ndb/test/ndbapi/flexTT.cpp b/ndb/test/ndbapi/flexTT.cpp
index c0ff31d1677..162fc080218 100644
--- a/ndb/test/ndbapi/flexTT.cpp
+++ b/ndb/test/ndbapi/flexTT.cpp
@@ -171,6 +171,7 @@ tellThreads(StartType what)
NDB_COMMAND(flexTT, "flexTT", "flexTT", "flexTT", 65535)
{
+ ndb_init();
ThreadNdb* pThreadData;
int returnValue = NDBT_OK;
int i;
diff --git a/ndb/test/ndbapi/flexTimedAsynch.cpp b/ndb/test/ndbapi/flexTimedAsynch.cpp
index 761be53fdd3..27380cc79fd 100644
--- a/ndb/test/ndbapi/flexTimedAsynch.cpp
+++ b/ndb/test/ndbapi/flexTimedAsynch.cpp
@@ -174,6 +174,7 @@ void deleteAttributeSpace(){
NDB_COMMAND(flexTimedAsynch, "flexTimedAsynch", "flexTimedAsynch [-tpoilcas]", "flexTimedAsynch", 65535)
{
+ ndb_init();
ThreadNdb tabThread[MAXTHREADS];
int tLoops=0;
int returnValue;
diff --git a/ndb/test/ndbapi/flex_bench_mysql.cpp b/ndb/test/ndbapi/flex_bench_mysql.cpp
index 7cc883ab3e6..8e1fbcd9058 100644
--- a/ndb/test/ndbapi/flex_bench_mysql.cpp
+++ b/ndb/test/ndbapi/flex_bench_mysql.cpp
@@ -308,6 +308,7 @@ tellThreads(ThreadData* pt, StartType what)
NDB_COMMAND(flexBench, "flexBench", "flexBench", "flexbench", 65535)
{
+ ndb_init();
ThreadData* pThreadsData;
int tLoops = 0;
int returnValue = NDBT_OK;
diff --git a/ndb/test/ndbapi/index.cpp b/ndb/test/ndbapi/index.cpp
index 508186de529..c22da594164 100644
--- a/ndb/test/ndbapi/index.cpp
+++ b/ndb/test/ndbapi/index.cpp
@@ -81,63 +81,63 @@ static void createTable(Ndb &myNdb, bool storeInACC, bool twoKey, bool longKey)
int res;
column.setName("NAME");
- column.setPrimaryKey(true);
column.setType(NdbDictionary::Column::Char);
column.setLength((longKey)?
1024 // 1KB => long key
:12);
+ column.setPrimaryKey(true);
column.setNullable(false);
table.addColumn(column);
if (twoKey) {
column.setName("KEY2");
- column.setPrimaryKey(true);
column.setType(NdbDictionary::Column::Unsigned);
column.setLength(1);
+ column.setPrimaryKey(true);
column.setNullable(false);
table.addColumn(column);
}
column.setName("PNUM1");
- column.setPrimaryKey(false);
column.setType(NdbDictionary::Column::Unsigned);
column.setLength(1);
+ column.setPrimaryKey(false);
column.setNullable(false);
table.addColumn(column);
column.setName("PNUM2");
- column.setPrimaryKey(false);
column.setType(NdbDictionary::Column::Unsigned);
column.setLength(1);
+ column.setPrimaryKey(false);
column.setNullable(false);
table.addColumn(column);
column.setName("PNUM3");
- column.setPrimaryKey(false);
column.setType(NdbDictionary::Column::Unsigned);
column.setLength(1);
+ column.setPrimaryKey(false);
column.setNullable(false);
table.addColumn(column);
column.setName("PNUM4");
- column.setPrimaryKey(false);
column.setType(NdbDictionary::Column::Unsigned);
column.setLength(1);
+ column.setPrimaryKey(false);
column.setNullable(false);
table.addColumn(column);
column.setName("AGE");
- column.setPrimaryKey(false);
column.setType(NdbDictionary::Column::Unsigned);
column.setLength(1);
+ column.setPrimaryKey(false);
column.setNullable(false);
table.addColumn(column);
column.setName("STRING_AGE");
- column.setPrimaryKey(false);
column.setType(NdbDictionary::Column::Char);
column.setLength(1);
column.setLength(256);
+ column.setPrimaryKey(false);
column.setNullable(false);
table.addColumn(column);
@@ -771,6 +771,7 @@ static void dropIndex(Ndb &myNdb, unsigned int noOfIndexes)
NDB_COMMAND(indexTest, "indexTest", "indexTest", "indexTest", 65535)
{
+ ndb_init();
bool createTableOp, createIndexOp, dropIndexOp, insertOp, updateOp, deleteOp, readOp, readIndexOp, updateIndexOp, deleteIndexOp, twoKey, longKey;
unsigned int noOfTuples = 1;
unsigned int noOfOperations = 1;
diff --git a/ndb/test/ndbapi/index2.cpp b/ndb/test/ndbapi/index2.cpp
index e49113d2f1b..f739468d7df 100644
--- a/ndb/test/ndbapi/index2.cpp
+++ b/ndb/test/ndbapi/index2.cpp
@@ -81,16 +81,16 @@ static void createTable(Ndb &myNdb, bool storeInACC, bool twoKey, bool longKey)
int res;
column.setName("X");
- column.setPrimaryKey(true);
column.setType(NdbDictionary::Column::Unsigned);
column.setLength(1);
+ column.setPrimaryKey(true);
column.setNullable(false);
table.addColumn(column);
column.setName("Y");
- column.setPrimaryKey(false);
column.setType(NdbDictionary::Column::Unsigned);
column.setLength(1);
+ column.setPrimaryKey(false);
column.setNullable(false);
table.addColumn(column);
@@ -608,6 +608,7 @@ static void dropIndex(Ndb &myNdb, unsigned int noOfIndexes)
NDB_COMMAND(indexTest, "indexTest", "indexTest", "indexTest", 65535)
{
+ ndb_init();
bool createTableOp, createIndexOp, dropIndexOp, insertOp, updateOp, deleteOp, readOp, readIndexOp, updateIndexOp, deleteIndexOp, twoKey, longKey;
unsigned int noOfTuples = 1;
unsigned int noOfOperations = 1;
diff --git a/ndb/test/ndbapi/initronja.cpp b/ndb/test/ndbapi/initronja.cpp
index b3215104822..3ce274e4319 100644
--- a/ndb/test/ndbapi/initronja.cpp
+++ b/ndb/test/ndbapi/initronja.cpp
@@ -46,6 +46,7 @@ static char attrName[MAXATTR][MAXSTRLEN];
inline int InsertRecords(Ndb*, int) ;
NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){
+ ndb_init();
Ndb* pNdb = NULL ;
NdbSchemaCon *MySchemaTransaction = NULL ;
diff --git a/ndb/test/ndbapi/interpreterInTup.cpp b/ndb/test/ndbapi/interpreterInTup.cpp
index 47960cd5d12..20d84e6e96d 100644
--- a/ndb/test/ndbapi/interpreterInTup.cpp
+++ b/ndb/test/ndbapi/interpreterInTup.cpp
@@ -105,6 +105,7 @@ int bTestPassed = 0;
int main(int argc, const char** argv) {
+ ndb_init();
int operationType = 0;
int tupTest = 0;
diff --git a/ndb/test/ndbapi/mainAsyncGenerator.cpp b/ndb/test/ndbapi/mainAsyncGenerator.cpp
index f613c66d07b..16cb50e160f 100644
--- a/ndb/test/ndbapi/mainAsyncGenerator.cpp
+++ b/ndb/test/ndbapi/mainAsyncGenerator.cpp
@@ -282,6 +282,7 @@ threadRoutine(void *arg)
NDB_COMMAND(DbAsyncGenerator, "DbAsyncGenerator",
"DbAsyncGenerator", "DbAsyncGenerator", 65535)
{
+ ndb_init();
int i;
int j;
int k;
diff --git a/ndb/test/ndbapi/msa.cpp b/ndb/test/ndbapi/msa.cpp
index 7a734f9cb79..e39f7a8c64a 100644
--- a/ndb/test/ndbapi/msa.cpp
+++ b/ndb/test/ndbapi/msa.cpp
@@ -971,6 +971,7 @@ void ShowHelp(const char* szCmd)
int main(int argc, char* argv[])
{
+ ndb_init();
int iRes = -1;
g_nNumThreads = 0;
g_nMaxCallsPerSecond = 0;
diff --git a/ndb/test/ndbapi/restarter.cpp b/ndb/test/ndbapi/restarter.cpp
index 9a522f5dcac..d6831494b48 100644
--- a/ndb/test/ndbapi/restarter.cpp
+++ b/ndb/test/ndbapi/restarter.cpp
@@ -28,6 +28,7 @@
#include <NDBT.hpp>
int main(int argc, const char** argv){
+ ndb_init();
const char* _hostName = NULL;
int _loops = 10;
diff --git a/ndb/test/ndbapi/restarter2.cpp b/ndb/test/ndbapi/restarter2.cpp
index f2bcf6f8e7b..846748a7bba 100644
--- a/ndb/test/ndbapi/restarter2.cpp
+++ b/ndb/test/ndbapi/restarter2.cpp
@@ -26,6 +26,7 @@
#include <NDBT.hpp>
int main(int argc, const char** argv){
+ ndb_init();
const char* _hostName = NULL;
int _loops = 10;
diff --git a/ndb/test/ndbapi/restarts.cpp b/ndb/test/ndbapi/restarts.cpp
index 0ec2883d53c..184e754de4a 100644
--- a/ndb/test/ndbapi/restarts.cpp
+++ b/ndb/test/ndbapi/restarts.cpp
@@ -27,6 +27,7 @@
#include <NDBT.hpp>
int main(int argc, const char** argv){
+ ndb_init();
const char* _restartName = NULL;
int _loops = 1;
diff --git a/ndb/test/ndbapi/size.cpp b/ndb/test/ndbapi/size.cpp
index c506771ebde..ff178b11d68 100644
--- a/ndb/test/ndbapi/size.cpp
+++ b/ndb/test/ndbapi/size.cpp
@@ -19,6 +19,7 @@
int main(void)
{
+ ndb_init();
printf("cdrstruct=%d\n",sizeof(struct cdr_record));
printf("long int=%d\n",sizeof(long int));
printf("int=%d\n",sizeof(int));
diff --git a/ndb/test/ndbapi/slow_select.cpp b/ndb/test/ndbapi/slow_select.cpp
index a953e1539d0..625dbc34457 100644
--- a/ndb/test/ndbapi/slow_select.cpp
+++ b/ndb/test/ndbapi/slow_select.cpp
@@ -36,6 +36,7 @@ static void lookup();
int
main(void){
+ ndb_init();
Ndb g_ndb("test");
g_ndb.init(1024);
diff --git a/ndb/test/ndbapi/testBackup.cpp b/ndb/test/ndbapi/testBackup.cpp
index 31a85245025..509cd4780bf 100644
--- a/ndb/test/ndbapi/testBackup.cpp
+++ b/ndb/test/ndbapi/testBackup.cpp
@@ -482,6 +482,7 @@ TESTCASE("FailSlave",
NDBT_TESTSUITE_END(testBackup);
int main(int argc, const char** argv){
+ ndb_init();
return testBackup.execute(argc, argv);
}
diff --git a/ndb/test/ndbapi/testBasic.cpp b/ndb/test/ndbapi/testBasic.cpp
index 26622f9b066..7d03016b87a 100644
--- a/ndb/test/ndbapi/testBasic.cpp
+++ b/ndb/test/ndbapi/testBasic.cpp
@@ -1278,6 +1278,7 @@ TESTCASE("MassiveTransaction",
NDBT_TESTSUITE_END(testBasic);
int main(int argc, const char** argv){
+ ndb_init();
return testBasic.execute(argc, argv);
}
diff --git a/ndb/test/ndbapi/testBasicAsynch.cpp b/ndb/test/ndbapi/testBasicAsynch.cpp
index a97920e53da..6daa22fdc6a 100644
--- a/ndb/test/ndbapi/testBasicAsynch.cpp
+++ b/ndb/test/ndbapi/testBasicAsynch.cpp
@@ -181,6 +181,7 @@ TESTCASE("PkDeleteAsynch",
NDBT_TESTSUITE_END(testBasicAsynch);
int main(int argc, const char** argv){
+ ndb_init();
return testBasicAsynch.execute(argc, argv);
}
diff --git a/ndb/test/ndbapi/testBlobs.cpp b/ndb/test/ndbapi/testBlobs.cpp
index 64881ca39ab..e18f4a8bd1a 100644
--- a/ndb/test/ndbapi/testBlobs.cpp
+++ b/ndb/test/ndbapi/testBlobs.cpp
@@ -1338,6 +1338,7 @@ static struct {
NDB_COMMAND(testOdbcDriver, "testBlobs", "testBlobs", "testBlobs", 65535)
{
+ ndb_init();
while (++argv, --argc > 0) {
const char* arg = argv[0];
if (strcmp(arg, "-batch") == 0) {
diff --git a/ndb/test/ndbapi/testDataBuffers.cpp b/ndb/test/ndbapi/testDataBuffers.cpp
index 2e29dbb0d7b..94658d5c6b9 100644
--- a/ndb/test/ndbapi/testDataBuffers.cpp
+++ b/ndb/test/ndbapi/testDataBuffers.cpp
@@ -545,6 +545,7 @@ testcase(int flag)
NDB_COMMAND(testDataBuffers, "testDataBuffers", "testDataBuffers", "testDataBuffers", 65535)
{
+ ndb_init();
while (++argv, --argc > 0) {
char const* p = argv[0];
if (*p++ != '-' || strlen(p) != 1)
diff --git a/ndb/test/ndbapi/testDeadlock.cpp b/ndb/test/ndbapi/testDeadlock.cpp
index f51b3cea1e5..a445823b8a8 100644
--- a/ndb/test/ndbapi/testDeadlock.cpp
+++ b/ndb/test/ndbapi/testDeadlock.cpp
@@ -491,6 +491,7 @@ wl1822_main(char scantx)
NDB_COMMAND(testOdbcDriver, "testDeadlock", "testDeadlock", "testDeadlock", 65535)
{
+ ndb_init();
while (++argv, --argc > 0) {
const char* arg = argv[0];
if (strcmp(arg, "-scan") == 0) {
diff --git a/ndb/test/ndbapi/testDict.cpp b/ndb/test/ndbapi/testDict.cpp
index a0c7bb1414b..7cba5ce4cc8 100644
--- a/ndb/test/ndbapi/testDict.cpp
+++ b/ndb/test/ndbapi/testDict.cpp
@@ -1128,9 +1128,9 @@ runCreateAutoincrementTable(NDBT_Context* ctx, NDBT_Step* step){
myTable.setName(tabname);
myColumn.setName("ATTR1");
- myColumn.setPrimaryKey(true);
myColumn.setType(NdbDictionary::Column::Unsigned);
myColumn.setLength(1);
+ myColumn.setPrimaryKey(true);
myColumn.setNullable(false);
myColumn.setAutoIncrement(true);
if (startvalue != ~0) // check that default value starts with 1
@@ -1576,6 +1576,7 @@ TESTCASE("DictionaryPerf",
NDBT_TESTSUITE_END(testDict);
int main(int argc, const char** argv){
+ ndb_init();
// Tables should not be auto created
testDict.setCreateTable(false);
myRandom48Init(NdbTick_CurrentMillisecond());
diff --git a/ndb/test/ndbapi/testGrep.cpp b/ndb/test/ndbapi/testGrep.cpp
index 0bf84cb4ec8..713aefbeafa 100644
--- a/ndb/test/ndbapi/testGrep.cpp
+++ b/ndb/test/ndbapi/testGrep.cpp
@@ -533,6 +533,7 @@ TESTCASE("FailSlave",
NDBT_TESTSUITE_END(testGrep);
int main(int argc, const char** argv){
+ ndb_init();
return testGrep.execute(argc, argv);
}
diff --git a/ndb/test/ndbapi/testGrepVerify.cpp b/ndb/test/ndbapi/testGrepVerify.cpp
index 05445c1ba1b..52dcda9a162 100644
--- a/ndb/test/ndbapi/testGrepVerify.cpp
+++ b/ndb/test/ndbapi/testGrepVerify.cpp
@@ -40,6 +40,7 @@
continue; }
int main(int argc, const char** argv){
+ ndb_init();
const char * connectString = NULL;
diff --git a/ndb/test/ndbapi/testIndex.cpp b/ndb/test/ndbapi/testIndex.cpp
index 6ebbfd8b680..bef3b310c96 100644
--- a/ndb/test/ndbapi/testIndex.cpp
+++ b/ndb/test/ndbapi/testIndex.cpp
@@ -1528,6 +1528,7 @@ TESTCASE("UniqueNull",
NDBT_TESTSUITE_END(testIndex);
int main(int argc, const char** argv){
+ ndb_init();
return testIndex.execute(argc, argv);
}
diff --git a/ndb/test/ndbapi/testInterpreter.cpp b/ndb/test/ndbapi/testInterpreter.cpp
index 9c584d6f581..0baba33d2b2 100644
--- a/ndb/test/ndbapi/testInterpreter.cpp
+++ b/ndb/test/ndbapi/testInterpreter.cpp
@@ -224,6 +224,7 @@ TESTCASE("NdbErrorOperation",
NDBT_TESTSUITE_END(testInterpreter);
int main(int argc, const char** argv){
+ ndb_init();
// TABLE("T1");
return testInterpreter.execute(argc, argv);
}
diff --git a/ndb/test/ndbapi/testMgm.cpp b/ndb/test/ndbapi/testMgm.cpp
index d5b9372cc9b..ef653d3f972 100644
--- a/ndb/test/ndbapi/testMgm.cpp
+++ b/ndb/test/ndbapi/testMgm.cpp
@@ -178,6 +178,7 @@ TESTCASE("SingleUserMode",
NDBT_TESTSUITE_END(testMgm);
int main(int argc, const char** argv){
+ ndb_init();
myRandom48Init(NdbTick_CurrentMillisecond());
return testMgm.execute(argc, argv);
}
diff --git a/ndb/test/ndbapi/testNdbApi.cpp b/ndb/test/ndbapi/testNdbApi.cpp
index 5b171d42578..47987629fe3 100644
--- a/ndb/test/ndbapi/testNdbApi.cpp
+++ b/ndb/test/ndbapi/testNdbApi.cpp
@@ -1006,6 +1006,7 @@ TESTCASE("NdbErrorOperation",
NDBT_TESTSUITE_END(testNdbApi);
int main(int argc, const char** argv){
+ ndb_init();
// TABLE("T1");
return testNdbApi.execute(argc, argv);
}
diff --git a/ndb/test/ndbapi/testNodeRestart.cpp b/ndb/test/ndbapi/testNodeRestart.cpp
index 89b38c78e71..6bfe59f8d3f 100644
--- a/ndb/test/ndbapi/testNodeRestart.cpp
+++ b/ndb/test/ndbapi/testNodeRestart.cpp
@@ -434,6 +434,7 @@ TESTCASE("StopOnError",
NDBT_TESTSUITE_END(testNodeRestart);
int main(int argc, const char** argv){
+ ndb_init();
#if 0
// It might be interesting to have longer defaults for num
// loops in this test
diff --git a/ndb/test/ndbapi/testOIBasic.cpp b/ndb/test/ndbapi/testOIBasic.cpp
index 29d03f0c33e..ac28b96af80 100644
--- a/ndb/test/ndbapi/testOIBasic.cpp
+++ b/ndb/test/ndbapi/testOIBasic.cpp
@@ -979,9 +979,9 @@ createtable(Par par)
for (unsigned k = 0; k < tab.m_cols; k++) {
const Col& col = tab.m_col[k];
NdbDictionary::Column c(col.m_name);
- c.setPrimaryKey(col.m_pk);
c.setType(col.m_type);
c.setLength(col.m_length);
+ c.setPrimaryKey(col.m_pk);
c.setNullable(col.m_nullable);
t.addColumn(c);
}
@@ -2236,9 +2236,8 @@ pkreadfast(Par par, unsigned count)
keyrow.calc(par, i);
CHK(keyrow.selrow(par) == 0);
NdbRecAttr* rec;
- CHK(con.getValue((Uint32)0, rec) == 0);
- CHK(con.executeScan() == 0);
// get 1st column
+ CHK(con.getValue((Uint32)0, rec) == 0);
CHK(con.execute(Commit) == 0);
con.closeTransaction();
}
@@ -3201,6 +3200,7 @@ runtest(Par par)
NDB_COMMAND(testOIBasic, "testOIBasic", "testOIBasic", "testOIBasic", 65535)
{
+ ndb_init();
while (++argv, --argc > 0) {
const char* arg = argv[0];
if (*arg != '-') {
diff --git a/ndb/test/ndbapi/testOperations.cpp b/ndb/test/ndbapi/testOperations.cpp
index bb58e69e898..ba41e1d1c40 100644
--- a/ndb/test/ndbapi/testOperations.cpp
+++ b/ndb/test/ndbapi/testOperations.cpp
@@ -230,6 +230,7 @@ runClearTable(NDBT_Context* ctx, NDBT_Step* step){
int
main(int argc, const char** argv){
+ ndb_init();
NDBT_TestSuite ts("testOperations");
for(Uint32 i = 0; i<sizeof(matrix)/sizeof(matrix[0]); i++){
diff --git a/ndb/test/ndbapi/testOrderedIndex.cpp b/ndb/test/ndbapi/testOrderedIndex.cpp
index 51cc53c9975..b3a75410646 100644
--- a/ndb/test/ndbapi/testOrderedIndex.cpp
+++ b/ndb/test/ndbapi/testOrderedIndex.cpp
@@ -218,6 +218,7 @@ NDBT_TESTSUITE_END(testOrderedIndex);
int
main(int argc, const char** argv)
{
+ ndb_init();
return testOrderedIndex.execute(argc, argv);
}
diff --git a/ndb/test/ndbapi/testReadPerf.cpp b/ndb/test/ndbapi/testReadPerf.cpp
index 412661c4ff8..7cf3755d66f 100644
--- a/ndb/test/ndbapi/testReadPerf.cpp
+++ b/ndb/test/ndbapi/testReadPerf.cpp
@@ -91,6 +91,7 @@ void print_result();
int
main(int argc, const char** argv){
+ ndb_init();
int verbose = 1;
int optind = 0;
diff --git a/ndb/test/ndbapi/testRestartGci.cpp b/ndb/test/ndbapi/testRestartGci.cpp
index 54d38654ff2..4cdfca29e6f 100644
--- a/ndb/test/ndbapi/testRestartGci.cpp
+++ b/ndb/test/ndbapi/testRestartGci.cpp
@@ -214,6 +214,7 @@ TESTCASE("InsertRestartGci",
NDBT_TESTSUITE_END(testRestartGci);
int main(int argc, const char** argv){
+ ndb_init();
return testRestartGci.execute(argc, argv);
}
diff --git a/ndb/test/ndbapi/testScan.cpp b/ndb/test/ndbapi/testScan.cpp
index 3d8b37df0ca..0cd30dfefde 100644
--- a/ndb/test/ndbapi/testScan.cpp
+++ b/ndb/test/ndbapi/testScan.cpp
@@ -1400,6 +1400,7 @@ TESTCASE("ScanRestart",
NDBT_TESTSUITE_END(testScan);
int main(int argc, const char** argv){
+ ndb_init();
myRandom48Init(NdbTick_CurrentMillisecond());
return testScan.execute(argc, argv);
}
diff --git a/ndb/test/ndbapi/testScanInterpreter.cpp b/ndb/test/ndbapi/testScanInterpreter.cpp
index 3b5baf954e0..3a5ef22b613 100644
--- a/ndb/test/ndbapi/testScanInterpreter.cpp
+++ b/ndb/test/ndbapi/testScanInterpreter.cpp
@@ -273,6 +273,7 @@ TESTCASE("ScanLessThanLoop",
NDBT_TESTSUITE_END(testScanInterpreter);
int main(int argc, const char** argv){
+ ndb_init();
return testScanInterpreter.execute(argc, argv);
}
diff --git a/ndb/test/ndbapi/testScanPerf.cpp b/ndb/test/ndbapi/testScanPerf.cpp
index 829ba5a0f15..8c1a41047ca 100644
--- a/ndb/test/ndbapi/testScanPerf.cpp
+++ b/ndb/test/ndbapi/testScanPerf.cpp
@@ -72,6 +72,7 @@ int drop_table();
int
main(int argc, const char** argv){
+ ndb_init();
int verbose = 1;
int optind = 0;
diff --git a/ndb/test/ndbapi/testSystemRestart.cpp b/ndb/test/ndbapi/testSystemRestart.cpp
index 61e086ff941..68e5eacc631 100644
--- a/ndb/test/ndbapi/testSystemRestart.cpp
+++ b/ndb/test/ndbapi/testSystemRestart.cpp
@@ -1179,6 +1179,7 @@ TESTCASE("SR8",
NDBT_TESTSUITE_END(testSystemRestart);
int main(int argc, const char** argv){
+ ndb_init();
return testSystemRestart.execute(argc, argv);
}
diff --git a/ndb/test/ndbapi/testTimeout.cpp b/ndb/test/ndbapi/testTimeout.cpp
index 62e69125073..5cabb86541d 100644
--- a/ndb/test/ndbapi/testTimeout.cpp
+++ b/ndb/test/ndbapi/testTimeout.cpp
@@ -406,6 +406,7 @@ TESTCASE("BuddyTransNoTimeout5",
NDBT_TESTSUITE_END(testTimeout);
int main(int argc, const char** argv){
+ ndb_init();
myRandom48Init(NdbTick_CurrentMillisecond());
return testTimeout.execute(argc, argv);
}
diff --git a/ndb/test/ndbapi/testTransactions.cpp b/ndb/test/ndbapi/testTransactions.cpp
index 67a2df24390..2dca9e24fb4 100644
--- a/ndb/test/ndbapi/testTransactions.cpp
+++ b/ndb/test/ndbapi/testTransactions.cpp
@@ -364,6 +364,7 @@ runClearTable(NDBT_Context* ctx, NDBT_Step* step){
int
main(int argc, const char** argv){
+ ndb_init();
NDBT_TestSuite ts("testOperations");
for(Uint32 i = 0; i<sizeof(matrix)/sizeof(matrix[0]); i++){
diff --git a/ndb/test/ndbapi/test_event.cpp b/ndb/test/ndbapi/test_event.cpp
index 40fc1c6defa..cb2793e42b9 100644
--- a/ndb/test/ndbapi/test_event.cpp
+++ b/ndb/test/ndbapi/test_event.cpp
@@ -137,6 +137,7 @@ NDBT_TESTSUITE_END(test_event);
#endif
int main(int argc, const char** argv){
+ ndb_init();
return test_event.execute(argc, argv);
}
diff --git a/ndb/test/run-test/main.cpp b/ndb/test/run-test/main.cpp
index 653e16e0947..22799a9a1b2 100644
--- a/ndb/test/run-test/main.cpp
+++ b/ndb/test/run-test/main.cpp
@@ -79,6 +79,7 @@ const int arg_count = 10;
int
main(int argc, const char ** argv){
+ ndb_init();
bool restart = true;
int lineno = 1;
diff --git a/ndb/test/src/NDBT_Test.cpp b/ndb/test/src/NDBT_Test.cpp
index ba316bac01b..4ff94bcf296 100644
--- a/ndb/test/src/NDBT_Test.cpp
+++ b/ndb/test/src/NDBT_Test.cpp
@@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
-#include <my_sys.h>
#include "NDBT.hpp"
#include "NDBT_Test.hpp"
@@ -990,7 +989,6 @@ int NDBT_TestSuite::execute(int argc, const char** argv){
}
#ifndef DBUG_OFF
- my_init();
if (debug_option)
DBUG_PUSH(debug_option);
#endif
diff --git a/ndb/test/tools/copy_tab.cpp b/ndb/test/tools/copy_tab.cpp
index 33ce8e01d9a..30141acaa78 100644
--- a/ndb/test/tools/copy_tab.cpp
+++ b/ndb/test/tools/copy_tab.cpp
@@ -24,6 +24,7 @@
#include <getarg.h>
int main(int argc, const char** argv){
+ ndb_init();
const char* _tabname = NULL;
const char* _to_tabname = NULL;
diff --git a/ndb/test/tools/cpcc.cpp b/ndb/test/tools/cpcc.cpp
index e30d458ffee..dd59e577f2c 100644
--- a/ndb/test/tools/cpcc.cpp
+++ b/ndb/test/tools/cpcc.cpp
@@ -173,6 +173,7 @@ add_hosts(Vector<SimpleCpcClient*> & hosts, BaseString list){
int
main(int argc, const char** argv){
+ ndb_init();
int help = 0;
const char *cmd=0, *name=0, *group=0, *owner=0;
int list = 0, start = 0, stop = 0, rm = 0;
diff --git a/ndb/test/tools/create_index.cpp b/ndb/test/tools/create_index.cpp
index f883755ea24..75a657522f6 100644
--- a/ndb/test/tools/create_index.cpp
+++ b/ndb/test/tools/create_index.cpp
@@ -26,6 +26,7 @@
int
main(int argc, const char** argv){
+ ndb_init();
const char* _dbname = "TEST_DB";
int _help = 0;
diff --git a/ndb/test/tools/hugoCalculator.cpp b/ndb/test/tools/hugoCalculator.cpp
index 7f2751be2ba..82c4bbff1a4 100644
--- a/ndb/test/tools/hugoCalculator.cpp
+++ b/ndb/test/tools/hugoCalculator.cpp
@@ -28,6 +28,7 @@
int main(int argc, const char** argv)
{
+ ndb_init();
int _row = 0;
int _column = 0;
int _updates = 0;
diff --git a/ndb/test/tools/hugoFill.cpp b/ndb/test/tools/hugoFill.cpp
index dee6ce2e6c8..6253bd1bb12 100644
--- a/ndb/test/tools/hugoFill.cpp
+++ b/ndb/test/tools/hugoFill.cpp
@@ -25,6 +25,7 @@
int main(int argc, const char** argv){
+ ndb_init();
int _records = 0;
const char* _tabname = NULL;
diff --git a/ndb/test/tools/hugoLoad.cpp b/ndb/test/tools/hugoLoad.cpp
index be7f878d106..c697ad22aad 100644
--- a/ndb/test/tools/hugoLoad.cpp
+++ b/ndb/test/tools/hugoLoad.cpp
@@ -24,6 +24,7 @@
int main(int argc, const char** argv){
+ ndb_init();
int _records = 0;
const char* _tabname = NULL;
diff --git a/ndb/test/tools/hugoLockRecords.cpp b/ndb/test/tools/hugoLockRecords.cpp
index e2c2cd13f00..629408d401d 100644
--- a/ndb/test/tools/hugoLockRecords.cpp
+++ b/ndb/test/tools/hugoLockRecords.cpp
@@ -27,6 +27,7 @@
#include <HugoTransactions.hpp>
int main(int argc, const char** argv){
+ ndb_init();
int _records = 0;
int _loops = 1;
diff --git a/ndb/test/tools/hugoPkDelete.cpp b/ndb/test/tools/hugoPkDelete.cpp
index 1855f19796f..78a90ebcb46 100644
--- a/ndb/test/tools/hugoPkDelete.cpp
+++ b/ndb/test/tools/hugoPkDelete.cpp
@@ -27,6 +27,7 @@
#include <HugoTransactions.hpp>
int main(int argc, const char** argv){
+ ndb_init();
int _records = 0;
int _loops = 1;
diff --git a/ndb/test/tools/hugoPkRead.cpp b/ndb/test/tools/hugoPkRead.cpp
index 50351f08195..cf08b137e8e 100644
--- a/ndb/test/tools/hugoPkRead.cpp
+++ b/ndb/test/tools/hugoPkRead.cpp
@@ -28,6 +28,7 @@
int main(int argc, const char** argv){
+ ndb_init();
int _records = 0;
int _loops = 1;
diff --git a/ndb/test/tools/hugoPkReadRecord.cpp b/ndb/test/tools/hugoPkReadRecord.cpp
index 85f20bd2060..38b7cae2bf4 100644
--- a/ndb/test/tools/hugoPkReadRecord.cpp
+++ b/ndb/test/tools/hugoPkReadRecord.cpp
@@ -28,6 +28,7 @@
int main(int argc, const char** argv)
{
+ ndb_init();
int _row = 0;
int _hex = 0;
int _primaryKey = 0;
diff --git a/ndb/test/tools/hugoPkUpdate.cpp b/ndb/test/tools/hugoPkUpdate.cpp
index e7edc3a991d..286be14a01c 100644
--- a/ndb/test/tools/hugoPkUpdate.cpp
+++ b/ndb/test/tools/hugoPkUpdate.cpp
@@ -27,6 +27,7 @@
#include <HugoTransactions.hpp>
int main(int argc, const char** argv){
+ ndb_init();
int _records = 0;
int _loops = 1;
diff --git a/ndb/test/tools/hugoScanRead.cpp b/ndb/test/tools/hugoScanRead.cpp
index 47ea8f4a8a7..cdfdcea4654 100644
--- a/ndb/test/tools/hugoScanRead.cpp
+++ b/ndb/test/tools/hugoScanRead.cpp
@@ -27,6 +27,7 @@
#include <HugoTransactions.hpp>
int main(int argc, const char** argv){
+ ndb_init();
int _records = 0;
int _loops = 1;
diff --git a/ndb/test/tools/hugoScanUpdate.cpp b/ndb/test/tools/hugoScanUpdate.cpp
index 3e2255ca0f3..96a487a02bf 100644
--- a/ndb/test/tools/hugoScanUpdate.cpp
+++ b/ndb/test/tools/hugoScanUpdate.cpp
@@ -27,6 +27,7 @@
#include <HugoTransactions.hpp>
int main(int argc, const char** argv){
+ ndb_init();
int _records = 0;
int _loops = 1;
diff --git a/ndb/test/tools/restart.cpp b/ndb/test/tools/restart.cpp
index 88cfb231a72..9ad20801fd7 100644
--- a/ndb/test/tools/restart.cpp
+++ b/ndb/test/tools/restart.cpp
@@ -27,6 +27,7 @@
#include <NDBT.hpp>
int main(int argc, const char** argv){
+ ndb_init();
const char* _hostName = NULL;
int _initial = 0;
diff --git a/ndb/test/tools/transproxy.cpp b/ndb/test/tools/transproxy.cpp
index 384a8a34f03..90e216ec785 100644
--- a/ndb/test/tools/transproxy.cpp
+++ b/ndb/test/tools/transproxy.cpp
@@ -346,6 +346,7 @@ start()
int
main(int av, char** ac)
{
+ ndb_init();
debug("start");
hostname = "ndb-srv7";
if (Ndb_getInAddr(&hostaddr.sin_addr, hostname) != 0) {
diff --git a/ndb/test/tools/verify_index.cpp b/ndb/test/tools/verify_index.cpp
index 1295b657e9b..6c8e304e1a1 100644
--- a/ndb/test/tools/verify_index.cpp
+++ b/ndb/test/tools/verify_index.cpp
@@ -27,6 +27,7 @@
int main(int argc, const char** argv){
+ ndb_init();
int _parallelism = 240;
const char* _tabname = NULL;
const char* _indexname = NULL;
diff --git a/ndb/tools/delete_all.cpp b/ndb/tools/delete_all.cpp
index 5110947c6a2..aa5798376ae 100644
--- a/ndb/tools/delete_all.cpp
+++ b/ndb/tools/delete_all.cpp
@@ -26,6 +26,7 @@
static int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism=240);
int main(int argc, const char** argv){
+ ndb_init();
const char* _tabname = NULL;
const char* _dbname = "TEST_DB";
diff --git a/ndb/tools/desc.cpp b/ndb/tools/desc.cpp
index 859a9544a79..0ab11a0fdd2 100644
--- a/ndb/tools/desc.cpp
+++ b/ndb/tools/desc.cpp
@@ -22,6 +22,7 @@
int main(int argc, const char** argv){
+ ndb_init();
const char* _tabname = NULL;
const char* _dbname = "TEST_DB";
int _unqualified = 0;
diff --git a/ndb/tools/drop_index.cpp b/ndb/tools/drop_index.cpp
index 327f15741c9..70c29461c23 100644
--- a/ndb/tools/drop_index.cpp
+++ b/ndb/tools/drop_index.cpp
@@ -23,6 +23,7 @@
#include <getarg.h>
int main(int argc, const char** argv){
+ ndb_init();
const char* _tabname = NULL;
const char* _dbname = "TEST_DB";
diff --git a/ndb/tools/drop_tab.cpp b/ndb/tools/drop_tab.cpp
index 70e5d85aabe..15c229cb0fb 100644
--- a/ndb/tools/drop_tab.cpp
+++ b/ndb/tools/drop_tab.cpp
@@ -23,6 +23,7 @@
#include <getarg.h>
int main(int argc, const char** argv){
+ ndb_init();
const char* _tabname = NULL;
const char* _dbname = "TEST_DB";
diff --git a/ndb/tools/listTables.cpp b/ndb/tools/listTables.cpp
index d6465f3214f..4b24929ee4b 100644
--- a/ndb/tools/listTables.cpp
+++ b/ndb/tools/listTables.cpp
@@ -22,7 +22,6 @@
*/
#include <ndb_global.h>
-#include <my_sys.h>
#include <getarg.h>
#include <NdbApi.hpp>
@@ -167,6 +166,7 @@ const char *debug_option= 0;
#endif
int main(int argc, const char** argv){
+ ndb_init();
int _loops = 1;
const char* _tabname = NULL;
const char* _dbname = "TEST_DB";
@@ -209,7 +209,6 @@ int main(int argc, const char** argv){
_tabname = argv[optind];
#ifndef DBUG_OFF
- my_init();
if (debug_option)
DBUG_PUSH(debug_option);
#endif
diff --git a/ndb/tools/ndbsql.cpp b/ndb/tools/ndbsql.cpp
index 6af5f47f6f4..1997e4abebd 100644
--- a/ndb/tools/ndbsql.cpp
+++ b/ndb/tools/ndbsql.cpp
@@ -671,6 +671,7 @@ void print_help_virtual() {
int main(int argc, const char** argv)
{
+ ndb_init();
const char* usage = "Usage: ndbsql [-h] [-d dsn] [-f file] [stmt]\n-h help\n-d <database name or connect string>\n-f <file name> batch mode\nstmt single SQL statement\n";
const char* dsn = "TEST_DB";
bool helpFlg = false, batchMode = false;
diff --git a/ndb/tools/select_all.cpp b/ndb/tools/select_all.cpp
index a99bad48f1f..8fb8437ba5f 100644
--- a/ndb/tools/select_all.cpp
+++ b/ndb/tools/select_all.cpp
@@ -16,7 +16,6 @@
#include <ndb_global.h>
-#include <my_sys.h>
#include <NdbOut.hpp>
@@ -42,6 +41,7 @@ int scanReadRecords(Ndb*,
bool orderby);
int main(int argc, const char** argv){
+ ndb_init();
int _parallelism = 240;
const char* _delimiter = "\t";
int _header = true;
@@ -88,7 +88,6 @@ int main(int argc, const char** argv){
}
_tabname = argv[optind];
- my_init();
#ifndef DBUG_OFF
if (debug_option)
DBUG_PUSH(debug_option);
diff --git a/ndb/tools/select_count.cpp b/ndb/tools/select_count.cpp
index bb7c9dea49b..6650421e637 100644
--- a/ndb/tools/select_count.cpp
+++ b/ndb/tools/select_count.cpp
@@ -33,6 +33,7 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab,
UtilTransactions::ScanLock lock);
int main(int argc, const char** argv){
+ ndb_init();
const char* _dbname = "TEST_DB";
int _parallelism = 240;
int _help = 0;
diff --git a/ndb/tools/waiter.cpp b/ndb/tools/waiter.cpp
index 63469c6d746..c27b46c9356 100644
--- a/ndb/tools/waiter.cpp
+++ b/ndb/tools/waiter.cpp
@@ -30,6 +30,7 @@ int
waitClusterStatus(const char* _addr, ndb_mgm_node_status _status, unsigned int _timeout);
int main(int argc, const char** argv){
+ ndb_init();
const char* _hostName = NULL;
int _no_contact = 0;
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index bb3e54e74d5..95247063e31 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -2897,6 +2897,8 @@ static int create_ndb_column(NDBCOL &col,
{
// Set name
col.setName(field->field_name);
+ // Get char set
+ CHARSET_INFO *cs= field->charset();
// Set type and sizes
const enum enum_field_types mysql_type= field->real_type();
switch (mysql_type) {
@@ -2968,15 +2970,19 @@ static int create_ndb_column(NDBCOL &col,
case MYSQL_TYPE_STRING:
if (field->flags & BINARY_FLAG)
col.setType(NDBCOL::Binary);
- else
+ else {
col.setType(NDBCOL::Char);
+ col.setCharset(cs);
+ }
col.setLength(field->pack_length());
break;
case MYSQL_TYPE_VAR_STRING:
if (field->flags & BINARY_FLAG)
col.setType(NDBCOL::Varbinary);
- else
+ else {
col.setType(NDBCOL::Varchar);
+ col.setCharset(cs);
+ }
col.setLength(field->pack_length());
break;
// Blob types (all come in as MYSQL_TYPE_BLOB)
@@ -2984,8 +2990,10 @@ static int create_ndb_column(NDBCOL &col,
case MYSQL_TYPE_TINY_BLOB:
if (field->flags & BINARY_FLAG)
col.setType(NDBCOL::Blob);
- else
+ else {
col.setType(NDBCOL::Text);
+ col.setCharset(cs);
+ }
col.setInlineSize(256);
// No parts
col.setPartSize(0);
@@ -2995,8 +3003,10 @@ static int create_ndb_column(NDBCOL &col,
case MYSQL_TYPE_BLOB:
if (field->flags & BINARY_FLAG)
col.setType(NDBCOL::Blob);
- else
+ else {
col.setType(NDBCOL::Text);
+ col.setCharset(cs);
+ }
// Use "<=" even if "<" is the exact condition
if (field->max_length() <= (1 << 8))
goto mysql_type_tiny_blob;
@@ -3015,8 +3025,10 @@ static int create_ndb_column(NDBCOL &col,
case MYSQL_TYPE_MEDIUM_BLOB:
if (field->flags & BINARY_FLAG)
col.setType(NDBCOL::Blob);
- else
+ else {
col.setType(NDBCOL::Text);
+ col.setCharset(cs);
+ }
col.setInlineSize(256);
col.setPartSize(4000);
col.setStripeSize(8);
@@ -3025,8 +3037,10 @@ static int create_ndb_column(NDBCOL &col,
case MYSQL_TYPE_LONG_BLOB:
if (field->flags & BINARY_FLAG)
col.setType(NDBCOL::Blob);
- else
+ else {
col.setType(NDBCOL::Text);
+ col.setCharset(cs);
+ }
col.setInlineSize(256);
col.setPartSize(8000);
col.setStripeSize(4);