summaryrefslogtreecommitdiff
path: root/ndb
diff options
context:
space:
mode:
authorunknown <joreland@mysql.com>2004-05-27 19:59:38 +0200
committerunknown <joreland@mysql.com>2004-05-27 19:59:38 +0200
commit486494b3ec6293a1705a2aad85e37beeb88503f7 (patch)
tree5711d1c4442e7d0a2c1f033e65ffffc8a69f6322 /ndb
parent489aa9be1ce31a0b7f4e8901faa818b21a8f7c7a (diff)
parentfb014155b88ebedb9b742ce3cb3adb6500f4aa64 (diff)
downloadmariadb-git-486494b3ec6293a1705a2aad85e37beeb88503f7.tar.gz
Merge joreland@bk-internal.mysql.com:/home/bk/mysql-4.1-ndb
into mysql.com:/home/jonas/src/mysql-4.1-ndb
Diffstat (limited to 'ndb')
-rw-r--r--ndb/config/common.mk.am2
-rw-r--r--ndb/config/type_ndbapitest.mk.am3
-rw-r--r--ndb/include/ndb_global.h2
-rw-r--r--ndb/include/ndbapi/Ndb.hpp8
-rw-r--r--ndb/src/Makefile.am17
-rw-r--r--ndb/src/common/portlib/gcc.cpp2
-rw-r--r--ndb/src/common/portlib/unix/NdbThread.c2
-rw-r--r--ndb/src/common/transporter/Makefile.am8
-rw-r--r--ndb/src/common/transporter/Transporter.hpp2
-rw-r--r--ndb/src/common/util/new.cpp4
-rw-r--r--ndb/src/kernel/blocks/backup/restore/Makefile.am2
-rw-r--r--ndb/src/kernel/blocks/backup/restore/Restore.cpp178
-rw-r--r--ndb/src/kernel/blocks/backup/restore/Restore.hpp16
-rw-r--r--ndb/src/kernel/blocks/backup/restore/main.cpp179
-rw-r--r--ndb/src/mgmapi/Makefile.am2
-rw-r--r--ndb/src/ndbapi/Makefile.am2
-rw-r--r--ndb/src/ndbapi/Ndb.cpp62
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.cpp36
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.hpp15
-rw-r--r--ndb/src/ndbapi/Ndbinit.cpp8
-rw-r--r--ndb/src/rep/adapters/AppNDB.cpp8
-rw-r--r--ndb/src/rep/state/Channel.cpp8
-rw-r--r--ndb/test/ndbapi/testGrepVerify.cpp5
-rw-r--r--ndb/tools/listTables.cpp6
24 files changed, 143 insertions, 434 deletions
diff --git a/ndb/config/common.mk.am b/ndb/config/common.mk.am
index cc320120b2a..394da10abd6 100644
--- a/ndb/config/common.mk.am
+++ b/ndb/config/common.mk.am
@@ -1,7 +1,7 @@
INCLUDES = $(INCLUDES_LOC)
LDADD = $(top_srcdir)/ndb/src/common/portlib/gcc.cpp $(LDADD_LOC)
-DEFS = @DEFS@ @NDB_DEFS@ $(DEFS_LOC)
+DEFS = @DEFS@ @NDB_DEFS@ $(DEFS_LOC) $(NDB_EXTRA_FLAGS)
# ndb cannot be compiled with -fno-implicit-templaces
NDB_CXXFLAGS=-fimplicit-templates
##use AM_CXXFLAGS for other flags
diff --git a/ndb/config/type_ndbapitest.mk.am b/ndb/config/type_ndbapitest.mk.am
index 20ba5032d02..02288d06c2c 100644
--- a/ndb/config/type_ndbapitest.mk.am
+++ b/ndb/config/type_ndbapitest.mk.am
@@ -1,6 +1,5 @@
LDADD += $(top_srcdir)/ndb/test/src/libNDBT.a \
- $(top_srcdir)/ndb/src/ndbapi/libNDB_API.la \
- $(top_srcdir)/ndb/src/mgmapi/libMGM_API.la
+ $(top_srcdir)/ndb/src/libndbclient.la
INCLUDES += @NDB_NDBAPITEST_INCLUDES@
diff --git a/ndb/include/ndb_global.h b/ndb/include/ndb_global.h
index 5e03b972268..bd1e4954f14 100644
--- a/ndb/include/ndb_global.h
+++ b/ndb/include/ndb_global.h
@@ -49,6 +49,8 @@
#endif
+static const char table_name_separator = '/';
+
#ifdef NDB_VC98
#define STATIC_CONST(x) enum { x }
#else
diff --git a/ndb/include/ndbapi/Ndb.hpp b/ndb/include/ndbapi/Ndb.hpp
index 3acfcd194e8..cde67e9c2fa 100644
--- a/ndb/include/ndbapi/Ndb.hpp
+++ b/ndb/include/ndbapi/Ndb.hpp
@@ -1361,9 +1361,9 @@ public:
* index names as DATABASENAME/SCHEMANAME/TABLENAME/INDEXNAME
* @param turnNamingOn bool true - turn naming on, false - turn naming off
*/
- static void useFullyQualifiedNames(bool turnNamingOn = true);
+ void useFullyQualifiedNames(bool turnNamingOn = true);
- static bool usingFullyQualifiedNames();
+ bool usingFullyQualifiedNames();
/** @} *********************************************************************/
@@ -1542,10 +1542,12 @@ private:
void abortTransactionsAfterNodeFailure(Uint16 aNodeId);
static
+ const char * externalizeTableName(const char * internalTableName, bool fullyQualifiedNames);
const char * externalizeTableName(const char * internalTableName);
const char * internalizeTableName(const char * externalTableName);
static
+ const char * externalizeIndexName(const char * internalIndexName, bool fullyQualifiedNames);
const char * externalizeIndexName(const char * internalIndexName);
const char * internalizeIndexName(const NdbTableImpl * table,
const char * externalIndexName);
@@ -1582,6 +1584,8 @@ private:
NdbWaiter theWaiter;
+ bool fullyQualifiedNames;
+
// Ndb database name.
char theDataBase[NDB_MAX_DATABASE_NAME_SIZE];
// Ndb database schema name.
diff --git a/ndb/src/Makefile.am b/ndb/src/Makefile.am
index 745a33ccf45..2999c617a06 100644
--- a/ndb/src/Makefile.am
+++ b/ndb/src/Makefile.am
@@ -1 +1,16 @@
-SUBDIRS = common mgmapi ndbapi kernel mgmsrv mgmclient cw
+SUBDIRS = common mgmapi ndbapi . kernel mgmsrv mgmclient cw
+
+ndblib_LTLIBRARIES = libndbclient.la
+
+libndbclient_la_SOURCES =
+
+libndbclient_la_LIBADD = \
+ $(top_srcdir)/ndb/src/ndbapi/libndbapi.la \
+ $(top_srcdir)/ndb/src/common/transporter/libtransporter.la \
+ $(top_srcdir)/ndb/src/common/debugger/libtrace.la \
+ $(top_srcdir)/ndb/src/common/debugger/signaldata/libsignaldataprint.la \
+ $(top_srcdir)/ndb/src/common/mgmcommon/libmgmsrvcommon.la \
+ $(top_srcdir)/ndb/src/mgmapi/libmgmapi.la \
+ $(top_srcdir)/ndb/src/common/logger/liblogger.la \
+ $(top_srcdir)/ndb/src/common/portlib/unix/libportlib.la \
+ $(top_srcdir)/ndb/src/common/util/libgeneral.la
diff --git a/ndb/src/common/portlib/gcc.cpp b/ndb/src/common/portlib/gcc.cpp
index 41b1373ee78..66aa4812dc6 100644
--- a/ndb/src/common/portlib/gcc.cpp
+++ b/ndb/src/common/portlib/gcc.cpp
@@ -2,6 +2,6 @@
/**
* GCC linking problem...
*/
-#if ( __GNUC__ == 3 )
+#ifdef DEFINE_CXA_PURE_VIRTUAL
extern "C" { int __cxa_pure_virtual() { return 0;} }
#endif
diff --git a/ndb/src/common/portlib/unix/NdbThread.c b/ndb/src/common/portlib/unix/NdbThread.c
index d78941454d4..b023e851d29 100644
--- a/ndb/src/common/portlib/unix/NdbThread.c
+++ b/ndb/src/common/portlib/unix/NdbThread.c
@@ -21,7 +21,7 @@
#define MAX_THREAD_NAME 16
-//#define USE_PTHREAD_EXTRAS
+/*#define USE_PTHREAD_EXTRAS*/
struct NdbThread
{
diff --git a/ndb/src/common/transporter/Makefile.am b/ndb/src/common/transporter/Makefile.am
index 8c46cc29051..9e697076cda 100644
--- a/ndb/src/common/transporter/Makefile.am
+++ b/ndb/src/common/transporter/Makefile.am
@@ -6,12 +6,14 @@ libtransporter_la_SOURCES = \
SendBuffer.cpp \
TCP_Transporter.cpp \
TransporterRegistry.cpp \
- Packer.cpp \
- SHM_Transporter.cpp
+ Packer.cpp
+
+# SHM_Transporter.cpp
+
+INCLUDES_LOC = -I$(top_srcdir)/ndb/include/kernel -I$(top_srcdir)/ndb/include/transporter
include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_util.mk.am
-INCLUDES += -I$(top_srcdir)/ndb/include/kernel -I$(top_srcdir)/ndb/include/transporter
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/ndb/src/common/transporter/Transporter.hpp b/ndb/src/common/transporter/Transporter.hpp
index c562451a1b0..43b26d45899 100644
--- a/ndb/src/common/transporter/Transporter.hpp
+++ b/ndb/src/common/transporter/Transporter.hpp
@@ -17,6 +17,8 @@
#ifndef Transporter_H
#define Transporter_H
+#include <ndb_global.h>
+
#include <TransporterCallback.hpp>
#include "TransporterDefinitions.hpp"
#include "Packer.hpp"
diff --git a/ndb/src/common/util/new.cpp b/ndb/src/common/util/new.cpp
index 889e83edf6f..b61541b7474 100644
--- a/ndb/src/common/util/new.cpp
+++ b/ndb/src/common/util/new.cpp
@@ -5,6 +5,8 @@ extern "C" {
void (* ndb_new_handler)() = 0;
}
+#ifdef USE_MYSYS_NEW
+
void *operator new (size_t sz)
{
void * p = malloc (sz ? sz : 1);
@@ -36,3 +38,5 @@ void operator delete[] (void *ptr) throw ()
if (ptr)
free(ptr);
}
+
+#endif // USE_MYSYS_NEW
diff --git a/ndb/src/kernel/blocks/backup/restore/Makefile.am b/ndb/src/kernel/blocks/backup/restore/Makefile.am
index 1cc17a99a34..cf90587eda8 100644
--- a/ndb/src/kernel/blocks/backup/restore/Makefile.am
+++ b/ndb/src/kernel/blocks/backup/restore/Makefile.am
@@ -3,7 +3,7 @@ ndbtools_PROGRAMS = restore
restore_SOURCES = main.cpp Restore.cpp
-LDADD_LOC = $(top_srcdir)/ndb/src/ndbapi/libNDB_API.la
+LDADD_LOC = $(top_srcdir)/ndb/src/libndbclient.la
include $(top_srcdir)/ndb/config/common.mk.am
diff --git a/ndb/src/kernel/blocks/backup/restore/Restore.cpp b/ndb/src/kernel/blocks/backup/restore/Restore.cpp
index 2c3c1c8df7b..04f82ce91d0 100644
--- a/ndb/src/kernel/blocks/backup/restore/Restore.cpp
+++ b/ndb/src/kernel/blocks/backup/restore/Restore.cpp
@@ -101,42 +101,13 @@ RestoreMetaData::getStopGCP() const {
}
int
-RestoreMetaData::loadContent(const char * catalog,
- const char * schema)
+RestoreMetaData::loadContent()
{
-
-#if NDB_VERSION_MAJOR >= VERSION_3X
- if(getMajor(m_fileHeader.NdbVersion) < VERSION_3X) {
- if(catalog == NULL)
- return -1;
- if(schema == NULL)
- return -1;
- }
-
-
- /**
- * if backup is of version 3 or higher, then
- * return -2 to indicate for the user that he
- * cannot restore tables to a certain catalog/schema
- */
- if(getMajor(m_fileHeader.NdbVersion) >= VERSION_3X &&
- (catalog != NULL ||
- schema != NULL)) {
- return -2;
- }
-#endif
-#if NDB_VERSION_MAJOR < VERSION_3X
- if(getMajor(m_fileHeader.NdbVersion) >= VERSION_3X)
- {
- return -2;
- }
-#endif
-
Uint32 noOfTables = readMetaTableList();
if(noOfTables == 0)
return -3;
for(Uint32 i = 0; i<noOfTables; i++){
- if(!readMetaTableDesc(catalog, schema)){
+ if(!readMetaTableDesc()){
return 0;
}
}
@@ -170,8 +141,7 @@ RestoreMetaData::readMetaTableList() {
}
bool
-RestoreMetaData::readMetaTableDesc(const char * catalog,
- const char * schema) {
+RestoreMetaData::readMetaTableDesc() {
Uint32 sectionInfo[2];
@@ -198,10 +168,7 @@ RestoreMetaData::readMetaTableDesc(const char * catalog,
return false;
} // if
- return parseTableDescriptor(m_buffer,
- len,
- catalog,
- schema);
+ return parseTableDescriptor(m_buffer, len);
}
bool
@@ -287,72 +254,11 @@ static const Uint32
AttrMapSize = sizeof(RestoreAttrMap)
/ sizeof(SimpleProperties::SP2StructMapping);
-struct v2xKernel_to_v3xAPIMapping {
- Int32 kernelConstant;
- Int32 apiConstant;
-};
-
-enum v2xKernelTypes {
- ExtUndefined=0,// Undefined
- ExtInt, // 32 bit
- ExtUnsigned, // 32 bit
- ExtBigint, // 64 bit
- ExtBigunsigned,// 64 Bit
- ExtFloat, // 32-bit float
- ExtDouble, // 64-bit float
- ExtDecimal, // Precision, Scale
- ExtChar, // Len
- ExtVarchar, // Max len
- ExtBinary, // Len
- ExtVarbinary, // Max len
- ExtDatetime, // Precision down to 1 sec (sizeof(Datetime) == 8 bytes )
- ExtTimespec // Precision down to 1 nsec (sizeof(Datetime) == 12 bytes )
-};
-
-const
-v2xKernel_to_v3xAPIMapping
-columnTypeMapping[] = {
- { ExtInt, NdbDictionary::Column::Int },
- { ExtUnsigned, NdbDictionary::Column::Unsigned },
- { ExtBigint, NdbDictionary::Column::Bigint },
- { ExtBigunsigned, NdbDictionary::Column::Bigunsigned },
- { ExtFloat, NdbDictionary::Column::Float },
- { ExtDouble, NdbDictionary::Column::Double },
- { ExtDecimal, NdbDictionary::Column::Decimal },
- { ExtChar, NdbDictionary::Column::Char },
- { ExtVarchar, NdbDictionary::Column::Varchar },
- { ExtBinary, NdbDictionary::Column::Binary },
- { ExtVarbinary, NdbDictionary::Column::Varbinary },
- { ExtDatetime, NdbDictionary::Column::Datetime },
- { ExtTimespec, NdbDictionary::Column::Timespec },
- { -1, -1 }
-};
-
-static
-NdbDictionary::Column::Type
-convertToV3x(Int32 kernelConstant, const v2xKernel_to_v3xAPIMapping map[],
- Int32 def)
-{
- int i = 0;
- while(map[i].kernelConstant != kernelConstant){
- if(map[i].kernelConstant == -1 &&
- map[i].apiConstant == -1){
- return (NdbDictionary::Column::Type)def;
- }
- i++;
- }
- return (NdbDictionary::Column::Type)map[i].apiConstant;
-}
-
-
-
// Parse dictTabInfo buffer and pushback to to vector storage
// Using SimpleProperties (here we don't need ntohl, ref:ejonore)
bool
-RestoreMetaData::parseTableDescriptor(const Uint32 * data,
- Uint32 len,
- const char * catalog,
- const char * schema) {
+RestoreMetaData::parseTableDescriptor(const Uint32 * data, Uint32 len)
+{
SimplePropertiesLinearReader it(data, len);
SimpleProperties::UnpackStatus spStatus;
@@ -362,49 +268,9 @@ RestoreMetaData::parseTableDescriptor(const Uint32 * data,
return false;
} // if
- /**
- * if backup was taken in v21x then there is no info about catalog,
- * and schema. This infomration is concatenated to the tableName.
- *
- */
char tableName[MAX_TAB_NAME_SIZE*2]; // * 2 for db and schema.-.
-
+ it.getString(tableName);
- char tmpTableName[MAX_TAB_NAME_SIZE];
- it.getString(tmpTableName);
-#if NDB_VERSION_MAJOR >= VERSION_3X
- /**
- * only mess with name in version 3.
- */
- /* switch(getMajor(m_fileHeader.NdbVersion)) {
- */
- if(getMajor(m_fileHeader.NdbVersion) < VERSION_3X)
- {
-
- if(strcmp(tmpTableName, "SYSTAB_0") == 0 ||
- strcmp(tmpTableName, "NDB$EVENTS_0") == 0)
- {
- sprintf(tableName,"sys/def/%s",tmpTableName);
- }
- else {
- if(catalog == NULL && schema == NULL)
- {
- sprintf(tableName,"%s",tmpTableName);
- }
- else
- {
- sprintf(tableName,"%s/%s/%s",catalog,schema,tmpTableName);
- }
- }
- }
- else
- sprintf(tableName,"%s",tmpTableName);
-#elif NDB_VERSION_MAJOR < VERSION_3X
- /**
- * this is version two!
- */
- sprintf(tableName,"%s",tmpTableName);
-#endif
if (strlen(tableName) == 0) {
err << "readMetaTableDesc getString table name error" << endl;
return false;
@@ -505,35 +371,9 @@ RestoreMetaData::parseTableDescriptor(const Uint32 * data,
debug << " with " << table->getNoOfAttributes() << " attributes" << endl;
allTables.push_back(table);
-#ifndef restore_old_types
NdbTableImpl* tableImpl = 0;
- int ret = NdbDictInterface::parseTableInfo(&tableImpl, data, len);
-#if NDB_VERSION_MAJOR >= VERSION_3X
- NdbDictionary::Column::Type type;
- if(getMajor(m_fileHeader.NdbVersion) < VERSION_3X) {
- tableImpl->setName(tableName);
- Uint32 noOfColumns = tableImpl->getNoOfColumns();
- for(Uint32 i = 0 ; i < noOfColumns; i++) {
- type = convertToV3x(tableImpl->getColumn(i)->m_extType,
- columnTypeMapping,
- -1);
- if(type == -1)
- {
- ndbout_c("Restore: Was not able to map external type %d (in v2x) "
- " to a proper type in v3x", tableImpl->getColumn(i)->m_extType);
- return false;
- }
- else
- {
- tableImpl->getColumn(i)->m_type = type;
- }
-
-
+ int ret = NdbDictInterface::parseTableInfo(&tableImpl, data, len, false);
-
- }
- }
-#endif
if (ret != 0) {
err << "parseTableInfo " << tableName << " failed" << endl;
return false;
@@ -542,7 +382,7 @@ RestoreMetaData::parseTableDescriptor(const Uint32 * data,
return false;
debug << "parseTableInfo " << tableName << " done" << endl;
table->m_dictTable = tableImpl;
-#endif
+
return true;
}
diff --git a/ndb/src/kernel/blocks/backup/restore/Restore.hpp b/ndb/src/kernel/blocks/backup/restore/Restore.hpp
index cf5ad56e1da..c01fbf67593 100644
--- a/ndb/src/kernel/blocks/backup/restore/Restore.hpp
+++ b/ndb/src/kernel/blocks/backup/restore/Restore.hpp
@@ -26,9 +26,6 @@
#include <ndb_version.h>
#include <version.h>
-#define VERSION_3X 3
-
-
const int FileNameLenC = 256;
const int TableNameLenC = 256;
const int AttrNameLenC = 256;
@@ -148,11 +145,8 @@ class TableS {
const bool nullable,
const KeyType key);
-#ifndef restore_old_types
public:
class NdbDictionary::Table* m_dictTable;
-#endif
-public:
TableS (const char * name){
snprintf(tableName, sizeof(tableName), name);
m_noOfNullable = m_nullBitmaskSize = 0;
@@ -242,8 +236,7 @@ class RestoreMetaData : public BackupFile {
myVector<TableS *> allTables;
bool readMetaFileHeader();
- bool readMetaTableDesc(const char * catalog,
- const char * schema);
+ bool readMetaTableDesc();
bool readGCPEntry();
Uint32 readMetaTableList();
@@ -251,17 +244,14 @@ class RestoreMetaData : public BackupFile {
Uint32 m_startGCP;
Uint32 m_stopGCP;
- bool parseTableDescriptor(const Uint32 * data, Uint32 len,
- const char * catalog,
- const char * schema);
+ bool parseTableDescriptor(const Uint32 * data, Uint32 len);
public:
RestoreMetaData(const char * path, Uint32 nodeId, Uint32 bNo);
~RestoreMetaData();
- int loadContent(const char * catalog,
- const char * schema);
+ int loadContent();
diff --git a/ndb/src/kernel/blocks/backup/restore/main.cpp b/ndb/src/kernel/blocks/backup/restore/main.cpp
index ceb0c282e1d..1df82a7f055 100644
--- a/ndb/src/kernel/blocks/backup/restore/main.cpp
+++ b/ndb/src/kernel/blocks/backup/restore/main.cpp
@@ -72,10 +72,6 @@ typedef struct {
} restore_callback_t;
static const char* ga_connect_NDB = NULL;
-static const char* ga_schema = NULL;
-static const char* ga_catalog = NULL;
-
-
/**
* print and restore flags
@@ -209,18 +205,6 @@ readArguments(const int argc, const char** argv)
"No of parallel transactions during restore of data."
"(parallelism can be 1 to 1024)",
"Parallelism"},
-#if NDB_VERSION_MAJOR >= VERSION_3X
- { "catalog", 'd', arg_string, &ga_catalog,
- "Specifies the catalog/database where the data should be restored to. "
- "Restores only to backups taken with v.2.x and restored on >v.3.x "
- "systems. Note: system tables (if restored) defaults to sys/def/ ",
- "catalog"},
- { "schema", 's', arg_string, &ga_schema,
- "Specifies the schema where the data should be restored to."
- "Restores only to backups taken with v.2.x and restored on >v.3.x "
- "systems. Note: system tables (if restored) defaults to sys/def/ ",
- "schema"},
-#endif
#ifdef USE_MYSQL
{ "use_mysql", '\0', arg_flag, &use_mysql,
"Restore meta data via mysql. Systab will be ignored. Data is restored "
@@ -356,10 +340,6 @@ main(int argc, const char** argv)
{
return -1;
}
- // Turn off table name completion
-#if NDB_VERSION_MAJOR >= VERSION_3X
- Ndb::useFullyQualifiedNames(false);
-#endif
/**
* we must always load meta data, even if we will only print it to stdout
@@ -371,41 +351,19 @@ main(int argc, const char** argv)
return -1;
}
/**
- * check wheater we can restore the backup (right version, and if that
- * version needs catalog and schema specified.
+ * check wheater we can restore the backup (right version).
*/
- int res = metaData.loadContent(ga_catalog, ga_schema);
+ int res = metaData.loadContent();
- if (res == 0)
+ if (res == 0)
{
ndbout_c("Restore: Failed to load content");
return -1;
}
- if (res == -1)
- {
- ndbout_c("Restore: The backup is from a NDB Cluster v.2.x version. "
- "To restore this backup on a > 3.x version you must specify "
- "catalog and schema.");
- return -1;
- }
- if (res == -2)
- {
-#ifdef NDB_VERSION
- ndbout_c("Restore: The backup is from a NDB Cluster v.3.x version "
- "Catalog and schema are invalid parameters since they "
- "already exist implicitly.");
-#endif
-#ifdef NDB_KERNEL_VERSION
- ndbout_c("Restore: The backup is from a NDB Cluster v.3.x version "
- "It is not possible to restore a 3.x backup on v.2.x. ");
-#endif
- return -1;
- }
if (res == -3)
{
- ndbout_c("Restore: The backup contains no tables "
- "Catalog and schema are invalid parameters. ");
+ ndbout_c("Restore: The backup contains no tables ");
return -1;
}
@@ -882,10 +840,14 @@ BackupRestore::init()
Ndb::setConnectString(ga_connect_NDB);
}
- m_ndb = new Ndb("TEST_DB");
+ m_ndb = new Ndb();
+
if (m_ndb == NULL)
return false;
+ // Turn off table name completion
+ m_ndb->useFullyQualifiedNames(false);
+
m_ndb->init(1024);
if (m_ndb->waitUntilReady(30) != 0)
{
@@ -1109,7 +1071,6 @@ BackupRestore::table(const TableS & table){
{
return true;
}
-#ifndef restore_old_types
NdbDictionary::Dictionary* dict = m_ndb->getDictionary();
if (dict->createTable(*table.m_dictTable) == -1)
{
@@ -1119,81 +1080,6 @@ BackupRestore::table(const TableS & table){
}
info << "Successfully restored table " << table.getTableName()<< endl ;
return true;
-#else
- NdbSchemaCon * tableTransaction = 0;
- NdbSchemaOp * tableOp = 0;
-
- tableTransaction = m_ndb->startSchemaTransaction();
- if (tableTransaction == NULL)
- {
- err << table.getTableName()
- << " - BackupRestore::table cannot startSchemaTransaction: "
- << tableTransaction->getNdbError() << endl;
- return false;
- } // if
-
- tableOp = tableTransaction->getNdbSchemaOp();
- if (tableOp == NULL)
- {
- err << table.getTableName()
- << " - BackupRestore::table cannot getNdbSchemaOp: "
- << tableTransaction->getNdbError() << endl;
- m_ndb->closeSchemaTransaction(tableTransaction);
- return false;
- } // if
-
- // TODO: check for errors in table attributes. set aTupleKey
- int check = 0;
- check = tableOp->createTable(table.getTableName());
- // aTableSize = 8, Not used?
- // aTupleKey = TupleKey, go through attributes and check if there is a PK
- // and so on....
- if (check == -1)
- {
- err << table.getTableName()
- << " - BackupRestore::table cannot createTable: "
- << tableTransaction->getNdbError() << endl;
- m_ndb->closeSchemaTransaction(tableTransaction);
- return false;
- } // if
-
- // Create attributes from meta data
- for (int i = 0; i < table.getNoOfAttributes(); i++)
- {
- const AttributeDesc* desc = table[i];
- check = tableOp->createAttribute(desc->name, // Attr name
- desc->key, // Key type
- desc->size, // bits
- desc->arraySize,
- desc->type,
- MMBased, // only supported
- desc->nullable
- // Rest is don't care for the moment
- );
-
- if (check == -1)
- {
- err << table.getTableName()
- << " - RestoreDataIterator::createTable cannot createAttribute: "
- << tableTransaction->getNdbError() << endl;
- m_ndb->closeSchemaTransaction(tableTransaction);
- return false;
- } // if
- } // for
-
- if (tableTransaction->execute() == -1)
- {
- err << table.getTableName()
- << " - RestoreDataIterator::createTable cannot execute transaction: "
- << tableTransaction->getNdbError() << endl;
- m_ndb->closeSchemaTransaction(tableTransaction);
- return false;
- } // if
-
- m_ndb->closeSchemaTransaction(tableTransaction);
- info << "Successfully created table " << table.getTableName() << endl;
- return true ;
-#endif
}
@@ -1317,26 +1203,6 @@ void BackupRestore::tupleAsynch(const TupleS & tup, restore_callback_t * cbData)
Uint32 length = (size * arraySize) / 8;
if (key == TupleKey)
{
-#if NDB_VERSION_MAJOR >= VERSION3X
- /**
- * Convert VARCHAR from v.2x to v3x representation
- */
- if (getMajor(tup.getTable()->getBackupVersion()) < VERSION_3X &&
- ((tup.getTable()->m_dictTable->getColumn(i)->getType() ==
- NdbDictionary::Column::Varbinary ) ||
- (tup.getTable()->m_dictTable->getColumn(i)->getType() ==
- NdbDictionary::Column::Varchar)) && !attr->Data.null)
- {
- char * src = dataPtr;
- char var_len[2];
- var_len[0]= *(dataPtr+length - 2);
- var_len[1]= *(dataPtr+length - 1);
- memmove((char*)dataPtr+2, dataPtr, length);
- src[0] = var_len[0];
- src[1] = var_len[1];
- dataPtr = src;
- }
-#endif
ret = op->equal(i, dataPtr, length);
if (ret<0)
{
@@ -1361,48 +1227,21 @@ void BackupRestore::tupleAsynch(const TupleS & tup, restore_callback_t * cbData)
KeyType key = attr->Desc->key;
char * dataPtr = attr->Data.string_value;
Uint32 length = (size * arraySize) / 8;
-#if NDB_VERSION_MAJOR >= VERSION3X
- /**
- * Convert VARCHAR from v.2x to v3x representation
- */
- if (getMajor(tup.getTable()->getBackupVersion()) < VERSION_3X &&
- ((tup.getTable()->m_dictTable->getColumn(i)->getType() ==
- NdbDictionary::Column::Varbinary ) ||
- (tup.getTable()->m_dictTable->getColumn(i)->getType() ==
- NdbDictionary::Column::Varchar)) && !attr->Data.null)
- {
- char * src = dataPtr;
- char var_len[2];
- var_len[0]= *(dataPtr+length - 2);//length is last 2 bytes
- var_len[1]= *(dataPtr+length - 1);
- memmove((char*)dataPtr+2, dataPtr, length);
- src[0] = var_len[0];
- src[1] = var_len[1];
- dataPtr = src;
- }
-#endif
if (key == NoKey && !attr->Data.null)
- {
ret = op->setValue(i, dataPtr, length);
- }
else if (key == NoKey && attr->Data.null)
- {
ret = op->setValue(i, NULL, 0);
- }
if (ret<0)
{
ndbout_c("Column: %d type %d",i,
tup.getTable()->m_dictTable->getColumn(i)->getType());
-
if (asynchErrorHandler(asynchTrans[nPreparedTransactions], m_ndb))
{
retries++;
continue;
}
-
-
asynchExitHandler();
}
}
diff --git a/ndb/src/mgmapi/Makefile.am b/ndb/src/mgmapi/Makefile.am
index 758a874fca4..72b21ecfae0 100644
--- a/ndb/src/mgmapi/Makefile.am
+++ b/ndb/src/mgmapi/Makefile.am
@@ -1,5 +1,5 @@
-ndblib_LTLIBRARIES = libmgmapi.la libMGM_API.la
+noinst_LTLIBRARIES = libmgmapi.la libMGM_API.la
libmgmapi_la_SOURCES_loc = mgmapi.cpp
diff --git a/ndb/src/ndbapi/Makefile.am b/ndb/src/ndbapi/Makefile.am
index 1c474d26cb0..3f585be74c6 100644
--- a/ndb/src/ndbapi/Makefile.am
+++ b/ndb/src/ndbapi/Makefile.am
@@ -1,6 +1,6 @@
#SUBDIRS = signal-sender
-ndblib_LTLIBRARIES = libndbapi.la libNDB_API.la
+noinst_LTLIBRARIES = libndbapi.la libNDB_API.la
libndbapi_la_SOURCES_loc = \
TransporterFacade.cpp \
diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp
index fe21b4e02a4..20400bd4371 100644
--- a/ndb/src/ndbapi/Ndb.cpp
+++ b/ndb/src/ndbapi/Ndb.cpp
@@ -38,8 +38,6 @@ Name: Ndb.cpp
#include <NdbEnv.h>
#include <BaseString.hpp>
-static bool fullyQualifiedNames = true;
-
/****************************************************************************
void connect();
@@ -1019,10 +1017,10 @@ void Ndb::setCatalogName(const char * a_catalog_name)
uint schema_len =
MIN(strlen(theDataBaseSchema), NDB_MAX_SCHEMA_NAME_SIZE - 1);
strncpy(prefixName, theDataBase, NDB_MAX_DATABASE_NAME_SIZE - 1);
- prefixName[db_len] = '/';
+ prefixName[db_len] = table_name_separator;
strncpy(prefixName+db_len+1, theDataBaseSchema,
NDB_MAX_SCHEMA_NAME_SIZE - 1);
- prefixName[db_len+schema_len+1] = '/';
+ prefixName[db_len+schema_len+1] = table_name_separator;
prefixName[db_len+schema_len+2] = '\0';
prefixEnd = prefixName + db_len+schema_len + 2;
}
@@ -1042,10 +1040,10 @@ void Ndb::setSchemaName(const char * a_schema_name)
uint schema_len =
MIN(strlen(theDataBaseSchema), NDB_MAX_SCHEMA_NAME_SIZE - 1);
strncpy(prefixName, theDataBase, NDB_MAX_DATABASE_NAME_SIZE - 1);
- prefixName[db_len] = '/';
+ prefixName[db_len] = table_name_separator;
strncpy(prefixName+db_len+1, theDataBaseSchema,
NDB_MAX_SCHEMA_NAME_SIZE - 1);
- prefixName[db_len+schema_len+1] = '/';
+ prefixName[db_len+schema_len+1] = table_name_separator;
prefixName[db_len+schema_len+2] = '\0';
prefixEnd = prefixName + db_len+schema_len + 2;
}
@@ -1085,43 +1083,36 @@ bool Ndb::usingFullyQualifiedNames()
}
const char *
-Ndb::externalizeTableName(const char * internalTableName)
+Ndb::externalizeTableName(const char * internalTableName, bool fullyQualifiedNames)
{
if (fullyQualifiedNames) {
register const char *ptr = internalTableName;
// Skip database name
- while (*ptr && *ptr++ != '/');
+ while (*ptr && *ptr++ != table_name_separator);
// Skip schema name
- while (*ptr && *ptr++ != '/');
-
+ while (*ptr && *ptr++ != table_name_separator);
return ptr;
}
else
return internalTableName;
}
-
const char *
-Ndb::internalizeTableName(const char * externalTableName)
+Ndb::externalizeTableName(const char * internalTableName)
{
- if (fullyQualifiedNames) {
- strncpy(prefixEnd, externalTableName, NDB_MAX_TAB_NAME_SIZE);
- return prefixName;
- }
- else
- return externalTableName;
+ return externalizeTableName(internalTableName, usingFullyQualifiedNames());
}
-
+
const char *
-Ndb::externalizeIndexName(const char * internalIndexName)
+Ndb::externalizeIndexName(const char * internalIndexName, bool fullyQualifiedNames)
{
if (fullyQualifiedNames) {
register const char *ptr = internalIndexName;
// Scan name from the end
while (*ptr++); ptr--; // strend
- while (ptr >= internalIndexName && *ptr != '/')
+ while (ptr >= internalIndexName && *ptr != table_name_separator)
ptr--;
return ptr + 1;
@@ -1129,6 +1120,23 @@ Ndb::externalizeIndexName(const char * internalIndexName)
else
return internalIndexName;
}
+
+const char *
+Ndb::externalizeIndexName(const char * internalIndexName)
+{
+ return externalizeIndexName(internalIndexName, usingFullyQualifiedNames());
+}
+
+const char *
+Ndb::internalizeTableName(const char * externalTableName)
+{
+ if (fullyQualifiedNames) {
+ strncpy(prefixEnd, externalTableName, NDB_MAX_TAB_NAME_SIZE);
+ return prefixName;
+ }
+ else
+ return externalTableName;
+}
const char *
Ndb::internalizeIndexName(const NdbTableImpl * table,
@@ -1139,7 +1147,7 @@ Ndb::internalizeIndexName(const NdbTableImpl * table,
sprintf(tableId, "%d", table->m_tableId);
Uint32 tabIdLen = strlen(tableId);
strncpy(prefixEnd, tableId, tabIdLen);
- prefixEnd[tabIdLen] = '/';
+ prefixEnd[tabIdLen] = table_name_separator;
strncpy(prefixEnd + tabIdLen + 1,
externalIndexName, NDB_MAX_TAB_NAME_SIZE);
return prefixName;
@@ -1155,8 +1163,8 @@ Ndb::getDatabaseFromInternalName(const char * internalName)
strcpy(databaseName, internalName);
register char *ptr = databaseName;
- /* Scan name for the first '/' */
- while (*ptr && *ptr != '/')
+ /* Scan name for the first table_name_separator */
+ while (*ptr && *ptr != table_name_separator)
ptr++;
*ptr = '\0';
BaseString ret = BaseString(databaseName);
@@ -1170,12 +1178,12 @@ Ndb::getSchemaFromInternalName(const char * internalName)
char * schemaName = new char[strlen(internalName)];
register const char *ptr1 = internalName;
- /* Scan name for the second '/' */
- while (*ptr1 && *ptr1 != '/')
+ /* Scan name for the second table_name_separator */
+ while (*ptr1 && *ptr1 != table_name_separator)
ptr1++;
strcpy(schemaName, ptr1 + 1);
register char *ptr = schemaName;
- while (*ptr && *ptr != '/')
+ while (*ptr && *ptr != table_name_separator)
ptr++;
*ptr = '\0';
BaseString ret = BaseString(schemaName);
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
index 3b31fa70e35..25726dbf2ac 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
@@ -621,7 +621,7 @@ NdbDictionaryImpl::getIndexTable(NdbIndexImpl * index,
const char * internalName =
m_ndb.internalizeIndexName(table, index->getName());
- return getTable(Ndb::externalizeTableName(internalName));
+ return getTable(m_ndb.externalizeTableName(internalName));
}
bool
@@ -862,7 +862,7 @@ NdbDictInterface::dictSignal(NdbApiSignal* signal,
* get tab info
*/
NdbTableImpl *
-NdbDictInterface::getTable(int tableId)
+NdbDictInterface::getTable(int tableId, bool fullyQualifiedNames)
{
NdbApiSignal tSignal(m_reference);
GetTabInfoReq * const req = CAST_PTR(GetTabInfoReq, tSignal.getDataPtrSend());
@@ -876,11 +876,11 @@ NdbDictInterface::getTable(int tableId)
tSignal.theVerId_signalNumber = GSN_GET_TABINFOREQ;
tSignal.theLength = GetTabInfoReq::SignalLength;
- return getTable(&tSignal, 0, 0);
+ return getTable(&tSignal, 0, 0, fullyQualifiedNames);
}
NdbTableImpl *
-NdbDictInterface::getTable(const char * name)
+NdbDictInterface::getTable(const char * name, bool fullyQualifiedNames)
{
NdbApiSignal tSignal(m_reference);
GetTabInfoReq * const req = CAST_PTR(GetTabInfoReq, tSignal.getDataPtrSend());
@@ -904,13 +904,13 @@ NdbDictInterface::getTable(const char * name)
ptr[0].p = (Uint32*)name;
ptr[0].sz = strLen;
- return getTable(&tSignal, ptr, 1);
+ return getTable(&tSignal, ptr, 1, fullyQualifiedNames);
}
NdbTableImpl *
NdbDictInterface::getTable(class NdbApiSignal * signal,
LinearSectionPtr ptr[3],
- Uint32 noOfSections)
+ Uint32 noOfSections, bool fullyQualifiedNames)
{
//GetTabInfoReq * const req = CAST_PTR(GetTabInfoReq, signal->getDataPtrSend());
int r = dictSignal(signal,ptr,noOfSections,
@@ -924,7 +924,7 @@ NdbDictInterface::getTable(class NdbApiSignal * signal,
NdbTableImpl * rt = 0;
m_error.code = parseTableInfo(&rt,
(Uint32*)m_buffer.get_data(),
- m_buffer.length() / 4);
+ m_buffer.length() / 4, fullyQualifiedNames);
rt->buildColumnHash();
return rt;
}
@@ -1081,7 +1081,8 @@ columnTypeMapping[] = {
int
NdbDictInterface::parseTableInfo(NdbTableImpl ** ret,
- const Uint32 * data, Uint32 len)
+ const Uint32 * data, Uint32 len,
+ bool fullyQualifiedNames)
{
SimplePropertiesLinearReader it(data, len);
DictTabInfo::Table tableDesc; tableDesc.init();
@@ -1095,7 +1096,7 @@ NdbDictInterface::parseTableInfo(NdbTableImpl ** ret,
return 703;
}
const char * internalName = tableDesc.TableName;
- const char * externalName = Ndb::externalizeTableName(internalName);
+ const char * externalName = Ndb::externalizeTableName(internalName, fullyQualifiedNames);
NdbTableImpl * impl = new NdbTableImpl();
impl->m_tableId = tableDesc.TableId;
@@ -1124,7 +1125,7 @@ NdbDictInterface::parseTableInfo(NdbTableImpl ** ret,
if(impl->m_indexType == NdbDictionary::Index::Undefined){
} else {
const char * externalPrimary =
- Ndb::externalizeTableName(tableDesc.PrimaryTable);
+ Ndb::externalizeTableName(tableDesc.PrimaryTable, fullyQualifiedNames);
impl->m_primaryTable.assign(externalPrimary);
}
@@ -1866,7 +1867,7 @@ int
NdbDictionaryImpl::dropIndex(NdbIndexImpl & impl, const char * tableName)
{
const char * indexName = impl.getName();
- if (tableName || Ndb::usingFullyQualifiedNames()) {
+ if (tableName || m_ndb.usingFullyQualifiedNames()) {
NdbTableImpl * timpl = impl.m_table;
if (timpl == 0) {
@@ -2571,14 +2572,13 @@ NdbDictionaryImpl::listObjects(List& list, NdbDictionary::Object::Type type)
req.requestData = 0;
req.setTableType(getKernelConstant(type, objectTypeMapping, 0));
req.setListNames(true);
- return m_receiver.listObjects(list, req.requestData);
+ return m_receiver.listObjects(list, req.requestData, m_ndb.usingFullyQualifiedNames());
}
int
NdbDictionaryImpl::listIndexes(List& list, const char * tableName)
{
- ListTablesReq
- req;
+ ListTablesReq req;
NdbTableImpl* impl = getTable(tableName);
if (impl == 0)
return -1;
@@ -2586,12 +2586,12 @@ NdbDictionaryImpl::listIndexes(List& list, const char * tableName)
req.setTableId(impl->m_tableId);
req.setListNames(true);
req.setListIndexes(true);
- return m_receiver.listObjects(list, req.requestData);
+ return m_receiver.listObjects(list, req.requestData, m_ndb.usingFullyQualifiedNames());
}
int
NdbDictInterface::listObjects(NdbDictionary::Dictionary::List& list,
- Uint32 requestData)
+ Uint32 requestData, bool fullyQualifiedNames)
{
NdbApiSignal tSignal(m_reference);
ListTablesReq* const req = CAST_PTR(ListTablesReq, tSignal.getDataPtrSend());
@@ -2656,7 +2656,7 @@ NdbDictInterface::listObjects(NdbDictionary::Dictionary::List& list,
memcpy(indexName, &data[pos], n << 2);
databaseName = Ndb::getDatabaseFromInternalName(indexName);
schemaName = Ndb::getSchemaFromInternalName(indexName);
- objectName = BaseString(Ndb::externalizeIndexName(indexName));
+ objectName = BaseString(Ndb::externalizeIndexName(indexName, fullyQualifiedNames));
delete [] indexName;
} else if ((element.type == NdbDictionary::Object::SystemTable) ||
(element.type == NdbDictionary::Object::UserTable)) {
@@ -2664,7 +2664,7 @@ NdbDictInterface::listObjects(NdbDictionary::Dictionary::List& list,
memcpy(tableName, &data[pos], n << 2);
databaseName = Ndb::getDatabaseFromInternalName(tableName);
schemaName = Ndb::getSchemaFromInternalName(tableName);
- objectName = BaseString(Ndb::externalizeTableName(tableName));
+ objectName = BaseString(Ndb::externalizeTableName(tableName, fullyQualifiedNames));
delete [] tableName;
}
else {
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.hpp b/ndb/src/ndbapi/NdbDictionaryImpl.hpp
index 3263a636a79..b10ec099593 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.hpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.hpp
@@ -283,17 +283,18 @@ public:
int stopSubscribeEvent(class Ndb & ndb, NdbEventImpl &);
int stopSubscribeEvent(NdbApiSignal* signal, LinearSectionPtr ptr[3]);
- int listObjects(NdbDictionary::Dictionary::List& list, Uint32 requestData);
+ int listObjects(NdbDictionary::Dictionary::List& list, Uint32 requestData, bool fullyQualifiedNames);
int listObjects(NdbApiSignal* signal);
- NdbTableImpl * getTable(int tableId);
- NdbTableImpl * getTable(const char * name);
+ NdbTableImpl * getTable(int tableId, bool fullyQualifiedNames);
+ NdbTableImpl * getTable(const char * name, bool fullyQualifiedNames);
NdbTableImpl * getTable(class NdbApiSignal * signal,
LinearSectionPtr ptr[3],
- Uint32 noOfSections);
+ Uint32 noOfSections, bool fullyQualifiedNames);
static int parseTableInfo(NdbTableImpl ** dst,
- const Uint32 * data, Uint32 len);
+ const Uint32 * data, Uint32 len,
+ bool fullyQualifiedNames);
NdbError & m_error;
private:
@@ -601,7 +602,7 @@ NdbDictionaryImpl::getTableImpl(const char * internalTableName)
m_globalHash->unlock();
if (ret == 0){
- ret = m_receiver.getTable(internalTableName);
+ ret = m_receiver.getTable(internalTableName, m_ndb.usingFullyQualifiedNames());
m_globalHash->lock();
m_globalHash->put(internalTableName, ret);
@@ -624,7 +625,7 @@ NdbIndexImpl *
NdbDictionaryImpl::getIndex(const char * indexName,
const char * tableName)
{
- if (tableName || Ndb::usingFullyQualifiedNames()) {
+ if (tableName || m_ndb.usingFullyQualifiedNames()) {
const char * internalIndexName = 0;
if (tableName) {
NdbTableImpl * t = getTable(tableName);
diff --git a/ndb/src/ndbapi/Ndbinit.cpp b/ndb/src/ndbapi/Ndbinit.cpp
index 042faa431a0..b1b42a553fd 100644
--- a/ndb/src/ndbapi/Ndbinit.cpp
+++ b/ndb/src/ndbapi/Ndbinit.cpp
@@ -15,6 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#include <ndb_global.h>
+
#include "NdbApiSignal.hpp"
#include "NdbImpl.hpp"
//#include "NdbSchemaOp.hpp"
@@ -92,6 +94,8 @@ Ndb::Ndb( const char* aDataBase , const char* aDataBaseSchema) :
theNdbBlockNumber(-1),
theInitState(NotConstructed)
{
+ fullyQualifiedNames = true;
+
cgetSignals =0;
cfreeSignals = 0;
cnewSignals = 0;
@@ -126,10 +130,10 @@ Ndb::Ndb( const char* aDataBase , const char* aDataBaseSchema) :
uint schema_len =
MIN(strlen(theDataBaseSchema), NDB_MAX_SCHEMA_NAME_SIZE - 1);
strncpy(prefixName, theDataBase, NDB_MAX_DATABASE_NAME_SIZE - 1);
- prefixName[db_len] = '/';
+ prefixName[db_len] = table_name_separator;
strncpy(prefixName+db_len+1, theDataBaseSchema,
NDB_MAX_SCHEMA_NAME_SIZE - 1);
- prefixName[db_len+schema_len+1] = '/';
+ prefixName[db_len+schema_len+1] = table_name_separator;
prefixName[db_len+schema_len+2] = '\0';
prefixEnd = prefixName + db_len+schema_len + 2;
diff --git a/ndb/src/rep/adapters/AppNDB.cpp b/ndb/src/rep/adapters/AppNDB.cpp
index abb146d921f..05f6d52807f 100644
--- a/ndb/src/rep/adapters/AppNDB.cpp
+++ b/ndb/src/rep/adapters/AppNDB.cpp
@@ -50,9 +50,10 @@ void
AppNDB::init(const char* connectString) {
// NdbThread_SetConcurrencyLevel(1+ 2);
- Ndb::useFullyQualifiedNames(false);
-
m_ndb = new Ndb("");
+
+ m_ndb->useFullyQualifiedNames(false);
+
m_ndb->setConnectString(connectString);
/**
* @todo Set proper max no of transactions?? needed?? Default 12??
@@ -539,7 +540,8 @@ AppNDB::prepareMetaRecord(MetaRecord* mr) {
NdbTableImpl * tmp = 0;
NdbDictionary::Table * table =0;
Uint32 * data =(Uint32*)( ((char*)mr + sizeof(Uint32)*6));
- int res = NdbDictInterface::parseTableInfo(&tmp, data, mr->dataLen);
+ int res = NdbDictInterface::parseTableInfo(&tmp, data, mr->dataLen,
+ m_ndb->usingFullyQualifiedNames());
if(res == 0) {
table = tmp;
return table;
diff --git a/ndb/src/rep/state/Channel.cpp b/ndb/src/rep/state/Channel.cpp
index 1d573bad2f5..a7f7b90d3fe 100644
--- a/ndb/src/rep/state/Channel.cpp
+++ b/ndb/src/rep/state/Channel.cpp
@@ -273,7 +273,7 @@ Channel::addTable(const char * tableName)
if(strlen(tableName)>MAX_TAB_NAME_SIZE)
return GrepError::REP_NOT_PROPER_TABLE;
/**
- * No of separators are the number of '/' found in tableName
+ * No of separators are the number of table_name_separator found in tableName
* since a table is defined as <db>/<schema>/tablename.
* if noOfSeparators is not equal to 2, then it is not a valid
* table name.
@@ -282,7 +282,7 @@ Channel::addTable(const char * tableName)
if(strlen(tableName) < 5)
return GrepError::REP_NOT_PROPER_TABLE;
for(Uint32 i =0; i < strlen(tableName); i++)
- if(tableName[i]=='/')
+ if(tableName[i]==table_name_separator)
noOfSeps++;
if(noOfSeps!=2)
return GrepError::REP_NOT_PROPER_TABLE;
@@ -301,7 +301,7 @@ Channel::removeTable(const char * tableName)
if(strlen(tableName)>MAX_TAB_NAME_SIZE)
return GrepError::REP_NOT_PROPER_TABLE;
/**
- * No of separators are the number of '/' found in tableName
+ * No of separators are the number of table_name_separator found in tableName
* since a table is defined as <db>/<schema>/tablename.
* If noOfSeparators is not equal to 2,
* then it is not a valid table name.
@@ -310,7 +310,7 @@ Channel::removeTable(const char * tableName)
if(strlen(tableName) < 5)
return GrepError::REP_NOT_PROPER_TABLE;
for(Uint32 i =0; i < strlen(tableName); i++)
- if(tableName[i]=='/')
+ if(tableName[i]==table_name_separator)
noOfSeps++;
if(noOfSeps!=2)
return GrepError::REP_NOT_PROPER_TABLE;
diff --git a/ndb/test/ndbapi/testGrepVerify.cpp b/ndb/test/ndbapi/testGrepVerify.cpp
index 7fd2c19d9f7..05445c1ba1b 100644
--- a/ndb/test/ndbapi/testGrepVerify.cpp
+++ b/ndb/test/ndbapi/testGrepVerify.cpp
@@ -74,16 +74,13 @@ int main(int argc, const char** argv){
if(table == 0)
return NDBT_ProgramExit(NDBT_WRONGARGS);
- Ndb::useFullyQualifiedNames(false);
-
Ndb * m_ndb = new Ndb("");
+ m_ndb->useFullyQualifiedNames(false);
m_ndb->setConnectString(connectString);
- Ndb::useFullyQualifiedNames(false);
/**
* @todo Set proper max no of transactions?? needed?? Default 12??
*/
m_ndb->init(2048);
- Ndb::useFullyQualifiedNames(false);
if (m_ndb->waitUntilReady() != 0){
ndbout_c("NDB Cluster not ready for connections");
}
diff --git a/ndb/tools/listTables.cpp b/ndb/tools/listTables.cpp
index 41433862304..bddf61848e8 100644
--- a/ndb/tools/listTables.cpp
+++ b/ndb/tools/listTables.cpp
@@ -30,6 +30,7 @@
static Ndb* ndb = 0;
static NdbDictionary::Dictionary* dic = 0;
+static int _unqualified = 0;
static void
fatal(char const* fmt, ...)
@@ -59,7 +60,7 @@ list(const char * tabname,
if (dic->listIndexes(list, tabname) == -1)
fatal("listIndexes");
}
- if (Ndb::usingFullyQualifiedNames())
+ if (ndb->usingFullyQualifiedNames())
ndbout_c("%-5s %-20s %-8s %-7s %-12s %-8s %s", "id", "type", "state", "logging", "database", "schema", "name");
else
ndbout_c("%-5s %-20s %-8s %-7s %s", "id", "type", "state", "logging", "name");
@@ -137,7 +138,7 @@ list(const char * tabname,
break;
}
}
- if (Ndb::usingFullyQualifiedNames())
+ if (ndb->usingFullyQualifiedNames())
ndbout_c("%-5d %-20s %-8s %-7s %-12s %-8s %s", elt.id, type, state, store, (elt.database)?elt.database:"", (elt.schema)?elt.schema:"", elt.name);
else
ndbout_c("%-5d %-20s %-8s %-7s %s", elt.id, type, state, store, elt.name);
@@ -148,7 +149,6 @@ int main(int argc, const char** argv){
int _loops = 1;
const char* _tabname = NULL;
const char* _dbname = "TEST_DB";
- int _unqualified = 0;
int _type = 0;
int _help = 0;