From 67fc4591305a9d2fb430a3792833cb2d7b60e9d9 Mon Sep 17 00:00:00 2001
From: "tomas@mc05.(none)" <>
Date: Wed, 19 May 2004 11:17:24 +0200
Subject: [PATCH 01/24] removed global variable fullyQualifiedNames

---
 ndb/include/ndb_global.h                      |  2 +
 ndb/include/ndbapi/Ndb.hpp                    |  8 +-
 ndb/src/common/portlib/unix/NdbThread.c       |  2 +-
 ndb/src/ndbapi/Ndb.cpp                        | 76 ++++++++++---------
 ndb/src/ndbapi/NdbDictionaryImpl.cpp          | 36 ++++-----
 ndb/src/ndbapi/NdbDictionaryImpl.hpp          | 15 ++--
 ndb/src/ndbapi/Ndbinit.cpp                    |  8 +-
 ndb/src/rep/adapters/AppNDB.cpp               |  8 +-
 ndb/src/rep/state/Channel.cpp                 |  8 +-
 .../ndbapi/testGrep/verify/testGrepVerify.cpp |  5 +-
 ndb/tools/list_tables/listTables.cpp          |  6 +-
 11 files changed, 96 insertions(+), 78 deletions(-)

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 fd6e827ceb4..e7f0336c863 100644
--- a/ndb/include/ndbapi/Ndb.hpp
+++ b/ndb/include/ndbapi/Ndb.hpp
@@ -1384,9 +1384,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();
 
   /** @} *********************************************************************/
 
@@ -1558,10 +1558,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);
@@ -1598,6 +1600,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/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/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp
index a9d90c768dd..28b32dc8341 100644
--- a/ndb/src/ndbapi/Ndb.cpp
+++ b/ndb/src/ndbapi/Ndb.cpp
@@ -40,8 +40,6 @@ Name:          Ndb.cpp
 #include <NdbEnv.h>
 #include <BaseString.hpp>
 
-static bool fullyQualifiedNames = true;
-
 /****************************************************************************
 void connect();
 
@@ -1020,10 +1018,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;
   }
@@ -1043,10 +1041,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;
   }
@@ -1086,22 +1084,49 @@ 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::externalizeTableName(const char * internalTableName)
+{
+  return externalizeTableName(internalTableName, usingFullyQualifiedNames());
+}
+
+const char *
+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 != table_name_separator)
+      ptr--;
+     
+    return ptr + 1;
+  }
+  else
+    return internalIndexName;
+}
+
+const char *
+Ndb::externalizeIndexName(const char * internalIndexName)
+{
+  return externalizeIndexName(internalIndexName, usingFullyQualifiedNames());
+}
 
 const char *
 Ndb::internalizeTableName(const char * externalTableName)
@@ -1114,23 +1139,6 @@ Ndb::internalizeTableName(const char * externalTableName)
     return externalTableName;
 }
  
-const char *
-Ndb::externalizeIndexName(const char * internalIndexName)
-{
-  if (fullyQualifiedNames) {
-    register const char *ptr = internalIndexName;
-   
-    // Scan name from the end
-    while (*ptr++); ptr--; // strend
-    while (ptr >= internalIndexName && *ptr != '/')
-      ptr--;
-     
-    return ptr + 1;
-  }
-  else
-    return internalIndexName;
-}
- 
 const char *
 Ndb::internalizeIndexName(const NdbTableImpl * table,
                           const char * externalIndexName)
@@ -1140,7 +1148,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;
@@ -1156,8 +1164,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);
@@ -1171,12 +1179,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 02e3ee23f9c..041471a1a05 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
@@ -622,7 +622,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
@@ -863,7 +863,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());
@@ -877,11 +877,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());
@@ -905,13 +905,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,
@@ -925,7 +925,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;
 }
@@ -1082,7 +1082,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();
@@ -1096,7 +1097,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;
@@ -1125,7 +1126,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);
   }
   
@@ -1867,7 +1868,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) {
@@ -2572,14 +2573,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;
@@ -2587,12 +2587,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());
@@ -2657,7 +2657,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)) {
@@ -2665,7 +2665,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 be7acc48d7a..69df2655697 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/testGrep/verify/testGrepVerify.cpp b/ndb/test/ndbapi/testGrep/verify/testGrepVerify.cpp
index 7fd2c19d9f7..05445c1ba1b 100644
--- a/ndb/test/ndbapi/testGrep/verify/testGrepVerify.cpp
+++ b/ndb/test/ndbapi/testGrep/verify/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/list_tables/listTables.cpp b/ndb/tools/list_tables/listTables.cpp
index 41433862304..bddf61848e8 100644
--- a/ndb/tools/list_tables/listTables.cpp
+++ b/ndb/tools/list_tables/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;
   

From 92c15122da1c40a460b425ff768cf39ebad57238 Mon Sep 17 00:00:00 2001
From: "monty@mysql.com" <>
Date: Wed, 26 May 2004 00:01:23 +0300
Subject: [PATCH 02/24] Added new header files

---
 include/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/Makefile.am b/include/Makefile.am
index 4b881d0e7ed..bd1492766b1 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -25,7 +25,7 @@ pkginclude_HEADERS =	my_dbug.h m_string.h my_sys.h my_list.h \
 noinst_HEADERS =	config-win.h config-os2.h config-netware.h \
 			nisam.h heap.h merge.h my_bitmap.h\
 			myisam.h myisampack.h myisammrg.h ft_global.h\
-			mysys_err.h my_base.h \
+			mysys_err.h my_base.h help_start.h help_end.h \
 			my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \
 			my_aes.h my_tree.h hash.h thr_alarm.h \
 			thr_lock.h t_ctype.h violite.h md5.h mysql_version.h.in

From 9a5dafba83c9135656727ab9e3236703fe49361d Mon Sep 17 00:00:00 2001
From: "marko@hundin.mysql.fi" <>
Date: Wed, 26 May 2004 10:45:37 +0300
Subject: [PATCH 03/24] InnoDB cleanup: Remove unused code for online backup

---
 innobase/include/log0log.h  |  35 -------
 innobase/include/log0log.ic |  36 +------
 innobase/include/mtr0mtr.h  |  12 +--
 innobase/log/log0log.c      |  64 ------------
 innobase/log/log0recv.c     |  13 +--
 innobase/mtr/mtr0mtr.c      | 199 +-----------------------------------
 6 files changed, 8 insertions(+), 351 deletions(-)

diff --git a/innobase/include/log0log.h b/innobase/include/log0log.h
index 6eef8144c27..c17998032ce 100644
--- a/innobase/include/log0log.h
+++ b/innobase/include/log0log.h
@@ -114,20 +114,6 @@ dulint
 log_get_lsn(void);
 /*=============*/
 			/* out: current lsn */
-/****************************************************************************
-Gets the online backup lsn. */
-UNIV_INLINE
-dulint
-log_get_online_backup_lsn_low(void);
-/*===============================*/
-/****************************************************************************
-Gets the online backup state. */
-UNIV_INLINE
-ibool
-log_get_online_backup_state_low(void);
-/*=================================*/
-				/* out: online backup state, the caller must
-				own the log_sys mutex */
 /**********************************************************
 Initializes the log. */
 
@@ -326,20 +312,6 @@ log_archived_file_name_gen(
 	char*	buf,	/* in: buffer where to write */
 	ulint	id,	/* in: group id */
 	ulint	file_no);/* in: file number */
-/**********************************************************
-Switches the database to the online backup state. */
-
-ulint
-log_switch_backup_state_on(void);
-/*============================*/
-			/* out: DB_SUCCESS or DB_ERROR */
-/**********************************************************
-Switches the online backup state off. */
-
-ulint
-log_switch_backup_state_off(void);
-/*=============================*/
-			/* out: DB_SUCCESS or DB_ERROR */
 /************************************************************************
 Checks that there is enough free space in the log to start a new query step.
 Flushes the log buffer or makes a new checkpoint if necessary. NOTE: this
@@ -871,13 +843,6 @@ struct log_struct{
 	os_event_t	archiving_on;	/* if archiving has been stopped,
 					a thread can wait for this event to
 					become signaled */
-	/* Fields involved in online backups */
-	ibool		online_backup_state;
-					/* TRUE if the database is in the
-					online backup state */
-	dulint		online_backup_lsn;
-					/* lsn when the state was changed to
-					the online backup state */
 };
 
 #define LOG_ARCH_ON		71
diff --git a/innobase/include/log0log.ic b/innobase/include/log0log.ic
index 6e32a45cdc5..c38e5fe2b9c 100644
--- a/innobase/include/log0log.ic
+++ b/innobase/include/log0log.ic
@@ -318,8 +318,7 @@ log_reserve_and_write_fast(
 
 	data_len = len + log->buf_free % OS_FILE_LOG_BLOCK_SIZE;
 
-	if (log->online_backup_state
-	    || (data_len >= OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE)) {
+	if (data_len >= OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE) {
 
 	    	/* The string does not fit within the current log block
 	    	or the log block would become full */
@@ -403,36 +402,3 @@ log_free_check(void)
 		log_check_margins();
 	}
 }
-
-/****************************************************************************
-Gets the online backup lsn. */
-UNIV_INLINE
-dulint
-log_get_online_backup_lsn_low(void)
-/*===============================*/
-				/* out: online_backup_lsn, the caller must
-				own the log_sys mutex */
-{
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
-	ut_ad(log_sys->online_backup_state);
-
-	return(log_sys->online_backup_lsn);
-}
-
-/****************************************************************************
-Gets the online backup state. */
-UNIV_INLINE
-ibool
-log_get_online_backup_state_low(void)
-/*=================================*/
-				/* out: online backup state, the caller must
-				own the log_sys mutex */
-{
-#ifdef UNIV_SYNC_DEBUG
-	ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
-
-	return(log_sys->online_backup_state);
-}
diff --git a/innobase/include/mtr0mtr.h b/innobase/include/mtr0mtr.h
index 6117927504f..e693b88680e 100644
--- a/innobase/include/mtr0mtr.h
+++ b/innobase/include/mtr0mtr.h
@@ -82,7 +82,7 @@ flag value must give the length also! */
 						predefined minimum record */
 #define MLOG_IBUF_BITMAP_INIT	((byte)27)	/* initialize an ibuf bitmap
 						page */
-#define	MLOG_FULL_PAGE		((byte)28)	/* full contents of a page */
+/*#define	MLOG_FULL_PAGE	((byte)28)	full contents of a page */
 #define MLOG_INIT_FILE_PAGE	((byte)29)	/* this means that a file page
 						is taken into use and the prior
 						contents of the page should be
@@ -230,16 +230,6 @@ mtr_memo_release(
 	mtr_t*	mtr,	/* in: mtr */
 	void*	object,	/* in: object */
 	ulint	type);	/* in: object type: MTR_MEMO_S_LOCK, ... */
-/****************************************************************
-Parses a log record which contains the full contents of a page. */
-
-byte*
-mtr_log_parse_full_page(
-/*====================*/
-			/* out: end of log record or NULL */
-	byte*	ptr,	/* in: buffer */
-	byte*	end_ptr,/* in: buffer end */
-	page_t*	page);	/* in: page or NULL */
 /**************************************************************
 Checks if memo contains the given item. */
 UNIV_INLINE
diff --git a/innobase/log/log0log.c b/innobase/log/log0log.c
index b058a65ce6e..a6c4ed598a4 100644
--- a/innobase/log/log0log.c
+++ b/innobase/log/log0log.c
@@ -793,11 +793,7 @@ log_init(void)
 	log_sys->archiving_on = os_event_create(NULL);
 
 	/*----------------------------*/
-	
-	log_sys->online_backup_state = FALSE;
 
-	/*----------------------------*/
-	
 	log_block_init(log_sys->buf, log_sys->lsn);
 	log_block_set_first_rec_group(log_sys->buf, LOG_BLOCK_HDR_SIZE);
 
@@ -2973,66 +2969,6 @@ loop:
 	mutex_exit(&(log_sys->mutex));
 }
 
-/**********************************************************
-Switches the database to the online backup state. */
-
-ulint
-log_switch_backup_state_on(void)
-/*============================*/
-			/* out: DB_SUCCESS or DB_ERROR */
-{
-	dulint	backup_lsn;
-	
-	mutex_enter(&(log_sys->mutex));
-
-	if (log_sys->online_backup_state) {
-
-		/* The database is already in that state */
-
-		mutex_exit(&(log_sys->mutex));
-
-		return(DB_ERROR);
-	}
-
-	log_sys->online_backup_state = TRUE;
-
-	backup_lsn = log_sys->lsn;
-
-	log_sys->online_backup_lsn = backup_lsn;
-
-	mutex_exit(&(log_sys->mutex));
-
-	/* log_checkpoint_and_mark_file_spaces(); */
-
-	return(DB_SUCCESS);
-}
-
-/**********************************************************
-Switches the online backup state off. */
-
-ulint
-log_switch_backup_state_off(void)
-/*=============================*/
-			/* out: DB_SUCCESS or DB_ERROR */
-{
-	mutex_enter(&(log_sys->mutex));
-
-	if (!log_sys->online_backup_state) {
-
-		/* The database is already in that state */
-
-		mutex_exit(&(log_sys->mutex));
-
-		return(DB_ERROR);
-	}
-
-	log_sys->online_backup_state = FALSE;
-
-	mutex_exit(&(log_sys->mutex));
-
-	return(DB_SUCCESS);
-}
-
 /********************************************************************
 Makes a checkpoint at the latest lsn and writes it to first page of each
 data file in the database, so that we know that the file spaces contain
diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c
index 33321376929..ba2e2064ec6 100644
--- a/innobase/log/log0recv.c
+++ b/innobase/log/log0recv.c
@@ -790,9 +790,6 @@ recv_parse_or_apply_log_rec_body(
 	} else if (type == MLOG_IBUF_BITMAP_INIT) {
 		new_ptr = ibuf_parse_bitmap_init(ptr, end_ptr, page, mtr);
 
-	} else if (type == MLOG_FULL_PAGE) {
-		new_ptr = mtr_log_parse_full_page(ptr, end_ptr, page);
-	
 	} else if (type == MLOG_INIT_FILE_PAGE) {
 		new_ptr = fsp_parse_init_file_page(ptr, end_ptr, page);
 
@@ -1093,15 +1090,7 @@ recv_recover_page(
 			buf = ((byte*)(recv->data)) + sizeof(recv_data_t);
 		}
 
-		if (recv->type == MLOG_INIT_FILE_PAGE
-		    || recv->type == MLOG_FULL_PAGE) {
-			/* A new file page may have been taken into use,
-			or we have stored the full contents of the page:
-			in this case it may be that the original log record
-			type was MLOG_INIT_FILE_PAGE, and we replaced it
-			with MLOG_FULL_PAGE, thus we have to apply
-			any record of type MLOG_FULL_PAGE */
-			
+		if (recv->type == MLOG_INIT_FILE_PAGE) {
 			page_lsn = page_newest_lsn;
 
 			mach_write_to_8(page + UNIV_PAGE_SIZE
diff --git a/innobase/mtr/mtr0mtr.c b/innobase/mtr/mtr0mtr.c
index 46473cb3ffe..5a5fab61827 100644
--- a/innobase/mtr/mtr0mtr.c
+++ b/innobase/mtr/mtr0mtr.c
@@ -105,179 +105,6 @@ mtr_memo_pop_all(
 	}
 }
 
-/****************************************************************
-Writes to the log the contents of a full page. This is called when the
-database is in the online backup state. */
-static
-void
-mtr_log_write_full_page(
-/*====================*/
-	page_t*	page,	/* in: page to write */
-	ulint	i,	/* in: i'th page for mtr */
-	ulint	n_pages,/* in: total number of pages for mtr */
-	mtr_t*	mtr)	/* in: mtr */
-{
-	byte*	buf;
-	byte*	ptr;
-	ulint	len;
-
-	buf = mem_alloc(UNIV_PAGE_SIZE + 50);
-
-	ptr = mlog_write_initial_log_record_fast(page, MLOG_FULL_PAGE, buf,
-									mtr);
-	ut_memcpy(ptr, page, UNIV_PAGE_SIZE);
-
-	len = (ptr - buf) + UNIV_PAGE_SIZE;
-
-	if (i == n_pages - 1) {
-		if (n_pages > 1) {
-			*(buf + len) = MLOG_MULTI_REC_END;
-			len++;
-		} else {
-			*buf = (byte)((ulint)*buf | MLOG_SINGLE_REC_FLAG);
-		}
-	}
-	
-	ut_ad(len < UNIV_PAGE_SIZE + 50);
-
-	log_write_low(buf, len);
-
-	mem_free(buf);
-}	
-
-/****************************************************************
-Parses a log record which contains the full contents of a page. */
-
-byte*
-mtr_log_parse_full_page(
-/*====================*/
-			/* out: end of log record or NULL */
-	byte*	ptr,	/* in: buffer */
-	byte*	end_ptr,/* in: buffer end */
-	page_t*	page)	/* in: page or NULL */
-{
-	if (end_ptr < ptr + UNIV_PAGE_SIZE) {
-
-		return(NULL);
-	} 
-
-	if (page) {
-		ut_memcpy(page, ptr, UNIV_PAGE_SIZE);
-	}
-
-	return(ptr + UNIV_PAGE_SIZE);
-}
-	
-/****************************************************************
-Writes to the database log the full contents of the pages that this mtr has
-modified. */
-static
-void
-mtr_log_write_backup_full_pages(
-/*============================*/
-	mtr_t*	mtr,	/* in: mini-transaction */
-	ulint	n_pages)/* in: number of pages modified by mtr */ 
-{
-	mtr_memo_slot_t* slot;
-	dyn_array_t*	memo;
-	buf_block_t*	block;
-	ulint		offset;
-	ulint		type;
-	ulint		i;
-
-	ut_ad(mtr);
-	ut_ad(mtr->magic_n == MTR_MAGIC_N);
-	ut_ad(mtr->state == MTR_COMMITTING);
-		
-	/* Open the database log for log_write_low */
-	mtr->start_lsn = log_reserve_and_open(n_pages * (UNIV_PAGE_SIZE + 50));
-
-	memo = &(mtr->memo);
-
-	offset = dyn_array_get_data_size(memo);
-
-	i = 0;
-	
-	while (offset > 0) {
-		offset -= sizeof(mtr_memo_slot_t);
-		slot = dyn_array_get_element(memo, offset);
-
-		block = slot->object;
-		type = slot->type;
-
-		if ((block != NULL) && (type == MTR_MEMO_PAGE_X_FIX)) {
-
-			mtr_log_write_full_page(block->frame, i, n_pages, mtr);
-
-			i++;
-		}
-	}
-
-	ut_ad(i == n_pages);
-}
-
-/****************************************************************
-Checks if mtr is the first to modify any page after online_backup_lsn. */
-static
-ibool
-mtr_first_to_modify_page_after_backup(
-/*==================================*/
-				/* out: TRUE if first for a page */
-	mtr_t*	mtr,		/* in: mini-transaction */
-	ulint*	n_pages)	/* out: number of modified pages (all modified
-				pages, backup_lsn does not matter here) */
-{
-	mtr_memo_slot_t* slot;
-	dyn_array_t*	memo;
-	ulint		offset;
-	buf_block_t*	block;
-	ulint		type;
-	dulint		backup_lsn;
-	ibool		ret	= FALSE;
-
-	ut_ad(mtr);
-	ut_ad(mtr->magic_n == MTR_MAGIC_N);
-	ut_ad(mtr->state == MTR_COMMITTING);
-
-	backup_lsn = log_get_online_backup_lsn_low();
-	
-	memo = &(mtr->memo);
-	
-	offset = dyn_array_get_data_size(memo);
-
-	*n_pages = 0;
-	
-	while (offset > 0) {
-		offset -= sizeof(mtr_memo_slot_t);
-		slot = dyn_array_get_element(memo, offset);
-
-		block = slot->object;
-		type = slot->type;
-
-		if ((block != NULL) && (type == MTR_MEMO_PAGE_X_FIX)) {
-
-			*n_pages = *n_pages + 1;
-
-			if (ut_dulint_cmp(buf_frame_get_newest_modification(
-								block->frame),
-							backup_lsn) <= 0) {
-
-				fprintf(stderr,
-					"Page %lu newest %lu backup %lu\n",
-					block->offset,
-					ut_dulint_get_low(
-					buf_frame_get_newest_modification(
-							block->frame)),
-					ut_dulint_get_low(backup_lsn));
-					
-				ret = TRUE;
-			}
-		}
-	}
-
-	return(ret);
-}
-	
 /****************************************************************
 Writes the contents of a mini-transaction log, if any, to the database log. */
 static
@@ -291,7 +118,6 @@ mtr_log_reserve_and_write(
 	ulint		data_size;
 	ibool		success;
 	byte*		first_data;
-	ulint		n_modified_pages;
 
 	ut_ad(mtr);
 
@@ -322,27 +148,12 @@ mtr_log_reserve_and_write(
 
 	if (mtr->log_mode == MTR_LOG_ALL) {
 
-		if (log_get_online_backup_state_low()
-		    && mtr_first_to_modify_page_after_backup(mtr,
-		    					&n_modified_pages)) {
-		    	
-			/* The database is in the online backup state: write
-			to the log the full contents of all the pages if this
-			mtr is the first to modify any page in the buffer pool
-			after online_backup_lsn */
+		block = mlog;
 
-			log_close();
-			log_release();
-		
-			mtr_log_write_backup_full_pages(mtr, n_modified_pages);
-		} else {
-			block = mlog;
-
-			while (block != NULL) {
-				log_write_low(dyn_block_get_data(block),
-						dyn_block_get_used(block));
-				block = dyn_array_get_next_block(mlog, block);
-			}
+		while (block != NULL) {
+			log_write_low(dyn_block_get_data(block),
+					dyn_block_get_used(block));
+			block = dyn_array_get_next_block(mlog, block);
 		}
 	} else {
 		ut_ad(mtr->log_mode == MTR_LOG_NONE);

From 7d8f8bc77bd58b0a527a3874cda55311a068d05b Mon Sep 17 00:00:00 2001
From: "monty@mysql.com" <>
Date: Wed, 26 May 2004 19:12:49 +0300
Subject: [PATCH 04/24] Changed prototype of killed_ptr() to make it more
 portable Applied patches for Netware

---
 innobase/include/os0thread.h          |   4 +
 innobase/os/os0thread.c               |   7 +
 libmysql/libmysql.c                   |   2 +-
 libmysql/libmysql.def                 |   4 +-
 myisam/myisamchk.c                    |  16 +-
 myisam/myisamdef.h                    |   2 +-
 mysql-test/t/rpl_relayspace-slave.opt |   2 +-
 mysys/my_pthread.c                    |  30 ++--
 mysys/my_static.h                     |   2 +
 netware/BUILD/compile-linux-tools     |   2 +
 netware/BUILD/mwenv                   |   9 +-
 netware/BUILD/nwbootstrap             |   7 +-
 netware/my_manage.c                   |   5 +-
 netware/mysql_fix_privilege_tables.pl | 121 ++++++++++++--
 netware/mysql_test_run.c              | 223 ++++++++++++++++++++------
 netware/static_init_db.sql            |   4 +-
 scripts/make_binary_distribution.sh   |  32 ++--
 sql/filesort.cc                       |   6 +-
 sql/ha_myisam.cc                      |   2 +-
 sql/mysqld.cc                         |   7 +-
 sql/sql_bitmap.h                      |   9 ++
 sql/sql_class.h                       |   2 +-
 sql/sql_insert.cc                     |   2 +-
 strings/my_strtoll10.c                |   2 +-
 24 files changed, 384 insertions(+), 118 deletions(-)

diff --git a/innobase/include/os0thread.h b/innobase/include/os0thread.h
index 6603229e524..c00d28baf60 100644
--- a/innobase/include/os0thread.h
+++ b/innobase/include/os0thread.h
@@ -78,6 +78,10 @@ os_thread_create(
 						function */
 	os_thread_id_t*		thread_id);	/* out: id of the created
 						thread */
+int
+os_thread_join(
+/*=============*/
+  os_thread_id_t  thread_id);	/* in: id of the thread to join */
 /*********************************************************************
 Exits the current thread. */
 
diff --git a/innobase/os/os0thread.c b/innobase/os/os0thread.c
index 59d0fdbd8c9..8deb8f38b5d 100644
--- a/innobase/os/os0thread.c
+++ b/innobase/os/os0thread.c
@@ -201,6 +201,13 @@ os_thread_exit(
 #endif
 }
 
+int
+os_thread_join(
+/*=============*/
+  os_thread_id_t  thread_id)	/* in: id of the thread to join */
+{
+  return pthread_join(thread_id, NULL);
+}
 /*********************************************************************
 Returns handle to the current thread. */
 
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 63f447ea1b9..7a376cad736 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -149,7 +149,7 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
 	mysql_unix_port = env;
     }
     mysql_debug(NullS);
-#if defined(SIGPIPE) && !defined(__WIN__)
+#if defined(SIGPIPE) && !defined(__WIN__) && !defined(__NETWARE__)
     (void) signal(SIGPIPE, SIG_IGN);
 #endif
 #ifdef EMBEDDED_LIBRARY
diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def
index 1790b0fa888..91691a2986a 100644
--- a/libmysql/libmysql.def
+++ b/libmysql/libmysql.def
@@ -81,7 +81,6 @@ EXPORTS
 	mysql_stmt_param_count
 	mysql_stmt_param_metadata
 	mysql_ping
-	mysql_prepare
 	mysql_stmt_result_metadata
 	mysql_query
 	mysql_read_query_result
@@ -114,6 +113,9 @@ EXPORTS
 	mysql_thread_safe
 	mysql_use_result
 	mysql_warning_count
+	mysql_stmt_sqlstate
+	mysql_sqlstate
+	mysql_get_server_version
 	net_buffer_length
 	set_dynamic
 	strcend
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index ae26b90d0a2..01804303f8b 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -363,7 +363,7 @@ static void usage(void)
                       directly with '--variable-name=value'.\n\
   -t, --tmpdir=path   Path for temporary files. Multiple paths can be\n\
                       specified, separated by "
-#if defined( __WIN__) || defined(OS2)
+#if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
    "semicolon (;)"
 #else
    "colon (:)"
@@ -1685,9 +1685,19 @@ err:
   DBUG_RETURN(1);
 } /* sort_record_index */
 
-volatile bool *killed_ptr(MI_CHECK *param)
+
+
+/*
+  Check if myisamchk was killed by a signal
+  This is overloaded by other programs that want to be able to abort
+  sorting
+*/
+
+static my_bool not_killed= 0;
+
+volatile my_bool *killed_ptr(MI_CHECK *param)
 {
-  return (bool *)(& param->thd); /* always NULL */
+  return &not_killed; 			/* always NULL */
 }
 
 	/* print warnings and errors */
diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h
index 1f100590049..736ce3f3869 100644
--- a/myisam/myisamdef.h
+++ b/myisam/myisamdef.h
@@ -711,7 +711,7 @@ int mi_open_keyfile(MYISAM_SHARE *share);
 void mi_setup_functions(register MYISAM_SHARE *share);
 
     /* Functions needed by mi_check */
-volatile bool *killed_ptr(MI_CHECK *param);
+volatile my_bool *killed_ptr(MI_CHECK *param);
 void mi_check_print_error _VARARGS((MI_CHECK *param, const char *fmt,...));
 void mi_check_print_warning _VARARGS((MI_CHECK *param, const char *fmt,...));
 void mi_check_print_info _VARARGS((MI_CHECK *param, const char *fmt,...));
diff --git a/mysql-test/t/rpl_relayspace-slave.opt b/mysql-test/t/rpl_relayspace-slave.opt
index 05cb01731d2..06d96aa3b9a 100644
--- a/mysql-test/t/rpl_relayspace-slave.opt
+++ b/mysql-test/t/rpl_relayspace-slave.opt
@@ -1 +1 @@
- -O relay_log_space_limit=10
\ No newline at end of file
+--relay_log_space_limit=10
diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c
index 2667c0670d8..d721418ffa1 100644
--- a/mysys/my_pthread.c
+++ b/mysys/my_pthread.c
@@ -98,25 +98,23 @@ void *my_pthread_getspecific_imp(pthread_key_t key)
 #undef pthread_exit
 void my_pthread_exit(void *status)
 {
-  NXThreadId_t tid = NXThreadGetId();
+  NXThreadId_t tid;
   NXContext_t ctx;
-  char name[PATH_MAX] = "";
+  char name[NX_MAX_OBJECT_NAME_LEN+1] = "";
 
-  /* Do not call pthread_exit if it is not a LibC thread */
-  if (tid != 0)
-  {
-    NXThreadGetContext(tid, &ctx);
-    NXContextGetName(ctx, name, PATH_MAX);
+  tid= NXThreadGetId();
+  if (tid == NX_INVALID_THREAD_ID || !tid)
+    return;
+  if (NXThreadGetContext(tid, &ctx) ||
+      NXContextGetName(ctx, name, sizeof(name)-1))
+    return;
 
-    /*
-      "MYSQLD.NLM's LibC Reaper" or "MYSQLD.NLM's main thread"
-      with a debug build of LibC the reaper can have different names
-    */
-    if (!strindex(name, "\'s"))
-    {
-      pthread_exit(status);
-    }
-  }
+  /*
+    "MYSQLD.NLM's LibC Reaper" or "MYSQLD.NLM's main thread"
+    with a debug build of LibC the reaper can have different names
+  */
+  if (!strindex(name, "\'s"))
+    pthread_exit(status);
 }
 #endif
 
diff --git a/mysys/my_static.h b/mysys/my_static.h
index bb408aa808d..51f9fbc922f 100644
--- a/mysys/my_static.h
+++ b/mysys/my_static.h
@@ -19,6 +19,7 @@
   a shared library
 */
 
+C_MODE_START
 #include <signal.h>
 
 #define MAX_SIGNALS	10		/* Max signals under a dont-allow */
@@ -73,3 +74,4 @@ extern struct st_my_file_info my_file_info_default[MY_NFILE];
 #if defined(THREAD) && !defined(__WIN__)
 extern sigset_t my_signals;		/* signals blocked by mf_brkhant */
 #endif
+C_MODE_END
diff --git a/netware/BUILD/compile-linux-tools b/netware/BUILD/compile-linux-tools
index 886f866d674..00d9d372063 100755
--- a/netware/BUILD/compile-linux-tools
+++ b/netware/BUILD/compile-linux-tools
@@ -43,6 +43,8 @@ make clean config.h
 (cd extra; make comp_err)
 (cd libmysql; make conf_to_src)
 (cd libmysql_r; make conf_to_src)
+# so the file will be linked
+(cd sql; make sql_yacc.cc)
 (cd sql; make gen_lex_hash)
 (cd strings; make conf_to_src)
 
diff --git a/netware/BUILD/mwenv b/netware/BUILD/mwenv
index 6f818b6f7a3..7eca2711a79 100755
--- a/netware/BUILD/mwenv
+++ b/netware/BUILD/mwenv
@@ -6,8 +6,8 @@
 # the default is "F:/mydev"
 export MYDEV="WINE_BUILD_DIR"
 
-export MWCNWx86Includes="$MYDEV/libc/include;$MYDEV/fs64/headers;$MYDEV;$MYDEV/zlib-1.1.4"
-export MWNWx86Libraries="$MYDEV/libc/imports;$MYDEV/mw/lib;$MYDEV/fs64/imports;$MYDEV/zlib-1.1.4;$MYDEV/mysql-VERSION/netware/BUILD"
+export MWCNWx86Includes="$MYDEV/libc/include;$MYDEV/fs64/headers;$MYDEV/zlib-1.1.4;$MYDEV"
+export MWNWx86Libraries="$MYDEV/libc/imports;$MYDEV/mw/lib;$MYDEV/fs64/imports;$MYDEV/zlib-1.1.4;$MYDEV/openssl;$MYDEV/mysql-VERSION/netware/BUILD"
 export MWNWx86LibraryFiles="libcpre.o;libc.imp;netware.imp;mwcrtl.lib;mwcpp.lib;libz.a;neb.imp;zPublics.imp;knetware.imp"
 
 export WINEPATH="$MYDEV/mw/bin"
@@ -19,11 +19,10 @@ export AR='mwldnlm'
 export AR_FLAGS='-type library -o'
 export AS='mwasmnlm'
 export CC='mwccnlm -gccincludes'
-export CFLAGS='-align 8 -proc 686 -relax_pointers -dialect c'
+export CFLAGS='-O3 -align 8 -proc 686 -relax_pointers -dialect c'
 export CXX='mwccnlm -gccincludes'
-export CXXFLAGS='-align 8 -proc 686 -relax_pointers -dialect c++ -bool on -wchar_t on -D_WCHAR_T'
+export CXXFLAGS='-O3 -align 8 -proc 686 -relax_pointers -dialect c++ -bool on -wchar_t on -D_WCHAR_T'
 export LD='mwldnlm'
 export LDFLAGS='-entry _LibCPrelude -exit _LibCPostlude -map -flags pseudopreemption'
 export RANLIB=:
 export STRIP=:
-
diff --git a/netware/BUILD/nwbootstrap b/netware/BUILD/nwbootstrap
index f54775bf054..7737dd8898a 100755
--- a/netware/BUILD/nwbootstrap
+++ b/netware/BUILD/nwbootstrap
@@ -171,6 +171,11 @@ do
   rm $file.org
 done
 
+# create the libmysql.imp file in netware folder from libmysql/libmysql.def
+# file
+echo "generating llibmysql.imp file..."
+awk 'BEGIN{x=0;}  x==1 {print $1;next} /EXPORTS/{x=1}' libmysql/libmysql.def > netware/libmysql.imp
+
 # build linux tools
 echo "compiling linux tools..."
 ./netware/BUILD/compile-linux-tools
@@ -183,5 +188,3 @@ then
 fi
 
 echo "done"
-
-
diff --git a/netware/my_manage.c b/netware/my_manage.c
index f5aa3163431..29514837837 100644
--- a/netware/my_manage.c
+++ b/netware/my_manage.c
@@ -200,11 +200,11 @@ int wait_for_server_start(char *bin_dir, char *user, char *password, int port,ch
   add_arg(&al, "--password=%s", password);
   add_arg(&al, "--silent");
 
-  /** Not supported on NetWare
+#ifdef NOT_USED
   add_arg(&al, "-O");
   add_arg(&al, "connect_timeout=10");
   add_arg(&al, "-w");
-  **/
+#endif
 
   add_arg(&al, "--host=localhost");
   add_arg(&al, "ping");
@@ -475,4 +475,3 @@ void get_basedir(char *argv0, char *basedir)
 		strcpy(basedir, temp);
 	}
 }
-
diff --git a/netware/mysql_fix_privilege_tables.pl b/netware/mysql_fix_privilege_tables.pl
index fd5bc11dde1..c0a428eff0f 100644
--- a/netware/mysql_fix_privilege_tables.pl
+++ b/netware/mysql_fix_privilege_tables.pl
@@ -1,16 +1,16 @@
 #-----------------------------------------------------------------------------
 # Copyright (C) 2002 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
@@ -19,7 +19,7 @@
 #-----------------------------------------------------------------------------
 # This notice applies to changes, created by or for Novell, Inc., 
 # to preexisting works for which notices appear elsewhere in this file. 
- 
+
 # Copyright (c) 2003 Novell, Inc. All Rights Reserved. 
 
 # This program is free software; you can redistribute it and/or modify 
@@ -37,7 +37,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 #-----------------------------------------------------------------------------
 
-use strict;
+#use strict;
 use Mysql;
 
 print "MySQL Fix Privilege Tables Script\n\n";
@@ -63,12 +63,27 @@ my $conn = Mysql->connect("localhost", "mysql", "root", $password)
   || die "Unable to connect to MySQL.";
 
 print "OK, successfully used the password, moving on...\n\n";
- 
-  
+
+
 #-----------------------------------------------------------------------------
 # MySQL 4.0.2
 #-----------------------------------------------------------------------------
 
+#-- Detect whether or not we had the Grant_priv column
+print "Fixing privileges for old tables...\n";
+$conn->query("SET \@hadGrantPriv:=0;");
+$conn->query("SELECT \@hadGrantPriv:=1 FROM user WHERE Grant_priv LIKE '%';");
+
+#--- Fix privileges for old tables
+$conn->query("UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE \@hadGrantPriv = 0;");
+$conn->query("UPDATE db SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE \@hadGrantPriv = 0;");
+$conn->query("UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE \@hadGrantPriv = 0;");
+
+
+# Detect whether we had Show_db_priv
+$conn->query("SET \@hadShowDbPriv:=0;");
+$conn->query("SELECT \@hadShowDbPriv:=1 FROM user WHERE Show_db_priv LIKE '%';");
+
 print "Adding new fields used by MySQL 4.0.2 to the privilege tables...\n";
 print "NOTE: You can ignore any Duplicate column errors.\n";
 $conn->query(" \
@@ -81,9 +96,11 @@ ADD Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Lock_tables_priv, \
 ADD Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Execute_priv, \
 ADD Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Repl_slave_priv; \
 ") && $conn->query(" \
-UPDATE user SET show_db_priv=select_priv, super_priv=process_priv, execute_priv=process_priv, create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=file_priv where user<>''; \
+UPDATE user SET show_db_priv=select_priv, super_priv=process_priv, execute_priv=process_priv, create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=file_priv where user<>''AND \@hadShowDbPriv = 0; \
 ");
 
+#-- The above statement converts privileges so that users have similar privileges as before
+
 #-----------------------------------------------------------------------------
 # MySQL 4.0 Limitations
 #-----------------------------------------------------------------------------
@@ -97,6 +114,22 @@ ADD max_updates   int(11) unsigned NOT NULL AFTER max_questions, \
 ADD max_connections int(11) unsigned NOT NULL AFTER max_updates; \
 ");
 
+#-- Change the password column to suite the new password hashing used
+#-- in 4.1.1 onward
+$conn->query("ALTER TABLE user change Password Password char(41) binary not null;");
+
+#-- The second alter changes ssl_type to new 4.0.2 format
+#-- Adding columns needed by GRANT .. REQUIRE (openssl)"
+print "Adding new fields to use in ssl authentication...\n";
+
+$conn->query(" \
+ALTER TABLE user \
+ADD ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL, \
+ADD ssl_cipher BLOB NOT NULL, \
+ADD x509_issuer BLOB NOT NULL, \
+ADD x509_subject BLOB NOT NULL; \
+");
+
 #-----------------------------------------------------------------------------
 # MySQL 4.0 DB and Host privs
 #-----------------------------------------------------------------------------
@@ -115,6 +148,77 @@ ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, \
 ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL; \
 ");
 
+#
+# Change the Table_name column to be of char(64) which was char(60) by mistake till now.
+#
+$conn->query("alter table tables_priv change Table_name Table_name char(64) binary DEFAULT '' NOT NULL;");
+
+
+#
+# Create some possible missing tables
+#
+print "Adding online help tables...\n";
+
+$conn->query(" \
+CREATE TABLE IF NOT EXISTS help_topic ( \
+help_topic_id int unsigned not null, \
+name varchar(64) not null, \
+help_category_id smallint unsigned not null, \
+description text not null, \
+example text not null, \
+url varchar(128) not null, \
+primary key (help_topic_id), unique index (name) \
+) comment='help topics'; \
+");
+
+$conn->query(" \
+CREATE TABLE IF NOT EXISTS help_category ( \
+help_category_id smallint unsigned not null, \
+name varchar(64) not null, \
+parent_category_id smallint unsigned null, \
+url varchar(128) not null, \
+primary key (help_category_id), \
+unique index (name) \
+) comment='help categories'; \
+");
+
+$conn->query(" \
+CREATE TABLE IF NOT EXISTS help_relation ( \
+help_topic_id int unsigned not null references help_topic, \
+help_keyword_id  int unsigned not null references help_keyword, \
+primary key (help_keyword_id, help_topic_id) \
+) comment='keyword-topic relation'; \
+");
+
+$conn->query(" \
+CREATE TABLE IF NOT EXISTS help_keyword ( \
+help_keyword_id int unsigned not null, \
+name varchar(64) not null, \
+primary key (help_keyword_id), \
+unique index (name) \
+) comment='help keywords'; \
+");
+
+
+#
+# Filling the help tables with contents.
+#
+print "Filling online help tables with contents...\n";
+# Generate the path for "fill_help_tables.sql" file which is in different folder. 
+$fill_help_table=$0;
+$fill_help_table =~ s/scripts[\\\/]mysql_fix_privilege_tables.pl/support-files\\fill_help_tables.sql/;
+
+#read all content from the sql file which contains recordsfor help tables.
+open(fileIN,$fill_help_table) or die("Cannot open $fill_help_table: $!");
+@logData = <fileIN>;
+close(fileIN);
+foreach $line (@logData) {
+# if the line is not empty, insert a record in the table.
+    if( ! ($line =~ /^\s*$/) ) {
+        $conn->query("$line");
+    }
+}
+
 #-----------------------------------------------------------------------------
 # done
 #-----------------------------------------------------------------------------
@@ -122,4 +226,3 @@ ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL; \
 print "\n\nAll done!\n\n";
 
 print "Thanks for using MySQL!\n\n";
-
diff --git a/netware/mysql_test_run.c b/netware/mysql_test_run.c
index 06d5e5985c1..9c99e8a64b5 100644
--- a/netware/mysql_test_run.c
+++ b/netware/mysql_test_run.c
@@ -153,6 +153,7 @@ void log_info(char *, ...);
 void log_error(char *, ...);
 void log_errno(char *, ...);
 void die(char *);
+char *str_tok(char *string, const char *delim);
 
 /******************************************************************************
 
@@ -244,6 +245,7 @@ void mysql_install_db()
   mkdir(temp, S_IRWXU);
   
   // create subdirectories
+  log("Creating test-suite folders...\n");
   snprintf(temp, PATH_MAX, "%s/var/run", mysql_test_dir);
   mkdir(temp, S_IRWXU);
   snprintf(temp, PATH_MAX, "%s/var/tmp", mysql_test_dir);
@@ -262,7 +264,9 @@ void mysql_install_db()
   mkdir(temp, S_IRWXU);
 
   // install databases
+  log("Creating test databases for master... \n");
   install_db(master_dir);
+  log("Creating test databases for slave... \n");
   install_db(slave_dir);
 }
 
@@ -346,6 +350,9 @@ void start_master()
   add_arg(&al, "--character-sets-dir=%s", char_dir);
   add_arg(&al, "--tmpdir=%s", mysql_tmp_dir);
   add_arg(&al, "--language=%s", lang_dir);
+#ifdef DEBUG	//only for debug builds
+  add_arg(&al, "--debug");
+#endif
 
   if (use_openssl)
   {
@@ -370,33 +377,28 @@ void start_master()
   if (master_opt[0] != NULL)
   {
     char *p;
-    char *temp;
 
-    p = (char *)strtok(master_opt, " \t");
-
-    if ((temp = strstr(p, "timezone")) == NULL)
+    p = (char *)str_tok(master_opt, " \t");
+    if (!strstr(master_opt, "timezone"))
     {
-      while(p)
+      while (p)
       {
         add_arg(&al, "%s", p);
-        p = (char *)strtok(NULL, " \t");
+        p = (char *)str_tok(NULL, " \t");
       }
     }
-    else
-    {
-      //do nothing
-    }
   }
 
   // remove the pid file if it exists
   remove(master_pid);
 
   // spawn
-  if ((err = spawn(mysqld_file, &al, FALSE, NULL, master_out, master_err)) == 0)
+  if ((err= spawn(mysqld_file, &al, FALSE, NULL, master_out, master_err)) == 0)
   {
     sleep_until_file_exists(master_pid);
 
-	if ((err = wait_for_server_start(bin_dir, user, password, master_port,mysql_tmp_dir)) == 0)
+	if ((err = wait_for_server_start(bin_dir, user, password, master_port,
+                                         mysql_tmp_dir)) == 0)
     {
       master_running = TRUE;
     }
@@ -467,11 +469,11 @@ void start_slave()
       snprintf(temp, PATH_MAX, "%s/master.info", slave_dir);
       fp = fopen(temp, "wb+");
       
-      fputs("master-bin.001\n", fp);
+      fputs("master-bin.000001\n", fp);
       fputs("4\n", fp);
       fputs("127.0.0.1\n", fp);
       fputs("replicate\n", fp);
-      fputs("aaaaaaaaaaaaaaabthispartofthepasswordisnotused\n", fp);
+      fputs("aaaaaaaaaaaaaaab\n", fp);
       fputs("9306\n", fp);
       fputs("1\n", fp);
       fputs("0\n", fp);
@@ -521,6 +523,9 @@ void start_slave()
   add_arg(&al, "--master-retry-count=10");
   add_arg(&al, "-O");
   add_arg(&al, "slave_net_timeout=10");
+#ifdef DEBUG	//only for debug builds
+  add_arg(&al, "--debug");
+#endif
 
   if (use_openssl)
   {
@@ -534,13 +539,13 @@ void start_slave()
   {
     char *p;
 
-    p = (char *)strtok(slave_master_info, " \t");
+    p = (char *)str_tok(slave_master_info, " \t");
 
     while(p)
     {
       add_arg(&al, "%s", p);
       
-      p = (char *)strtok(NULL, " \t");
+      p = (char *)str_tok(NULL, " \t");
     }
   }
   else
@@ -567,13 +572,13 @@ void start_slave()
   {
     char *p;
 
-    p = (char *)strtok(slave_opt, " \t");
+    p = (char *)str_tok(slave_opt, " \t");
 
     while(p)
     {
       add_arg(&al, "%s", p);
       
-      p = (char *)strtok(NULL, " \t");
+      p = (char *)str_tok(NULL, " \t");
     }
   }
   
@@ -585,7 +590,8 @@ void start_slave()
   {
     sleep_until_file_exists(slave_pid);
     
-    if ((err = wait_for_server_start(bin_dir, user, password, slave_port,mysql_tmp_dir)) == 0)
+    if ((err = wait_for_server_start(bin_dir, user, password, slave_port,
+                                     mysql_tmp_dir)) == 0)
     {
       slave_running = TRUE;
     }
@@ -636,7 +642,8 @@ void stop_slave()
   if (!slave_running) return;
 
   // stop
-  if ((err = stop_server(bin_dir, user, password, slave_port, slave_pid,mysql_tmp_dir)) == 0)
+  if ((err = stop_server(bin_dir, user, password, slave_port, slave_pid,
+                         mysql_tmp_dir)) == 0)
   {
     slave_running = FALSE;
   }
@@ -660,7 +667,8 @@ void stop_master()
   // running?
   if (!master_running) return;
 
-  if ((err = stop_server(bin_dir, user, password, master_port, master_pid,mysql_tmp_dir)) == 0)
+  if ((err = stop_server(bin_dir, user, password, master_port, master_pid,
+                         mysql_tmp_dir)) == 0)
   {
     master_running = FALSE;
   }
@@ -697,6 +705,7 @@ void mysql_stop()
 ******************************************************************************/
 void mysql_restart()
 {
+  log_info("Restarting the MySQL server(s): %u", ++restarts);
 
   mysql_stop();
 
@@ -758,6 +767,12 @@ int read_option(char *opt_file, char *opt)
       
       strcat(opt, temp);
     }
+    // Check for double backslash and replace it with single bakslash
+    if ((p = strstr(opt, "\\\\")) != NULL)
+    {
+      /* bmove is guranteed to work byte by byte */
+      bmove(p, p+1, strlen(p+1));
+    }
   }
   else
   {
@@ -786,17 +801,13 @@ void run_test(char *test)
   int flag = FALSE;
   struct stat info;
   
-  // single test?
-//  if (!single_test)
-  {
-    // skip tests in the skip list
-    snprintf(temp, PATH_MAX, " %s ", test);
-    skip = (strindex(skip_test, temp) != NULL);
-    if( skip == FALSE )
-      ignore = (strindex(ignore_test, temp) != NULL);
-  }
+  // skip tests in the skip list
+  snprintf(temp, PATH_MAX, " %s ", test);
+  skip = (strindex(skip_test, temp) != NULL);
+  if (skip == FALSE)
+    ignore = (strindex(ignore_test, temp) != NULL);
     
-  if(ignore)
+  if (ignore)
   {
     // show test
     log("%-46s ", test);
@@ -837,7 +848,7 @@ void run_test(char *test)
     if (stat(test_file, &info))
     {
       snprintf(test_file, PATH_MAX, "%s/%s%s", test_dir, test, TEST_SUFFIX);
-      if(access(test_file,0))
+      if (access(test_file,0))
       {
         printf("Invalid test name %s, %s file not found\n",test,test_file);
         return;
@@ -1087,8 +1098,7 @@ void die(char *msg)
 void setup(char *file)
 {
   char temp[PATH_MAX];
-  char mysqldump_load[PATH_MAX*2],mysqlbinlog_load[PATH_MAX*2];
-
+  char file_path[PATH_MAX*2];
   char *p;
 
   // set the timezone for the timestamp test
@@ -1145,13 +1155,15 @@ void setup(char *file)
   strcpy(temp, strlwr(skip_test));
   snprintf(skip_test, PATH_MAX, " %s ", temp);
 
-  snprintf(mysqlbinlog_load,PATH_MAX*2,"%s/mysqlbinlog --no-defaults --local-load=%s",bin_dir,mysql_tmp_dir);
-  snprintf(mysqldump_load,PATH_MAX*2,"%s/mysqldump --no-defaults -uroot --port=%d",bin_dir,master_port);
   // environment
   setenv("MYSQL_TEST_DIR", mysql_test_dir, 1);
-  setenv("MYSQL_DUMP", mysqldump_load, 1);
-  setenv("MYSQL_BINLOG", mysqlbinlog_load, 1);
+  snprintf(file_path, PATH_MAX*2, "%s/mysqldump --no-defaults -u root --port=%u", bin_dir, master_port);
+  setenv("MYSQL_DUMP", file_path, 1);
+  snprintf(file_path, PATH_MAX*2, "%s/mysqlbinlog --no-defaults --local-load=%s", bin_dir, mysql_tmp_dir);
+  setenv("MYSQL_BINLOG", file_path, 1);
   setenv("MASTER_MYPORT", "9306", 1);
+
+
 }
 
 /******************************************************************************
@@ -1165,20 +1177,22 @@ int main(int argc, char **argv)
   // setup
   setup(argv[0]);
   
-  /* The --ignore option is comma saperated list of test cases to skip and should 
-   * be very first command line option to the test suite. 
-   * The usage is now:
-   * mysql_test_run --ignore=test1,test2 test3 test4
-   * where test1 and test2 are test cases to ignore
-   * and test3 and test4 are test cases to run. */
-  if( argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1) )
+  /* The --ignore option is comma saperated list of test cases to skip and
+     should be very first command line option to the test suite. 
+
+     The usage is now:
+     mysql_test_run --ignore=test1,test2 test3 test4
+     where test1 and test2 are test cases to ignore
+     and test3 and test4 are test cases to run.
+  */
+  if (argc >= 2 && !strnicmp(argv[1], "--ignore=", sizeof("--ignore=")-1))
   {
     char *temp, *token;
-    temp=strdup(strchr(argv[1],'=') + 1);
-    for(token=strtok(temp, ","); token != NULL; token=strtok(NULL, ","))
+    temp= strdup(strchr(argv[1],'=') + 1);
+    for (token=str_tok(temp, ","); token != NULL; token=str_tok(NULL, ","))
     {
-      if( strlen(ignore_test) + strlen(token) + 2 <= PATH_MAX-1 )
-        sprintf( ignore_test+strlen(ignore_test), " %s ", token);
+      if (strlen(ignore_test) + strlen(token) + 2 <= PATH_MAX-1)
+        sprintf(ignore_test+strlen(ignore_test), " %s ", token);
       else
       {
         free(temp);
@@ -1272,3 +1286,114 @@ int main(int argc, char **argv)
   return 0;
 }
 
+
+/*
+ Synopsis:
+  This function breaks the string into a sequence of tokens. The difference
+  between this function and strtok is that it respects the quoted string i.e.
+  it skips  any delimiter character within the quoted part of the string. 
+  It return tokens by eliminating quote character. It modifies the input string
+  passed. It will work with whitespace delimeter but may not work properly with
+  other delimeter. If the delimeter will contain any quote character, then
+  function will not tokenize and will return null string.
+  e.g. if input string is 
+     --init-slave="set global max_connections=500" --skip-external-locking
+  then the output will two string i.e.
+     --init-slave=set global max_connections=500
+     --skip-external-locking
+
+Arguments:
+  string:  input string
+  delim:   set of delimiter character
+Output:
+  return the null terminated token of NULL.
+*/
+
+
+char *str_tok(char *string, const char *delim)
+{
+  char *token;            /* current token received from strtok */
+  char *qt_token;         /* token delimeted by the matching pair of quote */
+  /*
+    if there are any quote chars found in the token then this variable
+    will hold the concatenated string to return to the caller
+  */
+  char *ptr_token=NULL;
+  /* pointer to the quote character in the token from strtok */
+  char *ptr_quote=NULL;
+  
+  /* See if the delimeter contains any quote character */
+  if (strchr(delim,'\'') || strchr(delim,'\"'))
+    return NULL;
+
+  /* repeate till we are getting some token from strtok */
+  while ((token = (char*)strtok(string, delim) ) != NULL)
+  {
+    /*
+      make the input string NULL so that next time onward strtok can
+      be called with NULL input string.
+    */
+    string = NULL;
+    
+    /* check if the current token contain double quote character*/
+    if ((ptr_quote = (char*)strchr(token,'\"')) != NULL)
+    {
+      /*
+        get the matching the matching double quote in the remaining
+        input string
+      */
+      qt_token = (char*)strtok(NULL,"\"");
+    }
+    /* check if the current token contain single quote character*/
+    else if ((ptr_quote = (char*)strchr(token,'\'')) != NULL)
+    {
+      /*
+        get the matching the matching single quote in the remaining
+        input string
+      */
+      qt_token = (char*)strtok(NULL,"\'");
+    }
+
+    /*
+      if the current token does not contains any quote character then
+      return to the caller.
+    */
+    if (ptr_quote == NULL)
+    {
+      /*
+        if there is any earlier token i.e. ptr_token then append the
+        current token in it and return it else return the current
+        token directly
+      */
+      return ptr_token ? strcat(ptr_token,token) : token;
+    }
+
+    /*
+      remove the quote character i.e. make NULL so that the token will
+      be devided in two part and later both part can be concatenated
+      and hence quote will be removed
+    */
+    *ptr_quote= 0;
+    
+    /* check if ptr_token has been initialized or not */
+    if (ptr_token == NULL)
+    {
+      /* initialize the ptr_token with current token */
+      ptr_token= token;
+      /* copy entire string between matching pair of quote*/
+      sprintf(ptr_token+strlen(ptr_token),"%s %s", ptr_quote+1, qt_token);
+    }
+    else
+    {
+      /*
+        copy the current token and entire string between matching pair
+        of quote
+      */
+      sprintf(ptr_token+strlen(ptr_token),"%s%s %s", token, ptr_quote+1,
+              qt_token );
+    }
+  }
+  
+  /* return the concatenated token */
+  return ptr_token;
+}
diff --git a/netware/static_init_db.sql b/netware/static_init_db.sql
index 63ee623dac4..e9fb92f4a97 100644
--- a/netware/static_init_db.sql
+++ b/netware/static_init_db.sql
@@ -10,7 +10,7 @@ INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y',
  
 CREATE TABLE host (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db)) comment='Host privileges; Merged with database privileges';
 
-CREATE TABLE user (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(45) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') DEFAULT 'N' NOT NULL, File_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User)) comment='Users and global privileges';
+CREATE TABLE user (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') DEFAULT 'N' NOT NULL, File_priv enum('N','Y') DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, References_priv enum('N','Y') DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User)) comment='Users and global privileges';
 
 INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
 INSERT INTO user VALUES ('','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
@@ -20,7 +20,7 @@ INSERT INTO user (host,user) values ('','');
 
 CREATE TABLE func (name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') NOT NULL, PRIMARY KEY (name)) comment='User defined functions';
 
-CREATE TABLE tables_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(60) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor)) comment='Table privileges';
+CREATE TABLE tables_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor)) comment='Table privileges';
 
 CREATE TABLE columns_priv (Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp(14), Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name)) comment='Column privileges';
 
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index 230a62c5f11..ef1a895e4eb 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -197,14 +197,6 @@ fi
 $CP support-files/* $BASE/support-files
 $CP scripts/*.sql $BASE/share
 
-if [ $BASE_SYSTEM = "netware" ] ; then
-  rm -f $BASE/support-files/magic \
-        $BASE/support-files/mysql.server \
-        $BASE/support-files/mysql*.spec \
-        $BASE/support-files/mysql-log-rotate \
-        $BASE/support-files/binary-configure
-fi
-
 $CP -r sql/share/* $MYSQL_SHARE
 rm -f $MYSQL_SHARE/Makefile* $MYSQL_SHARE/*/*.OLD
 
@@ -240,11 +232,25 @@ fi
 rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh $BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution $BASE/bin/setsomevars $BASE/support-files/Makefile* $BASE/support-files/*.sh
 
 
+#
+# Copy system dependent files
+#
+if [ $BASE_SYSTEM = "netware" ] ; then
+  cp ./netware/static_init_db.sql ./netware/init_db.sql
+  ./scripts/fill_help_tables < ./Docs/manual.texi >> ./netware/init_db.sql
+fi
+
 #
 # Remove system dependent files
 #
 if [ $BASE_SYSTEM = "netware" ] ; then
-    rm -f $BASE/MySQLEULA.txt
+  rm -f $BASE/support-files/magic \
+        $BASE/support-files/mysql.server \
+        $BASE/support-files/mysql*.spec \
+        $BASE/support-files/mysql-log-rotate \
+        $BASE/support-files/binary-configure \
+        $BASE/INSTALL-BINARY \
+        $BASE/MySQLEULA.txt
 else
     rm -f $BASE/README.NW
 fi
@@ -347,9 +353,6 @@ if [ $BASE_SYSTEM != "netware" ] ; then
   echo "Compressing archive"
   rm -f $NEW_NAME.tar.gz
   gzip -9 $NEW_NAME.tar
-  echo "Removing temporary directory"
-  rm -r -f $BASE
-  
   echo "$NEW_NAME.tar.gz created"
 else
 
@@ -360,9 +363,8 @@ else
   cd $TMP
   if test -e "$SOURCE/$NEW_NAME.zip"; then rm $SOURCE/$NEW_NAME.zip; fi
   zip -r $SOURCE/$NEW_NAME.zip $NEW_NAME
-  echo "Removing temporary directory"
-  rm -r -f $BASE
-
   echo "$NEW_NAME.zip created"
 
 fi
+echo "Removing temporary directory"
+rm -r -f $BASE
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 8699a517661..fc8b529712c 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -349,7 +349,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
   byte *ref_pos,*next_pos,ref_buff[MAX_REFLENGTH];
   my_off_t record;
   TABLE *sort_form;
-  volatile bool *killed= &current_thd->killed;
+  volatile my_bool *killed= &current_thd->killed;
   handler *file;
   DBUG_ENTER("find_all_keys");
   DBUG_PRINT("info",("using: %s",(select?select->quick?"ranges":"where":"every row")));
@@ -800,8 +800,8 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
   BUFFPEK *buffpek,**refpek;
   QUEUE queue;
   qsort2_cmp cmp;
-  volatile bool *killed= &current_thd->killed;
-  bool not_killable;
+  volatile my_bool *killed= &current_thd->killed;
+  my_bool not_killable;
   DBUG_ENTER("merge_buffers");
 
   statistic_increment(filesort_merge_passes, &LOCK_status);
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index feac5c51dce..3c7852c703a 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -89,7 +89,7 @@ static void mi_check_print_msg(MI_CHECK *param,	const char* msg_type,
 
 extern "C" {
 
-volatile bool *killed_ptr(MI_CHECK *param)
+volatile my_bool *killed_ptr(MI_CHECK *param)
 {
   return &(((THD *)(param->thd))->killed);
 }
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 2e4a6b5823a..042f2ecd8e7 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1503,7 +1503,7 @@ void mysql_cb_init()
 }
 
 
-/ *To get the name of the NetWare volume having MySQL data folder */
+/* To get the name of the NetWare volume having MySQL data folder */
 
 static void getvolumename()
 {
@@ -1574,6 +1574,7 @@ static void registerwithneb()
 /*
   Callback for NSS Volume Deactivation event
 */
+
 ulong neb_event_callback(struct EventBlock *eblock)
 {
   EventChangeVolStateEnter_s *voldata;
@@ -1602,7 +1603,7 @@ ulong neb_event_callback(struct EventBlock *eblock)
 
 #define ADMIN_VOL_PATH					"_ADMIN:/Volumes/"
 
-staticvoid getvolumeID(BYTE *volumeName)
+static void getvolumeID(BYTE *volumeName)
 {
   char path[zMAX_FULL_NAME];
   Key_t rootKey= 0, fileKey= 0;
@@ -1610,7 +1611,7 @@ staticvoid getvolumeID(BYTE *volumeName)
   zInfo_s info;
   STATUS status;
 
-  /* Get the  root key */
+  /* Get the root key */
   if ((status= zRootKey(0, &rootKey)) != zOK)
   {
     consoleprintf("\nGetNSSVolumeProperties - Failed to get root key, status: %d\n.", (int) status);
diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h
index 0274cd700da..96570c508e6 100644
--- a/sql/sql_bitmap.h
+++ b/sql/sql_bitmap.h
@@ -91,7 +91,16 @@ template <> class Bitmap<64>
   ulonglong map;
 public:
   Bitmap<64>() { }
+#if defined(__NETWARE__)
+  /*
+    Metwork compiler gives error on Bitmap<64>
+    Changed to Bitmap, since in this case also it will proper construct
+    this class
+  */
+  explicit Bitmap(uint prefix_to_set) { set_prefix(prefix_to_set); }
+#else
   explicit Bitmap<64>(uint prefix_to_set) { set_prefix(prefix_to_set); }
+#endif
   void init() { }
   void init(uint prefix_to_set) { set_prefix(prefix_to_set); }
   uint length() const { return 64; }
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 7894cf5fb2c..d787dcabd00 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -808,10 +808,10 @@ public:
   bool	     query_start_used,last_insert_id_used,insert_id_used,rand_used;
   bool	     in_lock_tables,global_read_lock;
   bool       query_error, bootstrap, cleanup_done;
-  bool	     volatile killed;
   bool	     tmp_table_used;
   bool	     charset_is_system_charset, charset_is_collation_connection;
   bool       slow_command;
+  my_bool    volatile killed;
 
   /*
     If we do a purge of binary logs, log index info of the threads
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 5032e9c33f0..5b1b18e80e4 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -190,7 +190,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
   else
 #endif /* EMBEDDED_LIBRARY */
     res= open_and_lock_tables(thd, table_list);
-  if (res)
+  if (res || thd->is_fatal_error)
     DBUG_RETURN(-1);
 
   table= table_list->table;
diff --git a/strings/my_strtoll10.c b/strings/my_strtoll10.c
index 493d0d63de2..5217564087c 100644
--- a/strings/my_strtoll10.c
+++ b/strings/my_strtoll10.c
@@ -15,7 +15,7 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
 #include <my_global.h>
-#include <my_sys.h>
+#include <my_sys.h>            /* Needed for MY_ERRNO_ERANGE */
 #include <m_string.h>
 
 #undef  ULONGLONG_MAX

From 78f58ff38494c6483fd63e9f9d8824b34ebdbc44 Mon Sep 17 00:00:00 2001
From: "hf@deer.(none)" <>
Date: Wed, 26 May 2004 21:40:27 +0500
Subject: [PATCH 05/24] Fix to make Windows compilation smoother

---
 VC++Files/innobase/innobase.dsp |  4 ----
 client/mysql.cc                 | 16 ++++++++++++----
 client/mysqldump.c              | 13 ++++++++++---
 include/mysql.h                 | 13 +++++++++++++
 include/mysql_com.h             |  9 ---------
 libmysql/libmysql.c             |  8 ++++++++
 libmysql/libmysql.def           | 19 +------------------
 libmysql_r/Makefile.am          |  2 +-
 libmysqld/lib_sql.cc            |  6 +++++-
 libmysqld/libmysqld.c           | 12 ++++++++++++
 libmysqld/libmysqld.def         |  3 +--
 sql/log_event.cc                |  1 +
 tools/mysqlmanager.c            |  2 +-
 13 files changed, 65 insertions(+), 43 deletions(-)

diff --git a/VC++Files/innobase/innobase.dsp b/VC++Files/innobase/innobase.dsp
index 25e9d5d75b8..ea0aaeb3b83 100644
--- a/VC++Files/innobase/innobase.dsp
+++ b/VC++Files/innobase/innobase.dsp
@@ -368,10 +368,6 @@ SOURCE=.\row\row0vers.c
 # End Source File
 # Begin Source File
 
-SOURCE=.\srv\srv0que.c
-# End Source File
-# Begin Source File
-
 SOURCE=.\srv\srv0srv.c
 # End Source File
 # Begin Source File
diff --git a/client/mysql.cc b/client/mysql.cc
index 1fd909a397e..66a99bbdf75 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -129,6 +129,7 @@ static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
 	       vertical=0, line_numbers=1, column_names=1,opt_html=0,
                opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0,
                tty_password= 0, opt_nobeep=0;
+static ulong opt_max_allowed_packet, opt_net_buffer_length;
 static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
 static my_string opt_mysql_unix_port=0;
 static int connect_flag=CLIENT_INTERACTIVE;
@@ -330,7 +331,7 @@ int main(int argc,char *argv[])
     exit(1);
   }
   if (status.batch && !status.line_buff &&
-      !(status.line_buff=batch_readline_init(max_allowed_packet+512,stdin)))
+      !(status.line_buff=batch_readline_init(opt_max_allowed_packet+512,stdin)))
   {
     free_defaults(defaults_argv);
     exit(1);
@@ -573,11 +574,11 @@ static struct my_option my_long_options[] =
    (gptr*) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
    0, 1},
   {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "",
-   (gptr*) &max_allowed_packet, (gptr*) &max_allowed_packet, 0, GET_ULONG,
+   (gptr*) &opt_max_allowed_packet, (gptr*) &opt_max_allowed_packet, 0, GET_ULONG,
    REQUIRED_ARG, 16 *1024L*1024L, 4096, (longlong) 2*1024L*1024L*1024L,
    MALLOC_OVERHEAD, 1024, 0},
   {"net_buffer_length", OPT_NET_BUFFER_LENGTH, "",
-   (gptr*) &net_buffer_length, (gptr*) &net_buffer_length, 0, GET_ULONG,
+   (gptr*) &opt_net_buffer_length, (gptr*) &opt_net_buffer_length, 0, GET_ULONG,
    REQUIRED_ARG, 16384, 1024, 512*1024*1024L, MALLOC_OVERHEAD, 1024, 0},
   {"select_limit", OPT_SELECT_LIMIT, "", (gptr*) &select_limit,
    (gptr*) &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, 1, ~0L, 0, 1, 0},
@@ -738,6 +739,7 @@ static int get_options(int argc, char **argv)
 {
   char *tmp, *pagpoint;
   int ho_error;
+  MYSQL_PARAMETERS *mysql_params= mysql_get_parameters();
 
   tmp= (char *) getenv("MYSQL_HOST");
   if (tmp)
@@ -753,9 +755,15 @@ static int get_options(int argc, char **argv)
     strmov(pager, pagpoint);
   strmov(default_pager, pager);
 
+  opt_max_allowed_packet= *mysql_params->p_max_allowed_packet;
+  opt_net_buffer_length= *mysql_params->p_net_buffer_length;
+
   if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
     exit(ho_error);
 
+  *mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
+  *mysql_params->p_net_buffer_length= opt_net_buffer_length;
+
   if (status.batch) /* disable pager and outfile in this case */
   {
     strmov(default_pager, "stdout");
@@ -2164,7 +2172,7 @@ static int com_source(String *buffer, char *line)
     return put_info(buff, INFO_ERROR, 0);
   }
 
-  if (!(line_buff=batch_readline_init(max_allowed_packet+512,sql_file)))
+  if (!(line_buff=batch_readline_init(opt_max_allowed_packet+512,sql_file)))
   {
     my_fclose(sql_file,MYF(0));
     return put_info("Can't initialize batch_readline", INFO_ERROR, 0);
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 3f3746f2963..82c3ee53e33 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -79,6 +79,7 @@ static my_bool  verbose=0,tFlag=0,cFlag=0,dFlag=0,quick=0, extended_insert = 0,
   opt_autocommit=0,opt_master_data,opt_disable_keys=0,opt_xml=0,
   opt_delete_master_logs=0, tty_password=0,
   opt_single_transaction=0, opt_comments= 0;
+static ulong opt_max_allowed_packet, opt_net_buffer_length;
 static MYSQL  mysql_connection,*sock=0;
 static char  insert_pat[12 * 1024],*opt_password=0,*current_user=0,
              *current_host=0,*path=0,*fields_terminated=0,
@@ -87,7 +88,6 @@ static char  insert_pat[12 * 1024],*opt_password=0,*current_user=0,
 static uint     opt_mysql_port=0;
 static my_string opt_mysql_unix_port=0;
 static int   first_error=0;
-extern ulong net_buffer_length;
 static DYNAMIC_STRING extended_row;
 #include <sslopt-vars.h>
 FILE  *md_result_file;
@@ -238,11 +238,11 @@ static struct my_option my_long_options[] =
   {"xml", 'X', "Dump a database as well formed XML.", 0, 0, 0, GET_NO_ARG,
    NO_ARG, 0, 0, 0, 0, 0, 0},
   {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "",
-    (gptr*) &max_allowed_packet, (gptr*) &max_allowed_packet, 0,
+    (gptr*) &opt_max_allowed_packet, (gptr*) &opt_max_allowed_packet, 0,
     GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096, 
    (longlong) 2L*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
   {"net_buffer_length", OPT_NET_BUFFER_LENGTH, "",
-    (gptr*) &net_buffer_length, (gptr*) &net_buffer_length, 0,
+    (gptr*) &opt_net_buffer_length, (gptr*) &opt_net_buffer_length, 0,
     GET_ULONG, REQUIRED_ARG, 1024*1024L-1025, 4096, 16*1024L*1024L,
     MALLOC_OVERHEAD-1024, 1024, 0},
   {"comments", 'i', "Write additional information.",
@@ -405,6 +405,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
 static int get_options(int *argc, char ***argv)
 {
   int ho_error;
+  MYSQL_PARAMETERS *mysql_params= mysql_get_parameters();
+
+  opt_max_allowed_packet= *mysql_params->p_max_allowed_packet;
+  opt_net_buffer_length= *mysql_params->p_net_buffer_length;
 
   md_result_file= stdout;
   load_defaults("my",load_default_groups,argc,argv);
@@ -412,6 +416,9 @@ static int get_options(int *argc, char ***argv)
   if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
     exit(ho_error);
 
+  *mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
+  *mysql_params->p_net_buffer_length= opt_net_buffer_length;
+
   if (opt_delayed)
     opt_lock=0;				/* Can't have lock with delayed */
   if (!path && (enclosed || opt_enclosed || escaped || lines_terminated ||
diff --git a/include/mysql.h b/include/mysql.h
index 3ffc014c449..1665dd5027e 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -244,6 +244,17 @@ typedef struct st_mysql_manager
   char last_error[MAX_MYSQL_MANAGER_ERR];
 } MYSQL_MANAGER;
 
+typedef struct st_mysql_parameters
+{
+  unsigned long *p_max_allowed_packet;
+  unsigned long *p_net_buffer_length;
+} MYSQL_PARAMETERS;
+
+#if !defined(MYSQL_CLIENT) && !defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY)
+#define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet)
+#define net_buffer_length (*mysql_get_parameters()->p_net_buffer_length)
+#endif
+
 /*
   Set up and bring down the server; to ensure that applications will
   work when linked against either the standard client library or the
@@ -252,6 +263,8 @@ typedef struct st_mysql_manager
 int STDCALL mysql_server_init(int argc, char **argv, char **groups);
 void STDCALL mysql_server_end(void);
 
+MYSQL_PARAMETERS *STDCALL mysql_get_parameters();
+
 /*
   Set up and bring down a thread; these function should be called
   for each thread in an application which opens at least one MySQL
diff --git a/include/mysql_com.h b/include/mysql_com.h
index c81c90dec22..94b864375ba 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -34,12 +34,6 @@
 #define MYSQL_SERVICENAME "MySQL"
 #endif /* __WIN__ */
 
-#if defined(__WIN__) && !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT) && !defined(EMBEDDED_LIBRARY)
-#define dll_import_spec __declspec( dllimport )
-#else
-#define dll_import_spec
-#endif
-
 enum enum_server_command {
   COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST,
   COM_CREATE_DB, COM_DROP_DB, COM_REFRESH, COM_SHUTDOWN,  COM_STATISTICS,
@@ -229,9 +223,6 @@ typedef struct st_udf_init
 extern "C" {
 #endif
 
-dll_import_spec extern unsigned long max_allowed_packet;
-dll_import_spec extern unsigned long net_buffer_length;
-
 void randominit(struct rand_struct *,unsigned long seed1,
 		unsigned long seed2);
 double my_rnd(struct rand_struct *);
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index dba9c83b339..0a23954ae67 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -121,6 +121,14 @@ void STDCALL mysql_server_end()
   mysql_client_init= org_my_init_done= 0;
 }
 
+static MYSQL_PARAMETERS mysql_internal_parameters=
+{&max_allowed_packet, &net_buffer_length};
+
+MYSQL_PARAMETERS *STDCALL mysql_get_parameters()
+{
+  return &mysql_internal_parameters;
+}
+
 my_bool STDCALL mysql_thread_init()
 {
 #ifdef THREAD
diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def
index 721097905a8..b0433a34cb3 100644
--- a/libmysql/libmysql.def
+++ b/libmysql/libmysql.def
@@ -59,7 +59,6 @@ EXPORTS
 	is_prefix
 	list_add
 	list_delete
-	max_allowed_packet
 	my_casecmp
 	my_init
 	my_end
@@ -70,7 +69,6 @@ EXPORTS
 	my_realloc
 	mysql_thread_end
 	mysql_thread_init
-	net_buffer_length
 	set_dynamic
 	strcend
 	strdup_root
@@ -111,19 +109,4 @@ EXPORTS
 	load_defaults
 	free_defaults
 	my_path
-
-
-	
-	
-	
-	
-	
-	
-
-	
-
-
-
-
-
-
+	mysql_get_parameters
diff --git a/libmysql_r/Makefile.am b/libmysql_r/Makefile.am
index ae091d86a88..04b6f3b6c6c 100644
--- a/libmysql_r/Makefile.am
+++ b/libmysql_r/Makefile.am
@@ -18,7 +18,7 @@
 
 
 target = libmysqlclient_r.la
-target_defs = -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
+target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@
 LIBS = @LIBS@ @openssl_libs@
 
 INCLUDES =	@MT_INCLUDES@ -I$(srcdir)/../include -I../include \
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index 4a96cb64ce4..0ec7d161f24 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -23,6 +23,11 @@
 #define mysql_unix_port mysql_inix_port1
 #define mysql_port mysql_port1
 
+extern "C"
+{
+  unsigned long max_allowed_packet, net_buffer_length;
+}
+
 #if defined (__WIN__)
 #include "../sql/mysqld.cpp"
 #else
@@ -315,7 +320,6 @@ extern "C"
 
 static my_bool  org_my_init_done;
 my_bool         server_inited;
-ulong		max_allowed_packet, net_buffer_length;
 char **		copy_arguments_ptr= 0; 
 
 int STDCALL mysql_server_init(int argc, char **argv, char **groups)
diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c
index 2e8cd2a4861..6f60e4c4fbc 100644
--- a/libmysqld/libmysqld.c
+++ b/libmysqld/libmysqld.c
@@ -46,6 +46,9 @@
 #define INADDR_NONE	-1
 #endif
 
+extern ulong net_buffer_length;
+extern ulong max_allowed_packet;
+
 static my_bool	mysql_client_init=0;
 uint		mysql_port=0;
 my_string	mysql_unix_port=0;
@@ -722,6 +725,15 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
   return 0;
 }
 
+static MYSQL_PARAMETERS mysql_internal_parameters=
+{&max_allowed_packet, &net_buffer_length};
+
+MYSQL_PARAMETERS *STDCALL mysql_get_parameters()
+{
+  return &mysql_internal_parameters;
+}
+
+
 /****************************************************************************
 ** Init MySQL structure or allocate one
 ****************************************************************************/
diff --git a/libmysqld/libmysqld.def b/libmysqld/libmysqld.def
index 1c9bdea0a01..8db8a846562 100644
--- a/libmysqld/libmysqld.def
+++ b/libmysqld/libmysqld.def
@@ -63,6 +63,5 @@ EXPORTS
 	mysql_refresh
 	mysql_odbc_escape_string
 	myodbc_remove_escape
-	net_buffer_length
-	max_allowed_packet
 	get_tty_password
+	mysql_get_parameters
diff --git a/sql/log_event.cc b/sql/log_event.cc
index f84c8d1f579..f94056694cc 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -532,6 +532,7 @@ end:
 #else
 #define UNLOCK_MUTEX
 #define LOCK_MUTEX
+#define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet)
 #endif
 
 // allocates memory - the caller is responsible for clean-up
diff --git a/tools/mysqlmanager.c b/tools/mysqlmanager.c
index 27dfa18e421..ade6da895c6 100644
--- a/tools/mysqlmanager.c
+++ b/tools/mysqlmanager.c
@@ -355,7 +355,7 @@ LOG_MSG_FUNC(log_info,LOG_INFO)
 #ifndef DBUG_OFF
 LOG_MSG_FUNC(log_debug,LOG_DEBUG)
 #else
-void log_debug(const char* __attribute__((unused)) fmt,...) {}
+void log_debug(const char* fmt __attribute__((unused)),...) {}
 #endif
 
 static void handle_sigterm(int sig __attribute__((unused)))

From 9e983e629ed17adbd7753aa8196a2e172d3777c4 Mon Sep 17 00:00:00 2001
From: "marko@hundin.mysql.fi" <>
Date: Wed, 26 May 2004 19:41:14 +0300
Subject: [PATCH 06/24] InnoDB fixup: remove debug assertion that causes
 compile error when UNIV_DEBUG is defined (introduced in ChangeSet@1.1850)

---
 innobase/que/que0que.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/innobase/que/que0que.c b/innobase/que/que0que.c
index c53a31adc6f..0a2e607807a 100644
--- a/innobase/que/que0que.c
+++ b/innobase/que/que0que.c
@@ -190,8 +190,6 @@ que_thr_end_wait(
 	ut_ad(mutex_own(&kernel_mutex));
 #endif /* UNIV_SYNC_DEBUG */
 	ut_ad(thr);
-	ut_ad(next_thr);
-	ut_ad(*next_thr == NULL);
 	ut_ad((thr->state == QUE_THR_LOCK_WAIT)
 	      || (thr->state == QUE_THR_PROCEDURE_WAIT)
 	      || (thr->state == QUE_THR_SIG_REPLY_WAIT));

From c342318c6eea1f29a03100b4534a1b1ad63d92bc Mon Sep 17 00:00:00 2001
From: "monty@mysql.com" <>
Date: Wed, 26 May 2004 20:56:39 +0300
Subject: [PATCH 07/24] Fixed test to not crash when ndb is not in use

---
 mysql-test/t/ndb_minmax.test | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mysql-test/t/ndb_minmax.test b/mysql-test/t/ndb_minmax.test
index 1fa76488f5d..3be193ce602 100644
--- a/mysql-test/t/ndb_minmax.test
+++ b/mysql-test/t/ndb_minmax.test
@@ -1,3 +1,4 @@
+-- source include/have_ndb.inc
 
 --disable_warnings
 drop table if exists t1, t2;

From dab0b7d4159b6af8994cdc3de8324797e092c42c Mon Sep 17 00:00:00 2001
From: "monty@mysql.com" <>
Date: Wed, 26 May 2004 21:45:58 +0300
Subject: [PATCH 08/24] VC++ portability fix

---
 VC++Files/client/mysqlclient.dsp | 4 ++--
 VC++Files/innobase/innobase.dsp  | 4 ----
 sql/mysqld.cc                    | 2 +-
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/VC++Files/client/mysqlclient.dsp b/VC++Files/client/mysqlclient.dsp
index 9bf131f8243..b557d4cbd0f 100644
--- a/VC++Files/client/mysqlclient.dsp
+++ b/VC++Files/client/mysqlclient.dsp
@@ -41,7 +41,7 @@ RSC=rc.exe
 # PROP Intermediate_Dir "release"
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_TLS" /D "NDEBUG" /FD /c
+# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_TLS" /D "MYSQL_CLIENT" /D "NDEBUG" /FD /c
 # SUBTRACT CPP /YX
 # ADD BASE RSC /l 0x409
 # ADD RSC /l 0x409
@@ -65,7 +65,7 @@ LIB32=xilink6.exe -lib
 # PROP Intermediate_Dir "debug"
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_TLS" /FD /c
+# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_TLS" /D "MYSQL_CLIENT" /FD /c
 # SUBTRACT CPP /YX
 # ADD BASE RSC /l 0x409
 # ADD RSC /l 0x409
diff --git a/VC++Files/innobase/innobase.dsp b/VC++Files/innobase/innobase.dsp
index ea0aaeb3b83..03a57191270 100644
--- a/VC++Files/innobase/innobase.dsp
+++ b/VC++Files/innobase/innobase.dsp
@@ -312,10 +312,6 @@ SOURCE=.\pars\pars0sym.c
 # End Source File
 # Begin Source File
 
-SOURCE=.\que\que0que.c
-# End Source File
-# Begin Source File
-
 SOURCE=.\read\read0read.c
 # End Source File
 # Begin Source File
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index b55121b3bc6..65903d7ce8a 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1473,7 +1473,7 @@ void mysql_cb_init()
 }
 
 
-/ *To get the name of the NetWare volume having MySQL data folder */
+/* To get the name of the NetWare volume having MySQL data folder */
 
 void getvolumename()
 {

From f0ce42d60dc122a01940767e82aff69028d9f44e Mon Sep 17 00:00:00 2001
From: "mysqldev@mysql.com" <>
Date: Wed, 26 May 2004 21:39:15 +0200
Subject: [PATCH 09/24] logging_ok:   Logging to logging@openlogging.org
 accepted compile-pentium-max:   changed --with-ndbcluster to
 --without-ndbcluster because it fails on 4.1 builds

---
 BUILD/compile-pentium-max | 7 ++++++-
 BitKeeper/etc/logging_ok  | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/BUILD/compile-pentium-max b/BUILD/compile-pentium-max
index caf657a2049..5deedf7ac37 100755
--- a/BUILD/compile-pentium-max
+++ b/BUILD/compile-pentium-max
@@ -7,8 +7,13 @@ extra_flags="$pentium_cflags $fast_cflags -g"
 extra_configs="$pentium_configs"
 #strip=yes
 
+#extra_configs="$extra_configs --with-innodb --with-berkeley-db \
+#	--with-embedded-server --enable-thread-safe-client \
+#	--with-openssl --with-vio --with-raid --with-ndbcluster"
+# removed per discussion with Brian and Sanja because it makes Bootstrap
+# fail
 extra_configs="$extra_configs --with-innodb --with-berkeley-db \
 	--with-embedded-server --enable-thread-safe-client \
-	--with-openssl --with-vio --with-raid --with-ndbcluster"
+	--with-openssl --with-vio --with-raid --without-ndbcluster"
 
 . "$path/FINISH.sh"
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index ab36663aab3..fbe19a262fa 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -113,6 +113,7 @@ mwagner@work.mysql.com
 mydev@mysql.com
 mysql@home.(none)
 mysqldev@build.mysql2.com
+mysqldev@mysql.com
 ndbdev@ndbmaster.mysql.com
 nick@mysql.com
 nick@nick.leippe.com

From 833ec1653e9e0225328736bcaa8b03fec6d14000 Mon Sep 17 00:00:00 2001
From: "monty@mysql.com" <>
Date: Thu, 27 May 2004 02:47:04 +0300
Subject: [PATCH 10/24] netware files should always be in 'make dist' use
 opt_net_buffer_length instead of net_buffer_length

---
 Makefile.am         |  3 +--
 client/mysqldump.c  |  4 ++--
 configure.in        |  1 +
 netware/Makefile.am | 26 +++++++++++++++++++++++++-
 4 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 8aef19d0920..8a5df17c2cb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,9 +23,8 @@ EXTRA_DIST =		INSTALL-SOURCE README COPYING
 SUBDIRS =		. include @docs_dirs@ @readline_dir@ \
 			@thread_dirs@ pstack @sql_client_dirs@ \
 			@sql_server_dirs@ scripts man tests \
-			BUILD @netware_dir@ os2 @libmysqld_dirs@ \
+			BUILD netware os2 @libmysqld_dirs@ \
 			@bench_dirs@ support-files @fs_dirs@ @tools_dirs@
-			
 
 # Relink after clean
 linked_sources = linked_client_sources linked_server_sources \
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 82c3ee53e33..6dad8182b87 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -1080,7 +1080,7 @@ static void dumpTable(uint numFields, char *table)
     if (opt_lock)
       fprintf(md_result_file,"LOCK TABLES %s WRITE;\n", opt_quoted_table);
 
-    total_length=net_buffer_length;		/* Force row break */
+    total_length= opt_net_buffer_length;		/* Force row break */
     row_break=0;
     rownr=0;
     init_length=(uint) strlen(insert_pat)+4;
@@ -1225,7 +1225,7 @@ static void dumpTable(uint numFields, char *table)
 	ulong row_length;
 	dynstr_append(&extended_row,")");
         row_length = 2 + extended_row.length;
-        if (total_length + row_length < net_buffer_length)
+        if (total_length + row_length < opt_net_buffer_length)
         {
 	  total_length += row_length;
 	  fputc(',',md_result_file);		/* Always row break */
diff --git a/configure.in b/configure.in
index 7a1d2228961..29a887076ac 100644
--- a/configure.in
+++ b/configure.in
@@ -2482,6 +2482,7 @@ if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null; then
 fi
 AC_SUBST(netware_dir)
 AC_SUBST(linked_netware_sources)
+AM_CONDITIONAL(HAVE_NETWARE, test "$netware_dir" = "netware")
 
 if test "$with_server" = "yes" -o "$THREAD_SAFE_CLIENT" != "no"
 then
diff --git a/netware/Makefile.am b/netware/Makefile.am
index 8d7efec8e3c..7d7d0a096e1 100644
--- a/netware/Makefile.am
+++ b/netware/Makefile.am
@@ -14,6 +14,7 @@
 #  along with this program; if not, write to the Free Software 
 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
+if HAVE_NETWARE
 INCLUDES =			-I$(srcdir)/../include -I../include -I..
 bin_PROGRAMS =			mysqld_safe mysql_install_db mysql_test_run libmysql
 mysqld_safe_SOURCES=		mysqld_safe.c my_manage.c
@@ -43,7 +44,30 @@ link_sources:
 	  org=`echo $$f | sed -e 's/.*\/\(.*\)/\1/g'`; \
 	  @LN_CP_F@ $(srcdir)/$$org $(srcdir)/../$$f; \
 	done;
-
+else
+EXTRA_DIST=	comp_err.def init_db.sql install_test_db.ncf \
+		isamchk.def isamlog.def libmysql.def libmysql.imp \
+		libmysqlmain.c my_manage.c my_manage.h \
+		my_print_defaults.def myisam_ftdump.def myisamchk.def \
+		myisamlog.def myisampack.def mysql.def mysql.xdc \
+		mysql_fix_privilege_tables.pl mysql_install.def \
+		mysql_install_db.c mysql_install_db.def \
+		mysql_secure_installation.pl mysql_test_run.c \
+		mysql_test_run.def mysql_waitpid.def mysqladmin.def \
+		mysqlbinlog.def mysqlcheck.def mysqld.def \
+		mysqld_safe.c mysqld_safe.def mysqldump.def mysqlimport.def \
+		mysqlshow.def mysqltest.def pack_isam.def perror.def \
+		replace.def resolve_stack_dump.def resolveip.def test_db.sql \
+		BUILD/apply-patch BUILD/compile-AUTOTOOLS \
+		BUILD/compile-linux-tools BUILD/compile-netware-END \
+		BUILD/compile-netware-START BUILD/compile-netware-all\
+		BUILD/compile-netware-debug BUILD/compile-netware-max \
+		BUILD/compile-netware-max-debug BUILD/compile-netware-src \
+		BUILD/compile-netware-standard BUILD/create-patch \
+		BUILD/cron-build BUILD/crontab BUILD/knetware.imp \
+		BUILD/mwasmnlm BUILD/mwccnlm BUILD/mwenv BUILD/mwldnlm \
+		BUILD/nwbootstrap BUILD/openssl.imp BUILD/save-patch
+endif
 
 # Don't update the files from bitkeeper
 %::SCCS/s.%

From 272c3a2669727e673c5ad6aa02035a5981ea29df Mon Sep 17 00:00:00 2001
From: "monty@mysql.com" <>
Date: Thu, 27 May 2004 02:50:42 +0300
Subject: [PATCH 11/24] After merge fixes

---
 Docs/manual_toc.html  | 9 +++++++++
 libmysqld/lib_sql.cc  | 2 +-
 libmysqld/libmysqld.c | 9 ---------
 3 files changed, 10 insertions(+), 10 deletions(-)
 create mode 100644 Docs/manual_toc.html

diff --git a/Docs/manual_toc.html b/Docs/manual_toc.html
new file mode 100644
index 00000000000..b9014e5efb9
--- /dev/null
+++ b/Docs/manual_toc.html
@@ -0,0 +1,9 @@
+<html>
+<head>
+<title>Place holder for manual_toc.html</title>
+</head>
+<body>
+This is just a place holder for the autogenerated manual_toc.html
+to make "make dist" happy.
+</body>
+</html>
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index 26609e748a7..2ceeb43a91e 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -25,7 +25,7 @@
 
 extern "C"
 {
-  unsigned long max_allowed_packet, net_buffer_length;
+  extern unsigned long max_allowed_packet, net_buffer_length;
 }
 
 static int fake_argc= 1;
diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c
index b4804c62f2d..3b9c2bab448 100644
--- a/libmysqld/libmysqld.c
+++ b/libmysqld/libmysqld.c
@@ -85,15 +85,6 @@ static void end_server(MYSQL *mysql)
 }
 
 
-static MYSQL_PARAMETERS mysql_internal_parameters=
-{&max_allowed_packet, &net_buffer_length};
-
-MYSQL_PARAMETERS *STDCALL mysql_get_parameters()
-{
-  return &mysql_internal_parameters;
-}
-
-
 static int mysql_init_charset(MYSQL *mysql)
 {
   char charset_name_buff[16], *charset_name;

From f0d79c5aba4d46bd583287ae8ff70b973264e61b Mon Sep 17 00:00:00 2001
From: "monty@mysql.com" <>
Date: Thu, 27 May 2004 02:53:00 +0300
Subject: [PATCH 12/24] Added new netware file

---
 netware/Makefile.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/netware/Makefile.am b/netware/Makefile.am
index 5ef71301574..324c6fd13fa 100644
--- a/netware/Makefile.am
+++ b/netware/Makefile.am
@@ -58,6 +58,7 @@ EXTRA_DIST=	comp_err.def init_db.sql install_test_db.ncf \
 		mysqld_safe.c mysqld_safe.def mysqldump.def mysqlimport.def \
 		mysqlshow.def mysqltest.def pack_isam.def perror.def \
 		replace.def resolve_stack_dump.def resolveip.def test_db.sql \
+		static_init_db.sql \
 		BUILD/apply-patch BUILD/compile-AUTOTOOLS \
 		BUILD/compile-linux-tools BUILD/compile-netware-END \
 		BUILD/compile-netware-START BUILD/compile-netware-all\

From e938fb8fda4723e7a242161d00f14f83ee1f0fa9 Mon Sep 17 00:00:00 2001
From: "tomas@mc05.(none)" <>
Date: Thu, 27 May 2004 09:45:42 +0200
Subject: [PATCH 13/24] removed version 2 backwards compatability from ndb
 restore

---
 .../kernel/blocks/backup/restore/Restore.cpp  | 178 +----------------
 .../kernel/blocks/backup/restore/Restore.hpp  |  16 +-
 ndb/src/kernel/blocks/backup/restore/main.cpp | 179 +-----------------
 3 files changed, 21 insertions(+), 352 deletions(-)

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 0c075e18933..8f5156e2b81 100644
--- a/ndb/src/kernel/blocks/backup/restore/Restore.hpp
+++ b/ndb/src/kernel/blocks/backup/restore/Restore.hpp
@@ -28,9 +28,6 @@
 #include <ndb_version.h>
 #include <version.h>
 
-#define VERSION_3X 3
-
-
 const int FileNameLenC = 256;
 const int TableNameLenC = 256;
 const int AttrNameLenC = 256;
@@ -150,11 +147,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;
@@ -244,8 +238,7 @@ class RestoreMetaData : public BackupFile {
 
   myVector<TableS *> allTables;
   bool readMetaFileHeader();
-  bool readMetaTableDesc(const char * catalog, 
-			 const char * schema);
+  bool readMetaTableDesc();
 		
   bool readGCPEntry();
   Uint32 readMetaTableList();
@@ -253,17 +246,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 4c15785d5c2..85cb303e25b 100644
--- a/ndb/src/kernel/blocks/backup/restore/main.cpp
+++ b/ndb/src/kernel/blocks/backup/restore/main.cpp
@@ -69,10 +69,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
@@ -206,18 +202,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 "
@@ -353,10 +337,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
@@ -368,41 +348,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;
   }
 
@@ -879,10 +837,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)
   {
@@ -1106,7 +1068,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) 
   {
@@ -1116,81 +1077,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
 }
 
 
@@ -1314,26 +1200,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) 
 	{
@@ -1358,48 +1224,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();
       }
     }

From 4e75c1210b02fd977307fc21d346ae82f3505101 Mon Sep 17 00:00:00 2001
From: "tomas@poseidon.(none)" <>
Date: Thu, 27 May 2004 11:16:14 +0000
Subject: [PATCH 14/24] fix for gcc version 3 bug

---
 ndb/src/common/portlib/gcc.cpp | 2 +-
 ndb/src/common/util/new.cpp    | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

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/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

From b504425751273ef13ce2e3919077349f20ea0ab9 Mon Sep 17 00:00:00 2001
From: "tomas@poseidon.(none)" <>
Date: Thu, 27 May 2004 12:14:19 +0000
Subject: [PATCH 15/24] see resp file

---
 configure.in                           | 8 ++++----
 ndb/src/common/transporter/Makefile.am | 5 +++--
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/configure.in b/configure.in
index 46f56dfc404..419bb1dbc15 100644
--- a/configure.in
+++ b/configure.in
@@ -1615,19 +1615,19 @@ then
   # Medium debug.
   CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DDBUG_ON -DSAFE_MUTEX $CFLAGS"
   CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS"
-  #NDB_DEFS="-DNDB_RELEASE -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
-  NDB_DEFS="-DNDB_DEBUG -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
+  #NDB_DEFS="-DNDB_RELEASE -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD \$(NDB_EXTRA_FLAGS)""
+  NDB_DEFS="-DNDB_DEBUG -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD \$(NDB_EXTRA_FLAGS)""
 elif test "$with_debug" = "full"
 then
   # Full debug. Very slow in some cases
   CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS"
   CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
-  NDB_DEFS="-DNDB_DEBUG -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
+  NDB_DEFS="-DNDB_DEBUG -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD \$(NDB_EXTRA_FLAGS)""
 else
   # Optimized version. No debug
   CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS"
   CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS"
-  NDB_DEFS="-DNDB_RELEASE -DUSE_EMULATED_JAM -DNDEBUG"
+  NDB_DEFS="-DNDB_RELEASE -DUSE_EMULATED_JAM -DNDEBUG \$(NDB_EXTRA_FLAGS)"
 fi
 
 # Force static compilation to avoid linking problems/get more speed
diff --git a/ndb/src/common/transporter/Makefile.am b/ndb/src/common/transporter/Makefile.am
index 8c46cc29051..1eff91a20ca 100644
--- a/ndb/src/common/transporter/Makefile.am
+++ b/ndb/src/common/transporter/Makefile.am
@@ -6,8 +6,9 @@ libtransporter_la_SOURCES = \
 	SendBuffer.cpp   \
 	TCP_Transporter.cpp \
 	TransporterRegistry.cpp \
-        Packer.cpp \
-	SHM_Transporter.cpp
+        Packer.cpp
+
+#	SHM_Transporter.cpp
 
 include $(top_srcdir)/ndb/config/common.mk.am
 include $(top_srcdir)/ndb/config/type_util.mk.am

From fb54a0c486a51c4371416c31ffde0efa35d984d7 Mon Sep 17 00:00:00 2001
From: "tomas@poseidon.(none)" <>
Date: Thu, 27 May 2004 13:33:19 +0000
Subject: [PATCH 16/24] oops

---
 configure.in            | 8 ++++----
 ndb/config/common.mk.am | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/configure.in b/configure.in
index 419bb1dbc15..46f56dfc404 100644
--- a/configure.in
+++ b/configure.in
@@ -1615,19 +1615,19 @@ then
   # Medium debug.
   CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DDBUG_ON -DSAFE_MUTEX $CFLAGS"
   CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS"
-  #NDB_DEFS="-DNDB_RELEASE -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD \$(NDB_EXTRA_FLAGS)""
-  NDB_DEFS="-DNDB_DEBUG -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD \$(NDB_EXTRA_FLAGS)""
+  #NDB_DEFS="-DNDB_RELEASE -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
+  NDB_DEFS="-DNDB_DEBUG -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
 elif test "$with_debug" = "full"
 then
   # Full debug. Very slow in some cases
   CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS"
   CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
-  NDB_DEFS="-DNDB_DEBUG -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD \$(NDB_EXTRA_FLAGS)""
+  NDB_DEFS="-DNDB_DEBUG -DUSE_EMULATED_JAM -DVM_TRACE -DERROR_INSERT -DARRAY_GUARD"
 else
   # Optimized version. No debug
   CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS"
   CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS"
-  NDB_DEFS="-DNDB_RELEASE -DUSE_EMULATED_JAM -DNDEBUG \$(NDB_EXTRA_FLAGS)"
+  NDB_DEFS="-DNDB_RELEASE -DUSE_EMULATED_JAM -DNDEBUG"
 fi
 
 # Force static compilation to avoid linking problems/get more speed
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

From 2573f890ae104692675ef47f686c27e44ad707b8 Mon Sep 17 00:00:00 2001
From: "tomas@poseidon.(none)" <>
Date: Thu, 27 May 2004 15:47:31 +0000
Subject: [PATCH 17/24] changed to ndbclient

---
 acinclude.m4               |  2 +-
 ndb/src/Makefile.am        | 13 +++++++++++++
 ndb/src/mgmapi/Makefile.am |  2 +-
 ndb/src/ndbapi/Makefile.am |  2 +-
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 60b53ec39d5..27e1ae91189 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1355,7 +1355,7 @@ AC_DEFUN([MYSQL_CHECK_NDBCLUSTER], [
       AC_DEFINE(HAVE_NDBCLUSTER_DB)
       have_ndbcluster="yes"
       ndbcluster_includes="-I../ndb/include -I../ndb/include/ndbapi"
-      ndbcluster_libs="\$(top_builddir)/ndb/src/ndbapi/libNDB_API.la"
+      ndbcluster_libs="\$(top_builddir)/ndb/src/libndbclient.la"
       ndbcluster_system_libs=""
       ;;
     * )
diff --git a/ndb/src/Makefile.am b/ndb/src/Makefile.am
index 745a33ccf45..c81950fcea3 100644
--- a/ndb/src/Makefile.am
+++ b/ndb/src/Makefile.am
@@ -1 +1,14 @@
 SUBDIRS = common mgmapi ndbapi kernel mgmsrv mgmclient cw
+
+ndblib_LTLIBRARIES = libndbclient.la
+
+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/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   \

From 12709128d51e27601413ac23007089c11c61666f Mon Sep 17 00:00:00 2001
From: "tomas@poseidon.(none)" <>
Date: Thu, 27 May 2004 16:28:41 +0000
Subject: [PATCH 18/24] ndb fixes see files

---
 acconfig.h                                 |  6 ++++
 acinclude.m4                               | 39 ++++++++++++++++++++++
 configure.in                               |  5 +--
 ndb/src/common/transporter/Makefile.am     |  3 +-
 ndb/src/common/transporter/Transporter.hpp |  2 ++
 5 files changed, 50 insertions(+), 5 deletions(-)

diff --git a/acconfig.h b/acconfig.h
index 67e9d1759c6..54e0ff94e18 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -155,6 +155,12 @@
 /* Using Ndb Cluster DB */
 #undef HAVE_NDBCLUSTER_DB
 
+/* Including Ndb Cluster DB shared memory transporter */
+#undef NDB_SHM_TRANSPORTER
+
+/* Including Ndb Cluster DB sci transporter */
+#undef NDB_SCI_TRANSPORTER
+
 /* For some non posix threads */
 #undef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC
 
diff --git a/acinclude.m4 b/acinclude.m4
index 27e1ae91189..1d2b7d4d11d 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1337,6 +1337,45 @@ dnl Macro: MYSQL_CHECK_NDBCLUSTER
 dnl Sets HAVE_NDBCLUSTER_DB if --with-ndbcluster is used
 dnl ---------------------------------------------------------------------------
                                                                                 
+AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
+  AC_ARG_WITH([ndb-shm],
+              [
+  --with-ndb-shm        Include the NDB Cluster shared memory transporter],
+              [ndb-shm="$withval"],
+              [ndb-shm=no])
+  AC_ARG_WITH([ndb-sci],
+              [
+  --with-ndb-sci        Include the NDB Cluster sci transporter],
+              [ndb-sci="$withval"],
+              [ndb-sci=no])
+                                                                                
+  AC_MSG_CHECKING([for NDB Cluster options])
+                                                                                
+  have_ndb_shm=no
+  case "$ndb-shm" in
+    yes )
+      AC_MSG_RESULT([Including NDB Cluster shared memory transporter])
+      AC_DEFINE(NDB_SHM_TRANSPORTER)
+      have_ndb_shm="yes"
+      ;;
+    * )
+      AC_MSG_RESULT([Not including NDB Cluster shared memory transporter])
+      ;;
+  esac
+
+  have_ndb_sci=no
+  case "$ndb-sci" in
+    yes )
+      AC_MSG_RESULT([Including NDB Cluster sci transporter])
+      AC_DEFINE(NDB_SCI_TRANSPORTER)
+      have_ndb_sci="yes"
+      ;;
+    * )
+      AC_MSG_RESULT([Not including NDB Cluster sci transporter])
+      ;;
+  esac
+])
+
 AC_DEFUN([MYSQL_CHECK_NDBCLUSTER], [
   AC_ARG_WITH([ndbcluster],
               [
diff --git a/configure.in b/configure.in
index 46f56dfc404..f3d785ff19e 100644
--- a/configure.in
+++ b/configure.in
@@ -1120,7 +1120,7 @@ dnl Is this the right match for DEC OSF on alpha?
         sql/Makefile.in)
           # Use gen_lex_hash.linux instead of gen_lex_hash
           # Add library dependencies to mysqld_DEPENDENCIES
-          lib_DEPENDENCIES="\$(bdb_libs_with_path) \$(innodb_libs) \$(pstack_libs) \$(innodb_system_libs) \$(openssl_libs)"
+          lib_DEPENDENCIES="\$(bdb_libs_with_path) \$(innodb_libs) \$(ndbcluster_libs) \$(pstack_libs) \$(innodb_system_libs) \$(openssl_libs)"
           cat > $filesed << EOF
 s,\(^.*\$(MAKE) gen_lex_hash\)\$(EXEEXT),#\1,
 s,\(\./gen_lex_hash\)\$(EXEEXT),\1.linux,
@@ -2925,9 +2925,6 @@ AC_SUBST(mgmapiincludedir)
   #AC_SUBST(NDB_TYPE_KERNEL)
   #AC_SUBST(NDB_TYPE_UTIL)
 
-#  define(NDB_MAKEFILES, [ dnl
-#   ])
-
 AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
 
 # Output results
diff --git a/ndb/src/common/transporter/Makefile.am b/ndb/src/common/transporter/Makefile.am
index 1eff91a20ca..9e697076cda 100644
--- a/ndb/src/common/transporter/Makefile.am
+++ b/ndb/src/common/transporter/Makefile.am
@@ -10,9 +10,10 @@ libtransporter_la_SOURCES = \
 
 #	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"

From d4f71fb583960a101ef9db90ee0be94d3067b455 Mon Sep 17 00:00:00 2001
From: "tomas@poseidon.(none)" <>
Date: Thu, 27 May 2004 16:38:40 +0000
Subject: [PATCH 19/24] fix ndb make

---
 ndb/config/type_ndbapitest.mk.am | 3 +--
 ndb/src/Makefile.am              | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/ndb/config/type_ndbapitest.mk.am b/ndb/config/type_ndbapitest.mk.am
index 20ba5032d02..0a27b819648 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/ndbapi/libndbclient.la
 
 INCLUDES += @NDB_NDBAPITEST_INCLUDES@
diff --git a/ndb/src/Makefile.am b/ndb/src/Makefile.am
index c81950fcea3..8e9b7abab52 100644
--- a/ndb/src/Makefile.am
+++ b/ndb/src/Makefile.am
@@ -2,6 +2,8 @@ SUBDIRS = common mgmapi ndbapi kernel mgmsrv mgmclient cw
 
 ndblib_LTLIBRARIES = libndbclient.la
 
+libndbclient_SOURCES =
+
 libndbclient_la_LIBADD =  \
               $(top_srcdir)/ndb/src/ndbapi/libndbapi.la \
               $(top_srcdir)/ndb/src/common/transporter/libtransporter.la   \

From 45718caa040aafcc29bd684f85fac74e946a234c Mon Sep 17 00:00:00 2001
From: "tomas@poseidon.(none)" <>
Date: Thu, 27 May 2004 16:41:55 +0000
Subject: [PATCH 20/24] oops ndb mistake

---
 ndb/config/type_ndbapitest.mk.am                 | 2 +-
 ndb/src/kernel/blocks/backup/restore/Makefile.am | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ndb/config/type_ndbapitest.mk.am b/ndb/config/type_ndbapitest.mk.am
index 0a27b819648..02288d06c2c 100644
--- a/ndb/config/type_ndbapitest.mk.am
+++ b/ndb/config/type_ndbapitest.mk.am
@@ -1,5 +1,5 @@
 
 LDADD += $(top_srcdir)/ndb/test/src/libNDBT.a \
-         $(top_srcdir)/ndb/src/ndbapi/libndbclient.la
+         $(top_srcdir)/ndb/src/libndbclient.la
 
 INCLUDES += @NDB_NDBAPITEST_INCLUDES@
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
 

From fe146fdb77dc15c19cd540fe9aedfe4846ef7580 Mon Sep 17 00:00:00 2001
From: "mronstrom@mysql.com" <>
Date: Thu, 27 May 2004 18:41:56 +0200
Subject: [PATCH 21/24] Fix for building libndbclient before entering kernel

---
 ndb/src/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ndb/src/Makefile.am b/ndb/src/Makefile.am
index 8e9b7abab52..99ce0a25d6b 100644
--- a/ndb/src/Makefile.am
+++ b/ndb/src/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = common mgmapi ndbapi kernel mgmsrv mgmclient cw
+SUBDIRS = common mgmapi ndbapi . kernel mgmsrv mgmclient cw
 
 ndblib_LTLIBRARIES = libndbclient.la
 

From aa8bccd3b5d82ece4477caef9cb10c68a117b36c Mon Sep 17 00:00:00 2001
From: "mronstrom@mysql.com" <>
Date: Thu, 27 May 2004 18:41:57 +0200
Subject: [PATCH 22/24] Fix for source of libndbclient

---
 ndb/src/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ndb/src/Makefile.am b/ndb/src/Makefile.am
index 99ce0a25d6b..2999c617a06 100644
--- a/ndb/src/Makefile.am
+++ b/ndb/src/Makefile.am
@@ -2,7 +2,7 @@ SUBDIRS = common mgmapi ndbapi . kernel mgmsrv mgmclient cw
 
 ndblib_LTLIBRARIES = libndbclient.la
 
-libndbclient_SOURCES =
+libndbclient_la_SOURCES =
 
 libndbclient_la_LIBADD =  \
               $(top_srcdir)/ndb/src/ndbapi/libndbapi.la \

From eff14ee4fe1f945854c6018b90f286bbd6834638 Mon Sep 17 00:00:00 2001
From: "joreland@mysql.com" <>
Date: Thu, 27 May 2004 21:03:05 +0200
Subject: [PATCH 23/24] Use ndbclient more

---
 configure.in                        |  2 ++
 ndb/config/type_ndbapi.mk.am        |  1 -
 ndb/config/type_util.mk.am          |  5 -----
 ndb/src/cw/cpcd/Makefile.am         |  2 +-
 ndb/src/kernel/ndb-main/Makefile.am |  6 +++---
 ndb/src/mgmclient/Makefile.am       | 12 ++++--------
 ndb/src/mgmsrv/Makefile.am          |  9 ++++-----
 ndb/test/run-test/Makefile.am       |  5 +++--
 8 files changed, 17 insertions(+), 25 deletions(-)

diff --git a/configure.in b/configure.in
index f3d785ff19e..dab7288c468 100644
--- a/configure.in
+++ b/configure.in
@@ -2879,6 +2879,7 @@ AC_SUBST(mgmapiincludedir)
 	-I\$(top_srcdir)/ndb/include/kernel \
 	-I\$(top_srcdir)/ndb/include/transporter \
 	-I\$(top_srcdir)/ndb/include/debugger \
+        -I\$(top_srcdir)/ndb/include/mgmapi \
 	-I\$(top_srcdir)/ndb/include/mgmcommon \
         -I\$(top_srcdir)/ndb/include/ndbapi \
         -I\$(top_srcdir)/ndb/include/util \
@@ -2890,6 +2891,7 @@ AC_SUBST(mgmapiincludedir)
 	-I\$(top_srcdir)/ndb/include/transporter \
 	-I\$(top_srcdir)/ndb/include/debugger \
 	-I\$(top_srcdir)/ndb/include/mgmcommon \
+        -I\$(top_srcdir)/ndb/include/mgmapi \
         -I\$(top_srcdir)/ndb/include/ndbapi \
         -I\$(top_srcdir)/ndb/include/util \
 	-I\$(top_srcdir)/ndb/include/portlib \
diff --git a/ndb/config/type_ndbapi.mk.am b/ndb/config/type_ndbapi.mk.am
index a9c98f3f6e6..864690cec7b 100644
--- a/ndb/config/type_ndbapi.mk.am
+++ b/ndb/config/type_ndbapi.mk.am
@@ -1,3 +1,2 @@
 
 INCLUDES += @NDB_NDBAPI_INCLUDES@
-LDADD += $(top_srcdir)/ndb/src/ndbapi/libNDB_API.la
diff --git a/ndb/config/type_util.mk.am b/ndb/config/type_util.mk.am
index 8c9c7e0b504..4a3740ff811 100644
--- a/ndb/config/type_util.mk.am
+++ b/ndb/config/type_util.mk.am
@@ -1,7 +1,2 @@
 
-LDADD += \
-              $(top_srcdir)/ndb/src/common/logger/liblogger.la       \
-              $(top_srcdir)/ndb/src/common/util/libgeneral.la \
-              $(top_srcdir)/ndb/src/common/portlib/unix/libportlib.la
-
 INCLUDES += @NDB_UTIL_INCLUDES@
diff --git a/ndb/src/cw/cpcd/Makefile.am b/ndb/src/cw/cpcd/Makefile.am
index 0d38f4ca536..53eeaa48dc3 100644
--- a/ndb/src/cw/cpcd/Makefile.am
+++ b/ndb/src/cw/cpcd/Makefile.am
@@ -3,7 +3,7 @@ ndbtools_PROGRAMS = ndb_cpcd
 
 ndb_cpcd_SOURCES = main.cpp CPCD.cpp Process.cpp APIService.cpp Monitor.cpp common.cpp
 
-LDADD_LOC = $(top_srcdir)/ndb/src/common/logger/liblogger.la
+LDADD_LOC = $(top_srcdir)/ndb/src/libndbclient.la
 
 include $(top_srcdir)/ndb/config/common.mk.am
 include $(top_srcdir)/ndb/config/type_util.mk.am
diff --git a/ndb/src/kernel/ndb-main/Makefile.am b/ndb/src/kernel/ndb-main/Makefile.am
index 731f79585ed..77565800f71 100644
--- a/ndb/src/kernel/ndb-main/Makefile.am
+++ b/ndb/src/kernel/ndb-main/Makefile.am
@@ -24,7 +24,6 @@ INCLUDES += \
               -I../blocks/dbtux
 
 LDADD +=  \
-              $(top_srcdir)/ndb/src/mgmapi/libmgmapi.la \
               ../blocks/cmvmi/libcmvmi.a \
               ../blocks/dbacc/libdbacc.a \
               ../blocks/dbdict/libdbdict.a \
@@ -46,9 +45,10 @@ LDADD +=  \
               $(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/common/portlib/unix/libportlib.la      \
               $(top_srcdir)/ndb/src/common/logger/liblogger.la       \
+              $(top_srcdir)/ndb/src/common/mgmcommon/libmgmsrvcommon.la \
+              $(top_srcdir)/ndb/src/mgmapi/libmgmapi.la \
+              $(top_srcdir)/ndb/src/common/portlib/unix/libportlib.la      \
               $(top_srcdir)/ndb/src/common/util/libgeneral.la 
 
 # Don't update the files from bitkeeper
diff --git a/ndb/src/mgmclient/Makefile.am b/ndb/src/mgmclient/Makefile.am
index e01e4b4f371..a560d8e6d6f 100644
--- a/ndb/src/mgmclient/Makefile.am
+++ b/ndb/src/mgmclient/Makefile.am
@@ -8,16 +8,12 @@ mgmtclient_SOURCES = \
 
 include $(top_srcdir)/ndb/config/common.mk.am
 include $(top_srcdir)/ndb/config/type_ndbapi.mk.am
+
 INCLUDES += -I$(top_srcdir)/ndb/include/mgmapi -I$(top_srcdir)/ndb/src/common/mgmcommon
 
-LDADD += \
-	$(top_srcdir)/ndb/src/common/debugger/libtrace.la \
-	$(top_srcdir)/ndb/src/common/logger/liblogger.la \
-	$(top_srcdir)/ndb/src/common/util/libgeneral.la \
-	$(top_srcdir)/ndb/src/mgmapi/libmgmapi.la \
-	$(top_srcdir)/ndb/src/common/mgmcommon/libmgmsrvcommon.la \
-	$(top_srcdir)/ndb/src/common/portlib/unix/libportlib.la \
-	$(top_srcdir)/ndb/src/common/editline/libeditline.a
+LDADD_LOC = $(top_srcdir)/ndb/src/libndbclient.la \
+            $(top_srcdir)/ndb/src/common/editline/libeditline.a \
+            @TERMCAP_LIB@
 
 # Don't update the files from bitkeeper
 %::SCCS/s.%
diff --git a/ndb/src/mgmsrv/Makefile.am b/ndb/src/mgmsrv/Makefile.am
index 272338d02ac..b70f8937b3b 100644
--- a/ndb/src/mgmsrv/Makefile.am
+++ b/ndb/src/mgmsrv/Makefile.am
@@ -13,12 +13,11 @@ mgmtsrvr_SOURCES = \
 	MgmtSrvrConfig.cpp \
 	CommandInterpreter.cpp
 
-INCLUDES_LOC = -I$(top_srcdir)/ndb/src/ndbapi -I$(top_srcdir)/ndb/include/mgmapi -I$(top_srcdir)/ndb/src/common/mgmcommon
+INCLUDES_LOC = -I$(top_srcdir)/ndb/src/ndbapi -I$(top_srcdir)/ndb/src/common/mgmcommon
 
-LDADD_LOC = \
-	$(top_srcdir)/ndb/src/mgmapi/libmgmapi.la \
-	$(top_srcdir)/ndb/src/common/editline/libeditline.a \
-	@TERMCAP_LIB@
+LDADD_LOC = $(top_srcdir)/ndb/src/libndbclient.la \
+	    $(top_srcdir)/ndb/src/common/editline/libeditline.a \
+	    @TERMCAP_LIB@
 
 include $(top_srcdir)/ndb/config/common.mk.am
 include $(top_srcdir)/ndb/config/type_ndbapi.mk.am
diff --git a/ndb/test/run-test/Makefile.am b/ndb/test/run-test/Makefile.am
index 11dc15a0988..205c315cb04 100644
--- a/ndb/test/run-test/Makefile.am
+++ b/ndb/test/run-test/Makefile.am
@@ -6,11 +6,12 @@ atrt_SOURCES = main.cpp
 ndbtest_SCRIPTS = atrt-analyze-result.sh atrt-gather-result.sh atrt-setup.sh \
           atrt-clear-result.sh make-config.sh
 
-INCLUDES_LOC = -I$(top_srcdir)/ndb/include/mgmapi -I$(top_srcdir)/ndb/src/mgmclient
-LDADD_LOC = $(top_srcdir)/ndb/src/mgmapi/libmgmapi.la $(top_srcdir)/ndb/src/mgmclient/CpcClient.o
+INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmclient
+LDADD_LOC = $(top_srcdir)/ndb/src/mgmclient/CpcClient.o $(top_srcdir)/ndb/src/libndbclient.la
 
 include $(top_srcdir)/ndb/config/common.mk.am
 include $(top_srcdir)/ndb/config/type_util.mk.am
+include $(top_srcdir)/ndb/config/type_mgmapiclient.mk.am
 
 # Don't update the files from bitkeeper
 %::SCCS/s.%

From 621b0b29a2bcee6c7e8886336483f2fd7362b486 Mon Sep 17 00:00:00 2001
From: "joreland@mysql.com" <>
Date: Thu, 27 May 2004 21:18:45 +0200
Subject: [PATCH 24/24] Fix dependency for mgmsrv

---
 ndb/src/mgmsrv/Makefile.am | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ndb/src/mgmsrv/Makefile.am b/ndb/src/mgmsrv/Makefile.am
index b70f8937b3b..439d126dc5b 100644
--- a/ndb/src/mgmsrv/Makefile.am
+++ b/ndb/src/mgmsrv/Makefile.am
@@ -13,7 +13,9 @@ mgmtsrvr_SOURCES = \
 	MgmtSrvrConfig.cpp \
 	CommandInterpreter.cpp
 
-INCLUDES_LOC = -I$(top_srcdir)/ndb/src/ndbapi -I$(top_srcdir)/ndb/src/common/mgmcommon
+INCLUDES_LOC = -I$(top_srcdir)/ndb/src/ndbapi \
+               -I$(top_srcdir)/ndb/src/mgmapi \
+               -I$(top_srcdir)/ndb/src/common/mgmcommon
 
 LDADD_LOC = $(top_srcdir)/ndb/src/libndbclient.la \
 	    $(top_srcdir)/ndb/src/common/editline/libeditline.a \