#At file:///data0/magnus/mysql/tmp/5.5-telco-7.0/ based on revid:magnus.blaudd@strippedxgbogha
3216 Magnus Blåudd 2011-02-21 [merge]
Merge
added:
storage/ndb/include/util/NdbTypesUtil.hpp
modified:
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.h
sql/ha_ndbcluster_binlog.cc
sql/ha_ndbcluster_binlog.h
storage/ndb/include/util/NdbSqlUtil.hpp
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
storage/ndb/src/kernel/blocks/lgman.cpp
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
storage/ndb/test/ndbapi/testSystemRestart.cpp
storage/ndb/test/run-test/conf-dl145a.cnf
storage/ndb/test/run-test/conf-ndb07.cnf
storage/ndb/tools/restore/consumer_restore.cpp
storage/ndb/tools/restore/consumer_restore.hpp
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2011-02-16 10:07:23 +0000
+++ b/sql/ha_ndbcluster.cc 2011-02-21 12:34:53 +0000
@@ -9469,16 +9469,6 @@ ha_ndbcluster::ha_ndbcluster(handlerton
}
-int ha_ndbcluster::ha_initialise()
-{
- DBUG_ENTER("ha_ndbcluster::ha_initialise");
- if (check_ndb_in_thd(current_thd))
- {
- DBUG_RETURN(FALSE);
- }
- DBUG_RETURN(TRUE);
-}
-
/**
Destructor for NDB Cluster table handler.
*/
=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h 2011-02-16 08:58:32 +0000
+++ b/sql/ha_ndbcluster.h 2011-02-21 12:09:15 +0000
@@ -377,7 +377,6 @@ class ha_ndbcluster: public handler
ha_ndbcluster(handlerton *hton, TABLE_SHARE *table);
~ha_ndbcluster();
- int ha_initialise();
#ifndef NDB_WITHOUT_READ_BEFORE_WRITE_REMOVAL
void column_bitmaps_signal(uint sig_type);
#endif
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2011-02-16 08:58:32 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2011-02-21 12:09:15 +0000
@@ -4901,44 +4901,6 @@ ndbcluster_drop_event(THD *thd, Ndb *ndb
DBUG_RETURN(0);
}
-int
-ndbcluster_handle_alter_table(THD *thd, NDB_SHARE *share, const char *type_str)
-{
- DBUG_ENTER("ndbcluster_handle_alter_table");
- const char *save_proc_info= thd->proc_info;
- thd->proc_info= "Syncing ndb table schema operation and binlog";
- pthread_mutex_lock(&share->mutex);
- int max_timeout= DEFAULT_SYNC_TIMEOUT;
- while (share->state == NSS_ALTERED)
- {
- struct timespec abstime;
- set_timespec(abstime, 1);
- int ret= pthread_cond_timedwait(&injector_cond,
- &share->mutex,
- &abstime);
- if (thd->killed ||
- (share->state != NSS_ALTERED))
- break;
- if (ret)
- {
- max_timeout--;
- if (max_timeout == 0)
- {
- sql_print_error("NDB %s: %s timed out. Ignoring...",
- type_str, share->key);
- DBUG_ASSERT(false);
- break;
- }
- if (opt_ndb_extra_logging)
- ndb_report_waiting(type_str, max_timeout,
- type_str, share->key, 0);
- }
- }
- pthread_mutex_unlock(&share->mutex);
- thd->proc_info= save_proc_info;
- DBUG_RETURN(0);
-}
-
/*
when entering the calling thread should have a share lock id share != 0
then the injector thread will have one as well, i.e. share->use_count == 0
=== modified file 'sql/ha_ndbcluster_binlog.h'
--- a/sql/ha_ndbcluster_binlog.h 2011-02-16 08:58:32 +0000
+++ b/sql/ha_ndbcluster_binlog.h 2011-02-21 12:09:15 +0000
@@ -229,8 +229,6 @@ int ndbcluster_log_schema_op(THD *thd,
int ndbcluster_drop_event(THD *thd, Ndb *ndb, NDB_SHARE *share,
const char *type_str,
const char * dbname, const char * tabname);
-int ndbcluster_handle_alter_table(THD *thd, NDB_SHARE *share,
- const char *type_str);
int ndbcluster_handle_drop_table(THD *thd, Ndb *ndb, NDB_SHARE *share,
const char *type_str,
const char * db, const char * tabname);
=== modified file 'storage/ndb/include/util/NdbSqlUtil.hpp'
--- a/storage/ndb/include/util/NdbSqlUtil.hpp 2011-02-01 23:27:25 +0000
+++ b/storage/ndb/include/util/NdbSqlUtil.hpp 2011-02-19 03:13:04 +0000
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
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
@@ -24,6 +24,16 @@
struct charset_info_st;
typedef struct charset_info_st CHARSET_INFO;
+/**
+ * Helper class with comparison functions on NDB (column) data types.
+ *
+ * Notes: this Helper class
+ * - is used by kernel code
+ * - provides non-elementary functions
+ * - is not generic, template-based code
+ * - has link/library dependencies upon MySQL code
+ * (in contrast to other type utility classes, like ./NdbTypesUtil).
+ */
class NdbSqlUtil {
public:
/**
=== added file 'storage/ndb/include/util/NdbTypesUtil.hpp'
--- a/storage/ndb/include/util/NdbTypesUtil.hpp 1970-01-01 00:00:00 +0000
+++ b/storage/ndb/include/util/NdbTypesUtil.hpp 2011-02-19 02:47:10 +0000
@@ -0,0 +1,452 @@
+/*
+ Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+ 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; version 2 of the License.
+
+ 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef NDB_TYPES_UTIL_HPP
+#define NDB_TYPES_UTIL_HPP
+
+#include <assert.h>
+#include <string.h>
+
+#include "my_global.h"
+
+#include "ndb_constants.h"
+#include "ndb_types.h"
+
+/*
+ * Traits and Helper classes for NDB data types.
+ */
+
+// ---------------------------------------------------------------------------
+// Traits classes providing information on NDB (column) data types
+// ---------------------------------------------------------------------------
+
+/*
+ * These Traits classes support code genericity by parametrizing over
+ * NDB (column) data types. They provide compile-time information on
+ * - array types: [long][var](binary|char)
+ * - numeric types: [U]Int8..[U]Int64|float|double
+ *
+ * For instance, Traits functions
+ * - isFixedSized() for array types
+ * - lowest(), highest() for numeric types
+ * allow for the generic handling of arrays or numeric limits.
+ *
+ * Notes: the Traits classes
+ * - provide uniform access to type meta-data
+ * - are used as a type argument to a class or function template
+ * - have pure compile-time scope, lack instantiation at runtime
+ * - have _no_ link or library dependencies upon C++ stdlib code
+ * (compare to the bounds definitions in std::numeric_limits)
+ * - are defined below as inline template specializations.
+ */
+
+/**
+ * Common Traits of NDB array types.
+ */
+template< int TID > // the NDB type id as defined in ndb_constants.h
+struct ArrayTypeTraits {
+ // whether this array type is a binary or character type
+ static bool isBinary();
+
+ // whether this array type is fixed-or variable-sized
+ static bool isFixedSized();
+
+ // the size of the length prefix in bytes, or zero if a fixed-sized array
+ static Uint32 lengthPrefixSize();
+};
+
+// aliases for array type traits
+typedef ArrayTypeTraits< NDB_TYPE_CHAR > Tchar;
+typedef ArrayTypeTraits< NDB_TYPE_BINARY > Tbinary;
+typedef ArrayTypeTraits< NDB_TYPE_VARCHAR > Tvarchar;
+typedef ArrayTypeTraits< NDB_TYPE_VARBINARY > Tvarbinary;
+typedef ArrayTypeTraits< NDB_TYPE_LONGVARCHAR > Tlongvarchar;
+typedef ArrayTypeTraits< NDB_TYPE_LONGVARBINARY > Tlongvarbinary;
+
+// internal helper class
+template< typename T >
+struct NumTypeMap {};
+
+/**
+ * Common Traits of NDB numeric types.
+ *
+ * Notes: the C++ stdlib offers limits as part of std::numeric_limits;
+ * its bounds definitions result in a non-uniform usage over different
+ * data types, with min() referring to the smallest positive value for
+ * float and double, but lowest negative value for integral types.
+ * In contrast, this Traits class's functions lowest() and smallest()
+ * support a uniform usage.
+ */
+template< typename T >
+struct NumTypeTraits {
+ // the domain type T
+ typedef typename NumTypeMap< T >::DomainT DomainT;
+
+ // if T is integral, the signed type of same width; otherwise T
+ typedef typename NumTypeMap< T >::SignedT SignedT;
+
+ // if T is integral, the unsigned type of same width; otherwise T
+ typedef typename NumTypeMap< T >::UnsignedT UnsignedT;
+
+ // whether the domain type is an integer type
+ static bool isIntegral() { return NumTypeMap< T >::isIntegral(); };
+
+ // whether the domain type is signed or unsigned
+ static bool isSigned() { return NumTypeMap< T >::isSigned(); };
+
+ // the width of the type in bytes
+ static Uint32 size();
+
+ // the minimum finite value
+ static T lowest();
+
+ // the maximum finite value
+ static T highest();
+
+ // the minimum positive normalized value, or 0 for integral types
+ static T smallest();
+};
+
+// aliases for standard numeric type traits
+typedef NumTypeTraits< Int8 > Tint8;
+typedef NumTypeTraits< Int16 > Tint16;
+typedef NumTypeTraits< Int32 > Tint32;
+typedef NumTypeTraits< Int64 > Tint64;
+typedef NumTypeTraits< Uint8 > Tuint8;
+typedef NumTypeTraits< Uint16 > Tuint16;
+typedef NumTypeTraits< Uint32 > Tuint32;
+typedef NumTypeTraits< Uint64 > Tuint64;
+// not implemented yet: float, double
+// ansi C type 'long double' is not a supported numeric NDB type
+
+/**
+ * Common Traits of non-standard NDB numeric types.
+ *
+ * Unless distinct [U]Int24 value types are defined to represent these
+ * proper subsets of [U]Int32 numbers, the correspoding Traits classes
+ * need to be defined as separate types (not just mere specializations).
+ * Using a derived class does that and allows to partially override.
+ */
+template< typename T >
+struct NonStdNumTypeTraits : NumTypeTraits< T > {
+ // the minimum finite value
+ static T lowest();
+
+ // the maximum finite value
+ static T highest();
+};
+
+// aliases for standard numeric type traits
+typedef NonStdNumTypeTraits< Int32 > Tint24;
+typedef NonStdNumTypeTraits< Uint32 > Tuint24;
+
+// ---------------------------------------------------------------------------
+// Helper classes providing common functions on NDB (column) data
+// ---------------------------------------------------------------------------
+
+/*
+ * These Helper classes provide basic utility functions on NDB types.
+ *
+ * For example, Helper functions
+ * - read/writeLengthPrefix() for array types
+ * - load(), store() for numeric types
+ * allow to abstract from the details of writing an array's length prefix
+ * or from reading/writing a numeric value from/to an unaligned buffer.
+ *
+ * Notes: the Helper classes
+ * - extend Traits classes for convenience
+ * - only add basic utility functions that
+ * - have _no_ link or library dependencies upon MySQL code
+ * (in contrast to other SQL utility code like ./NdbSqlUtil)
+ * - are defined below as inline template specializations.
+ */
+
+/**
+ * Basic Helper functions for NDB array types.
+ */
+template< int ID >
+struct ArrayTypeHelper : ArrayTypeTraits< ID > {
+ // read the length prefix (not available if a fixed-sized array)
+ static Uint32 readLengthPrefix(const void * a);
+
+ // write the length prefix (not available if a fixed-sized array)
+ // the non-length-prefix bytes of 'l' must be zero
+ static void writeLengthPrefix(void * a, Uint32 l);
+};
+
+// aliases for array type helpers
+typedef ArrayTypeHelper< NDB_TYPE_CHAR > Hchar;
+typedef ArrayTypeHelper< NDB_TYPE_BINARY > Hbinary;
+typedef ArrayTypeHelper< NDB_TYPE_VARCHAR > Hvarchar;
+typedef ArrayTypeHelper< NDB_TYPE_VARBINARY > Hvarbinary;
+typedef ArrayTypeHelper< NDB_TYPE_LONGVARCHAR > Hlongvarchar;
+typedef ArrayTypeHelper< NDB_TYPE_LONGVARBINARY > Hlongvarbinary;
+
+/**
+ * Basic Helper functions for numeric NDB types.
+ *
+ * As another design option, these helper functions could be defined as
+ * individual function templates, which'd allow for implicit function
+ * resolution based on the parameter type but, on the other hand, required
+ * distinct value types for all data (i.e., an Int24 value type).
+ */
+template< typename T >
+struct NumTypeHelper : NumTypeTraits< T > {
+ // convenience aliases
+ typedef typename NumTypeTraits< T >::SignedT SignedT;
+ typedef typename NumTypeTraits< T >::UnsignedT UnsignedT;
+
+ // casts a value to the signed numerical type of same width
+ static SignedT asSigned(T t) { return static_cast< SignedT >(t); }
+
+ // casts a value to the unsigned numerical type of same width
+ static UnsignedT asUnsigned(T t) { return static_cast< UnsignedT >(t); }
+
+ // read a single value from an unaligned buffer; s, t must not overlap
+ static void load(T * t, const char * s);
+
+ // write a single value to an unaligned buffer; s, t must not overlap
+ static void store(char * t, const T * s);
+};
+
+// aliases for numeric type helpers
+typedef NumTypeHelper< Int8 > Hint8;
+typedef NumTypeHelper< Int16 > Hint16;
+typedef NumTypeHelper< Int32 > Hint32;
+typedef NumTypeHelper< Int64 > Hint64;
+typedef NumTypeHelper< Uint8 > Huint8;
+typedef NumTypeHelper< Uint16 > Huint16;
+typedef NumTypeHelper< Uint32 > Huint32;
+typedef NumTypeHelper< Uint64 > Huint64;
+// not implemented yet: float, double
+// ansi C type 'long double' is not a supported numeric NDB type
+
+/**
+ * Basic Helper functions of non-standard NDB numeric types.
+ *
+ * Unless distinct [U]Int24 value types are defined to represent these
+ * proper subsets of [U]Int32 numbers, the correspoding Helper classes
+ * need to be defined as separate types (not just mere specializations).
+ * This class only derives from the Traits class to avoid member access
+ * ambiguities resulting from multiple inheritance.
+ */
+template< typename T >
+struct NonStdNumTypeHelper : NonStdNumTypeTraits< T > {
+ // convenience alias
+ typedef typename NonStdNumTypeTraits< T >::SignedT SignedT;
+ typedef typename NonStdNumTypeTraits< T >::UnsignedT UnsignedT;
+
+ // casts a value to the signed numerical type of same width
+ static SignedT asSigned(T t) { return static_cast< SignedT >(t); }
+
+ // casts a value to the unsigned numerical type of same width
+ static UnsignedT asUnsigned(T t) { return static_cast< UnsignedT >(t); }
+
+ // read a single value from an unaligned buffer; s, t must not overlap
+ static void load(T * t, const char * s);
+
+ // write a single value to an unaligned buffer; s, t must not overlap
+ static void store(char * t, const T * s);
+};
+
+// aliases for non-standard numeric type helpers
+typedef NonStdNumTypeHelper< Int32 > Hint24;
+typedef NonStdNumTypeHelper< Uint32 > Huint24;
+
+// ---------------------------------------------------------------------------
+// Definitions/Specializations of Traits classes
+// ---------------------------------------------------------------------------
+
+// specialize the Traits template members for array types
+#define NDB_SPECIALIZE_ARRAY_TYPE_TRAITS( TR, B, FS, LPS ) \
+ template<> inline bool TR::isBinary() { return B; } \
+ template<> inline bool TR::isFixedSized() { return FS; } \
+ template<> inline Uint32 TR::lengthPrefixSize() { return LPS; }
+
+// coincidentally, we could use ndb constants
+// NDB_ARRAYTYPE_FIXED, NDB_ARRAYTYPE_SHORT_VAR, NDB_ARRAYTYPE_MEDIUM_VAR
+// instead of literals, but let's not confuse ordinal/cardinal numbers
+NDB_SPECIALIZE_ARRAY_TYPE_TRAITS(Tchar, false, true, 0)
+NDB_SPECIALIZE_ARRAY_TYPE_TRAITS(Tbinary, true, true, 0)
+NDB_SPECIALIZE_ARRAY_TYPE_TRAITS(Tvarchar, false, false, 1)
+NDB_SPECIALIZE_ARRAY_TYPE_TRAITS(Tvarbinary, true, false, 1)
+NDB_SPECIALIZE_ARRAY_TYPE_TRAITS(Tlongvarchar, false, false, 2)
+NDB_SPECIALIZE_ARRAY_TYPE_TRAITS(Tlongvarbinary, true, false, 2)
+#undef NDB_SPECIALIZE_ARRAY_TYPE_TRAITS
+
+// specialize the TypeMap template for numeric types
+#define NDB_SPECIALIZE_NUM_TYPE_MAP( DT, ST, UT, I, S ) \
+ template<> struct NumTypeMap< DT > { \
+ typedef DT DomainT; \
+ typedef ST SignedT; \
+ typedef UT UnsignedT; \
+ static bool isIntegral() { return S; }; \
+ static bool isSigned() { return S; }; \
+ };
+
+NDB_SPECIALIZE_NUM_TYPE_MAP(Int8, Int8, Uint8, true, true)
+NDB_SPECIALIZE_NUM_TYPE_MAP(Uint8, Int8, Uint8, true, false)
+NDB_SPECIALIZE_NUM_TYPE_MAP(Int16, Int16, Uint16, true, true)
+NDB_SPECIALIZE_NUM_TYPE_MAP(Uint16, Int16, Uint16, true, false)
+NDB_SPECIALIZE_NUM_TYPE_MAP(Int32, Int32, Uint32, true, true)
+NDB_SPECIALIZE_NUM_TYPE_MAP(Uint32, Int32, Uint32, true, false)
+NDB_SPECIALIZE_NUM_TYPE_MAP(Int64, Int64, Uint64, true, true)
+NDB_SPECIALIZE_NUM_TYPE_MAP(Uint64, Int64, Uint64, true, false)
+
+NDB_SPECIALIZE_NUM_TYPE_MAP(float, float, float, false, true)
+NDB_SPECIALIZE_NUM_TYPE_MAP(double, double, double, false, true)
+#undef NDB_SPECIALIZE_NUM_TYPE_MAP
+
+// specialize the Traits template members for numeric types
+#define NDB_SPECIALIZE_NUM_TYPE_TRAITS( TR, T, SZ, LO, HI, SM ) \
+ template<> inline Uint32 TR::size() { return SZ; } \
+ template<> inline T TR::lowest() { return LO; } \
+ template<> inline T TR::highest() { return HI; } \
+ template<> inline T TR::smallest() { return SM; }
+
+NDB_SPECIALIZE_NUM_TYPE_TRAITS(Tint8, Int8, 1, INT_MIN8, INT_MAX8, 0)
+NDB_SPECIALIZE_NUM_TYPE_TRAITS(Tint16, Int16, 2, INT_MIN16, INT_MAX16, 0)
+NDB_SPECIALIZE_NUM_TYPE_TRAITS(Tint32, Int32, 4, INT_MIN32, INT_MAX32, 0)
+NDB_SPECIALIZE_NUM_TYPE_TRAITS(Tint64, Int64, 8, INT_MIN64, INT_MAX64, 0)
+
+NDB_SPECIALIZE_NUM_TYPE_TRAITS(Tuint8, Uint8, 1, 0, UINT_MAX8, 0)
+NDB_SPECIALIZE_NUM_TYPE_TRAITS(Tuint16, Uint16, 2, 0, UINT_MAX16, 0)
+NDB_SPECIALIZE_NUM_TYPE_TRAITS(Tuint32, Uint32, 4, 0, UINT_MAX32, 0)
+NDB_SPECIALIZE_NUM_TYPE_TRAITS(Tuint64, Uint64, 8, 0, UINT_MAX64, 0)
+// not implemented yet: float, double
+#undef NDB_SPECIALIZE_NUM_TYPE_TRAITS
+
+// specialize the Traits template members for non-standard numeric types
+#define NDB_SPECIALIZE_NON_STD_NUM_TYPE_TRAITS( TR, T, LO, HI ) \
+ template<> inline T TR::lowest() { return LO; } \
+ template<> inline T TR::highest() { return HI; }
+
+NDB_SPECIALIZE_NON_STD_NUM_TYPE_TRAITS(Tint24, Int32, INT_MIN24, INT_MAX24)
+NDB_SPECIALIZE_NON_STD_NUM_TYPE_TRAITS(Tuint24, Uint32, 0, UINT_MAX24)
+#undef NDB_SPECIALIZE_NON_STD_NUM_TYPE_TRAITS
+
+// ---------------------------------------------------------------------------
+// Definitions/Specializations of Helper classes
+// ---------------------------------------------------------------------------
+
+// specialize the Helper template members for fixed-sized arrays
+#define NDB_SPECIALIZE_ARRAY_TYPE_HELPER_LPS0( H ) \
+ template<> inline Uint32 H::readLengthPrefix(const void * a) { \
+ assert(false); \
+ (void)a; \
+ return 0; \
+ }; \
+ template<> inline void H::writeLengthPrefix(void * a, Uint32 l) { \
+ assert(false); \
+ (void)a; (void)l; \
+ }
+
+NDB_SPECIALIZE_ARRAY_TYPE_HELPER_LPS0(Hchar)
+NDB_SPECIALIZE_ARRAY_TYPE_HELPER_LPS0(Hbinary)
+#undef NDB_SPECIALIZE_ARRAY_TYPE_HELPER_LPS0
+
+// specialize the Helper template members for short-var arrays
+#define NDB_SPECIALIZE_ARRAY_TYPE_HELPER_LPS1( H ) \
+ template<> inline Uint32 H::readLengthPrefix(const void * a) { \
+ assert(a); \
+ const Uint8 * s = static_cast<const Uint8 *>(a); \
+ return s[0]; \
+ }; \
+ template<> inline void H::writeLengthPrefix(void * a, Uint32 l) { \
+ assert(a); \
+ assert(l >> (lengthPrefixSize() * 8) == 0); \
+ Uint8 * t = static_cast<Uint8 *>(a); \
+ t[0] = l & 0x000000FF; \
+ }
+
+NDB_SPECIALIZE_ARRAY_TYPE_HELPER_LPS1(Hvarchar)
+NDB_SPECIALIZE_ARRAY_TYPE_HELPER_LPS1(Hvarbinary)
+#undef NDB_SPECIALIZE_ARRAY_TYPE_HELPER_LPS1
+
+// specialize the Helper template members for medium-var arrays
+#define NDB_SPECIALIZE_ARRAY_TYPE_HELPER_LPS2( H ) \
+ template<> inline Uint32 H::readLengthPrefix(const void * a) { \
+ assert(a); \
+ const Uint8 * s = static_cast<const Uint8 *>(a); \
+ return static_cast<Uint32>(s[0] + (s[1] << 8)); \
+ }; \
+ template<> inline void H::writeLengthPrefix(void * a, Uint32 l) { \
+ assert(a); \
+ assert(l >> (lengthPrefixSize() * 8) == 0); \
+ Uint8 * t = static_cast<Uint8 *>(a); \
+ t[0] = static_cast<Uint8>(l & 0x000000FF); \
+ t[1] = static_cast<Uint8>((l & 0x0000FF00) >> 8); \
+ }
+
+NDB_SPECIALIZE_ARRAY_TYPE_HELPER_LPS2(Hlongvarchar)
+NDB_SPECIALIZE_ARRAY_TYPE_HELPER_LPS2(Hlongvarbinary)
+#undef NDB_SPECIALIZE_ARRAY_TYPE_HELPER_LPS2
+
+// specialize the Helper template members for single-byte types
+#define NDB_SPECIALIZE_NUM_TYPE_HELPER_BYTE( H, T ) \
+ template<> inline void H::load(T * t, const char * s) { \
+ assert(t); assert(s); assert(t != (const T *)s); \
+ *t = static_cast<T>(*s); \
+ } \
+ template<> inline void H::store(char * t, const T * s) { \
+ H::load(reinterpret_cast<T *>(t), \
+ reinterpret_cast<const char *>(s)); \
+ }
+
+NDB_SPECIALIZE_NUM_TYPE_HELPER_BYTE(Hint8, Int8);
+NDB_SPECIALIZE_NUM_TYPE_HELPER_BYTE(Huint8, Uint8);
+#undef NDB_SPECIALIZE_NUM_TYPE_HELPER_BYTE
+
+// specialize the Helper template members for numeric types
+#define NDB_SPECIALIZE_NUM_TYPE_HELPER( H, T ) \
+ template<> inline void H::load(T * t, const char * s) { \
+ assert(t); assert(s); assert(t != (const T *)s); \
+ memcpy(t, s, H::size()); \
+ } \
+ template<> inline void H::store(char * t, const T * s) { \
+ H::load(reinterpret_cast<T *>(t), \
+ reinterpret_cast<const char *>(s)); \
+ }
+
+NDB_SPECIALIZE_NUM_TYPE_HELPER(Hint16, Int16);
+NDB_SPECIALIZE_NUM_TYPE_HELPER(Hint32, Int32);
+NDB_SPECIALIZE_NUM_TYPE_HELPER(Hint64, Int64);
+
+NDB_SPECIALIZE_NUM_TYPE_HELPER(Huint16, Uint16);
+NDB_SPECIALIZE_NUM_TYPE_HELPER(Huint32, Uint32);
+NDB_SPECIALIZE_NUM_TYPE_HELPER(Huint64, Uint64);
+// not implemented yet: float, double
+#undef NDB_SPECIALIZE_NUM_TYPE_HELPER
+
+// specialize the Helper template members for non-standard numeric types
+#define NDB_SPECIALIZE_NON_STD_NUM_TYPE_HELPER( H, T, INT3KORR ) \
+ template<> inline void H::load(T * t, const char * s) { \
+ assert(t); assert(s); \
+ assert(t > (const T *)s); \
+ *t = (INT3KORR(s)); \
+ } \
+ template<> inline void H::store(char * t, const T * s) { \
+ assert(t); assert(s); \
+ assert(((T *)t > s) || ((T *)t < s)); \
+ int3store(t, (*s)); \
+ }
+
+NDB_SPECIALIZE_NON_STD_NUM_TYPE_HELPER(Hint24, Int32, sint3korr)
+NDB_SPECIALIZE_NON_STD_NUM_TYPE_HELPER(Huint24, Uint32, uint3korr)
+#undef NDB_SPECIALIZE_NON_STD_NUM_TYPE_HELPER
+
+#endif /* !NDB_TYPES_UTIL_HPP */
=== modified file 'storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2011-02-15 13:49:23 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2011-02-19 10:31:42 +0000
@@ -1989,14 +1989,27 @@ void Dbdih::execREAD_NODESCONF(Signal* s
if (c_2pass_inr)
{
jam();
+ Uint32 workers = getNodeInfo(getOwnNodeId()).m_lqh_workers;
printf("Checking 2-pass initial node restart: ");
for (i = 0; i<index; i++)
{
+ if (NdbNodeBitmask::get(readNodes->inactiveNodes, nodeArray[i]))
+ continue;
+
if (!ndbd_non_trans_copy_frag_req(getNodeInfo(nodeArray[i]).m_version))
{
jam();
c_2pass_inr = false;
- printf("not ok (node %u) => disabled\n", nodeArray[i]);
+ printf("not ok (version node %u) => disabled\n", nodeArray[i]);
+ break;
+ }
+
+ if (workers > 1 &&
+ workers != getNodeInfo(nodeArray[i]).m_lqh_workers)
+ {
+ c_2pass_inr = false;
+ printf("not ok (different worker cnt node %u) => disabled\n",
+ nodeArray[i]);
break;
}
}
@@ -3778,7 +3791,7 @@ done:
req->fragId = takeOverPtr.p->toCurrentFragid;
req->noOfLogNodes = 0;
- if (c_2pass_inr)
+ if (c_2pass_inr && cstarttype == NodeState::ST_INITIAL_NODE_RESTART)
{
/**
* Check if we can make 2-phase copy
@@ -3829,7 +3842,7 @@ done:
takeOverPtr.p->toCurrentTabref,
takeOverPtr.p->toCurrentFragid,
req->lqhLogNode[0],
- req->lcpId);
+ takeOverPtr.p->startGci);
}
BlockReference ref = numberToRef(DBLQH, takeOverPtr.p->toStartingNode);
=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2011-02-15 11:41:27 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2011-02-19 10:31:42 +0000
@@ -73,6 +73,7 @@
#include <signaldata/SignalDroppedRep.hpp>
#include <signaldata/FsReadWriteReq.hpp>
#include <signaldata/DbinfoScan.hpp>
+#include <signaldata/SystemError.hpp>
#include <NdbEnv.h>
#include "../suma/Suma.hpp"
@@ -7807,12 +7808,6 @@ void Dblqh::commitContinueAfterBlockedLa
EXECUTE_DIRECT(tup, GSN_TUP_COMMITREQ, signal,
TupCommitReq::SignalLength);
- if(signal->theData[0] != 0)
- {
- regTcPtr.p->transactionState = TcConnectionrec::WAIT_TUP_COMMIT;
- return; // TUP_COMMIT was timesliced
- }
-
if (TRACENR_FLAG)
{
TRACENR("COMMIT: ");
@@ -7833,9 +7828,18 @@ void Dblqh::commitContinueAfterBlockedLa
if (LqhKeyReq::getRowidFlag(regTcPtr.p->reqinfo))
TRACENR(" rowid: " << regTcPtr.p->m_row_id);
TRACENR(" key: " << getKeyInfoWordOrZero(regTcPtr.p, 0));
+
+ if (signal->theData[0] != 0)
+ TRACENR(" TIMESLICE");
TRACENR(endl);
}
+ if(signal->theData[0] != 0)
+ {
+ regTcPtr.p->transactionState = TcConnectionrec::WAIT_TUP_COMMIT;
+ return; // TUP_COMMIT was timesliced
+ }
+
TRACE_OP(regTcPtr.p, "ACC_COMMITREQ");
Uint32 acc = refToMain(regTcPtr.p->tcAccBlockref);
@@ -16495,7 +16499,6 @@ Dblqh::send_restore_lcp(Signal * signal)
sendSignal(ref, GSN_COPY_FRAGREQ, signal,
CopyFragReq::SignalLength, JBB);
-
}
}
@@ -16503,7 +16506,17 @@ void
Dblqh::execCOPY_FRAGREF(Signal* signal)
{
jamEntry();
- ndbrequire(false);
+
+ const CopyFragRef * ref = CAST_CONSTPTR(CopyFragRef, signal->getDataPtr());
+ Uint32 errorCode = ref->errorCode;
+
+ SystemError * sysErr = (SystemError*)&signal->theData[0];
+ sysErr->errorCode = SystemError::CopyFragRefError;
+ sysErr->errorRef = reference();
+ sysErr->data[0] = errorCode;
+ sysErr->data[1] = 0;
+ sendSignal(NDBCNTR_REF, GSN_SYSTEM_ERROR, signal,
+ SystemError::SignalLength, JBB);
}
void
@@ -16600,7 +16613,18 @@ void Dblqh::execRESTORE_LCP_CONF(Signal*
lcpPtr.i = 0;
ptrAss(lcpPtr, lcpRecord);
lcpPtr.p->m_outstanding = 1;
-
+
+ if (cstartType == NodeState::ST_INITIAL_NODE_RESTART)
+ {
+ jam();
+ /**
+ * Skip lgman undo...
+ */
+ signal->theData[0] = LGMAN_REF;
+ sendSignal(reference(), GSN_START_RECCONF, signal, 1, JBB);
+ return;
+ }
+
if (!isNdbMtLqh())
{
jam();
@@ -16685,7 +16709,18 @@ void Dblqh::execSTART_RECREQ(Signal* sig
lcpPtr.i = 0;
ptrAss(lcpPtr, lcpRecord);
lcpPtr.p->m_outstanding = 1;
-
+
+ if (cstartType == NodeState::ST_INITIAL_NODE_RESTART)
+ {
+ jam();
+ /**
+ * Skip lgman undo...
+ */
+ signal->theData[0] = LGMAN_REF;
+ sendSignal(reference(), GSN_START_RECCONF, signal, 1, JBB);
+ return;
+ }
+
if (!isNdbMtLqh())
{
jam();
=== modified file 'storage/ndb/src/kernel/blocks/lgman.cpp'
--- a/storage/ndb/src/kernel/blocks/lgman.cpp 2011-02-15 08:46:20 +0000
+++ b/storage/ndb/src/kernel/blocks/lgman.cpp 2011-02-17 15:51:08 +0000
@@ -595,7 +595,9 @@ Lgman::execCREATE_FILEGROUP_IMPL_REQ(Sig
m_logfile_group_hash.add(ptr);
m_logfile_group_list.add(ptr);
- if (getNodeState().getNodeRestartInProgress() ||
+ if ((getNodeState().getNodeRestartInProgress() &&
+ getNodeState().starting.restartType !=
+ NodeState::ST_INITIAL_NODE_RESTART)||
getNodeState().getSystemRestartInProgress())
{
ptr.p->m_state = Logfile_group::LG_STARTING;
=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2011-02-16 14:53:53 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2011-02-16 15:39:36 +0000
@@ -637,6 +637,7 @@ NdbTableImpl::init(){
m_single_user_mode = 0;
m_hash_map_id = RNIL;
m_hash_map_version = ~0;
+ m_storageType = NDB_STORAGETYPE_DEFAULT;
}
bool
@@ -921,6 +922,8 @@ NdbTableImpl::assign(const NdbTableImpl&
m_tablespace_name = org.m_tablespace_name;
m_tablespace_id= org.m_tablespace_id;
m_tablespace_version = org.m_tablespace_version;
+ m_storageType = org.m_storageType;
+
DBUG_RETURN(0);
}
=== modified file 'storage/ndb/test/ndbapi/testSystemRestart.cpp'
--- a/storage/ndb/test/ndbapi/testSystemRestart.cpp 2011-02-02 00:40:07 +0000
+++ b/storage/ndb/test/ndbapi/testSystemRestart.cpp 2011-02-18 18:40:25 +0000
@@ -996,6 +996,7 @@ int runSystemRestart8(NDBT_Context* ctx,
CHECK(restarter.waitNodesStartPhase(a_nodeIds, nodeCount-1, 3, 120) == 0);
CHECK(restarter.startNodes(&nodeId, 1) == 0);
CHECK(restarter.waitClusterStarted(timeout) == 0);
+ CHECK(pNdb->waitUntilReady() == 0);
int count = records - 1;
CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
@@ -1342,6 +1343,7 @@ runBug28770(NDBT_Context* ctx, NDBT_Step
restarter.insertErrorInAllNodes(6024);
CHECK(restarter.startAll()== 0);
CHECK(restarter.waitClusterStarted() == 0);
+ CHECK(pNdb->waitUntilReady() == 0);
CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);
CHECK(count == records);
i++;
@@ -1443,7 +1445,8 @@ int runSR_DD_1(NDBT_Context* ctx, NDBT_S
CHECK(restarter.waitClusterNoStart() == 0);
CHECK(restarter.startAll() == 0);
CHECK(restarter.waitClusterStarted() == 0);
-
+ CHECK(pNdb->waitUntilReady() == 0);
+
ndbout << "Starting backup..." << flush;
CHECK(backup.start() == 0);
ndbout << "done" << endl;
@@ -1542,6 +1545,8 @@ int runSR_DD_2(NDBT_Context* ctx, NDBT_S
CHECK(restarter.waitClusterNoStart() == 0);
CHECK(restarter.startAll() == 0);
CHECK(restarter.waitClusterStarted() == 0);
+ CHECK(pNdb->waitUntilReady() == 0);
+
if (error)
{
restarter.insertErrorInAllNodes(error);
@@ -1730,6 +1735,7 @@ int runBug22696(NDBT_Context* ctx, NDBT_
CHECK(restarter.insertErrorInAllNodes(7072) == 0);
CHECK(restarter.startAll() == 0);
CHECK(restarter.waitClusterStarted() == 0);
+ CHECK(pNdb->waitUntilReady() == 0);
i++;
if (i < loops)
@@ -1791,7 +1797,7 @@ runBasic(NDBT_Context* ctx, NDBT_Step* s
CHECK(restarter.startAll() == 0);
CHECK(restarter.waitClusterStarted() == 0);
CHECK(pNdb->waitUntilReady() == 0);
-
+
for (int i = 0; i<NDBT_Tables::getNumTables(); i++)
{
const NdbDictionary::Table* tab =
@@ -1911,7 +1917,8 @@ runTO(NDBT_Context* ctx, NDBT_Step* step
} while (NdbTick_CurrentMillisecond() < (now + 30000));
g_err.m_out = save[0];
CHECK(res.waitClusterStarted() == 0);
-
+ CHECK(pNdb->waitUntilReady() == 0);
+
hugoTrans.clearTable(pNdb);
hugoTrans.loadTable(pNdb, rows);
@@ -2079,6 +2086,8 @@ int runBug46651(NDBT_Context* ctx, NDBT_
if (res.waitClusterStarted())
return NDBT_FAILED;
+ pNdb->waitUntilReady();
+
NdbDictionary::Table newTab = *pTab;
col.setName("ATTR4");
col.setType(NdbDictionary::Column::Varbinary);
@@ -2101,6 +2110,7 @@ int runBug46651(NDBT_Context* ctx, NDBT_
if (res.waitClusterStarted())
return NDBT_FAILED;
+ pNdb->waitUntilReady();
pDict->dropTable(tab.getName());
return NDBT_OK;
@@ -2341,6 +2351,7 @@ runBug54611(NDBT_Context* ctx, NDBT_Step
res.insertErrorInAllNodes(5055);
res.startAll();
res.waitClusterStarted();
+ pNdb->waitUntilReady();
}
return NDBT_OK;
@@ -2387,6 +2398,7 @@ runBug56961(NDBT_Context* ctx, NDBT_Step
res.startNodes(&node, 1);
ndbout_c("Waiting for %d to start", node);
res.waitClusterStarted();
+ pNdb->waitUntilReady();
}
return NDBT_OK;
=== modified file 'storage/ndb/test/run-test/conf-dl145a.cnf'
--- a/storage/ndb/test/run-test/conf-dl145a.cnf 2011-02-15 11:41:27 +0000
+++ b/storage/ndb/test/run-test/conf-dl145a.cnf 2011-02-19 10:31:42 +0000
@@ -32,3 +32,6 @@ SharedGlobalMemory=256M
InitialLogfileGroup=undo_buffer_size=64M;undofile01.dat:256M;undofile02.dat:128M
InitialTablespace=datafile01.dat:128M;datafile02.dat:64M
TwoPassInitialNodeRestartCopy=1
+
+[cluster_config.ndbd.1.2node]
+TwoPassInitialNodeRestartCopy=1
=== modified file 'storage/ndb/test/run-test/conf-ndb07.cnf'
--- a/storage/ndb/test/run-test/conf-ndb07.cnf 2011-02-15 11:41:27 +0000
+++ b/storage/ndb/test/run-test/conf-ndb07.cnf 2011-02-19 10:31:42 +0000
@@ -39,4 +39,9 @@ FileSystemPathDataFiles=/data1/autotest
FileSystemPathUndoFiles=/data2/autotest
InitialLogfileGroup=undo_buffer_size=64M;undofile01.dat:256M;undofile02.dat:256M
InitialTablespace=datafile01.dat:256M;datafile02.dat:256M
+
+[cluster_config.ndbd.1.2node]
+TwoPassInitialNodeRestartCopy=1
+
+[cluster_config.ndbd.3.2node]
TwoPassInitialNodeRestartCopy=1
=== modified file 'storage/ndb/tools/restore/consumer_restore.cpp'
--- a/storage/ndb/tools/restore/consumer_restore.cpp 2011-02-04 09:45:35 +0000
+++ b/storage/ndb/tools/restore/consumer_restore.cpp 2011-02-21 12:09:15 +0000
@@ -22,6 +22,7 @@
#include <NdbSleep.h>
#include <NdbTick.h>
#include <Properties.hpp>
+#include <NdbTypesUtil.hpp>
#include <ndb_internal.hpp>
#include <ndb_logevent.h>
@@ -45,132 +46,415 @@ extern Properties g_rewrite_databases;
bool BackupRestore::m_preserve_trailing_spaces = false;
+// ----------------------------------------------------------------------
+// conversion handlers
+// ----------------------------------------------------------------------
+
+void *
+BackupRestore::convert_bitset(const void *source,
+ void *target,
+ bool &truncated)
+{
+ if (!source || !target)
+ return NULL;
+
+ // shortcuts
+ const unsigned char * const s = (const unsigned char *)source;
+ char_n_padding_struct * const t = (char_n_padding_struct *)target;
+
+ // write data
+ if (t->n_new >= t->n_old)
+ {
+ // clear all bits
+ memset(t->new_row, 0, t->n_new);
+
+ memcpy(t->new_row, s, t->n_old);
+ truncated = false;
+ } else {
+ // set all bits, for parity with replication's demotion semantics
+ memset(t->new_row, 0xFF, t->n_new);
+ truncated = true;
+ }
+
+ return t->new_row;
+}
+
+template< typename S, typename T >
+void *
+BackupRestore::convert_array(const void * source,
+ void * target,
+ bool & truncated)
+{
+ if (!source || !target)
+ return NULL;
+
+ // shortcuts (note that all S::... and T::... are compile-time expr)
+ const unsigned char * const s = (const unsigned char *)source;
+ char_n_padding_struct * const t = (char_n_padding_struct *)target;
+ const Uint32 s_prefix_length = S::lengthPrefixSize();
+ const Uint32 t_prefix_length = T::lengthPrefixSize();
+
+ // read and adjust length
+ Uint32 length = (S::isFixedSized() ? t->n_old : S::readLengthPrefix(s));
+ const Uint32 max_length = t->n_new - t_prefix_length;
+ if (S::isFixedSized() && !m_preserve_trailing_spaces) {
+ const char s_padding_char = (S::isBinary() ? 0x00 : ' ');
+ // ignore padding chars for data copying or truncation reporting
+ while (length > 0 && s[length - 1] == s_padding_char) {
+ length--;
+ }
+ }
+ if (length <= max_length) {
+ truncated = false;
+ } else {
+ length = max_length;
+ truncated = true;
+ }
+
+ // write length prefix
+ if (!T::isFixedSized()) {
+ T::writeLengthPrefix(t->new_row, length);
+ }
+
+ // write data
+ memcpy(t->new_row + t_prefix_length, s + s_prefix_length, length);
+
+ // write padding
+ if (T::isFixedSized()) {
+ const char t_padding_char = (T::isBinary() ? 0x00 : ' ');
+ const Uint32 l = max_length - length;
+ memset(t->new_row + t_prefix_length + length, t_padding_char, l);
+ }
+
+ return t->new_row;
+}
+
+template< typename S, typename T >
+void *
+BackupRestore::convert_integral(const void * source,
+ void * target,
+ bool & truncated)
+{
+ if (!source || !target)
+ return NULL;
+
+ // read the source value
+ typename S::DomainT s;
+ S::load(&s, (char *)source);
+
+ // Note: important to correctly handle mixed signedness comparisons.
+ //
+ // The problem: A straight-forward approach to convert value 's' into
+ // type 'T' might be to check into which of these subranges 's' falls
+ // ... < T's lower bound <= ... <= T's upper bound < ...
+ // However, this approach is _incorrect_ when applied to generic code
+ // if (s < T::lowest()) ... else if (s > T::highest()) ... else ...
+ // since 'S' and 'T' may be types of different signedness.
+ //
+ // Under ansi (and even more K&R) C promotion rules, if 'T' is unsigned
+ // and if there's no larger signed type available, the value 's' gets
+ // promoted to unsigned; then, a negative value of 's' becomes (large)
+ // positive -- with a wrong comparison outcome.
+ //
+ // Furthermore, the code should not trigger compiler warnings for any
+ // selection of integral types 'S', 'T' ("mixed signedness comparison",
+ // "comparison of unsigned expression <0 / >=0 is always false/true").
+ //
+ // The correct approach: do lower bound comparisons on signed types and
+ // upper bound comparisons on unsigned types only; this requires casts.
+ // For the casts to be safe, compare the value against the zero literal
+ // if (s <= 0) { check as signed } else { check as unsigned }
+ // which is a valid + nontrivial test for signed and unsigned types.
+ //
+ // This implies that correct, generic conversion code must test into
+ // which of these _four_ subranges value 's' falls
+ // ... < T's lower bound <= ... <= 0 < ... <= T's upper bound < ...
+ // while handling 's' as signed/unsigned where less-equal/greater zero.
+ //
+ // Obviously, simplifications are possible if 'S' is unsigned or known
+ // to be a subset of 'T'. This can be accomplished by a few additional
+ // compile-time expression tests, which allow code optimization to
+ // issue fewer checks for certain specializations of types 'S' and 'T'.
+
+ // write the target value
+ typename T::DomainT t;
+ if (s <= 0) {
+
+ // check value against lower bound as _signed_, safe since all <= 0
+ assert(S::lowest() <= 0 && T::lowest() <= 0 && s <= 0);
+ const typename S::SignedT s_l_s = S::asSigned(S::lowest());
+ const typename T::SignedT t_l_s = T::asSigned(T::lowest());
+ const typename S::SignedT s_s = S::asSigned(s);
+ if ((s_l_s < t_l_s) // compile-time expr
+ && (s_s < t_l_s)) { // lower bound check
+ t = T::lowest();
+ truncated = true;
+ } else { // within both bounds
+ t = static_cast< typename T::DomainT >(s);
+ truncated = false;
+ }
+
+ } else { // (s > 0)
+
+ // check value against upper bound as _unsigned_, safe since all > 0
+ assert(S::highest() > 0 && T::highest() > 0 && s > 0);
+ const typename S::UnsignedT s_h_u = S::asUnsigned(S::highest());
+ const typename T::UnsignedT t_h_u = T::asUnsigned(T::highest());
+ const typename S::UnsignedT s_u = S::asUnsigned(s);
+ if ((s_h_u > t_h_u) // compile-time expr
+ && (s_u > t_h_u)) { // upper bound check
+ t = T::highest();
+ truncated = true;
+ } else { // within both bounds
+ t = static_cast< typename T::DomainT >(s);
+ truncated = false;
+ }
+
+ }
+ T::store((char *)target, &t);
+
+ return target;
+}
+
+// ----------------------------------------------------------------------
+// conversion rules
+// ----------------------------------------------------------------------
+
const PromotionRules
BackupRestore::m_allowed_promotion_attrs[] = {
- // char promotions/demotions
- {NDBCOL::Char, NDBCOL::Char, check_compat_sizes, convert_char_char},
- {NDBCOL::Char, NDBCOL::Varchar, check_compat_sizes, convert_char_varchar},
- {NDBCOL::Char, NDBCOL::Longvarchar, check_compat_sizes, convert_char_longvarchar},
- {NDBCOL::Varchar, NDBCOL::Char, check_compat_sizes, convert_varchar_char},
- {NDBCOL::Varchar, NDBCOL::Varchar, check_compat_sizes, convert_var_var},
- {NDBCOL::Varchar, NDBCOL::Longvarchar, check_compat_sizes, convert_var_longvar},
- {NDBCOL::Longvarchar, NDBCOL::Char, check_compat_sizes, convert_longvarchar_char},
- {NDBCOL::Longvarchar, NDBCOL::Varchar, check_compat_sizes, convert_longvar_var},
- {NDBCOL::Longvarchar, NDBCOL::Longvarchar, check_compat_sizes, convert_longvar_longvar},
-
- // binary promotions/demotions
- {NDBCOL::Binary, NDBCOL::Binary, check_compat_sizes, convert_binary_binary},
- {NDBCOL::Binary, NDBCOL::Varbinary, check_compat_sizes, convert_binary_varbinary},
- {NDBCOL::Binary, NDBCOL::Longvarbinary, check_compat_sizes, convert_binary_longvarbinary},
- {NDBCOL::Varbinary, NDBCOL::Binary, check_compat_sizes, convert_varbinary_binary},
- {NDBCOL::Varbinary, NDBCOL::Varbinary, check_compat_sizes, convert_var_var},
- {NDBCOL::Varbinary, NDBCOL::Longvarbinary, check_compat_sizes, convert_var_longvar},
- {NDBCOL::Longvarbinary, NDBCOL::Binary, check_compat_sizes, convert_longvarbinary_binary},
- {NDBCOL::Longvarbinary, NDBCOL::Varbinary, check_compat_sizes, convert_longvar_var},
- {NDBCOL::Longvarbinary, NDBCOL::Longvarbinary, check_compat_sizes, convert_longvar_longvar},
-
// bitset promotions/demotions
- {NDBCOL::Bit, NDBCOL::Bit, check_compat_sizes, convert_bit_bit},
+ {NDBCOL::Bit, NDBCOL::Bit, check_compat_sizes,
+ convert_bitset},
+
+ // char array promotions/demotions
+ {NDBCOL::Char, NDBCOL::Char, check_compat_sizes,
+ convert_array< Hchar, Hchar >},
+ {NDBCOL::Char, NDBCOL::Varchar, check_compat_sizes,
+ convert_array< Hchar, Hvarchar >},
+ {NDBCOL::Char, NDBCOL::Longvarchar, check_compat_sizes,
+ convert_array< Hchar, Hlongvarchar >},
+ {NDBCOL::Varchar, NDBCOL::Char, check_compat_sizes,
+ convert_array< Hvarchar, Hchar >},
+ {NDBCOL::Varchar, NDBCOL::Varchar, check_compat_sizes,
+ convert_array< Hvarchar, Hvarchar >},
+ {NDBCOL::Varchar, NDBCOL::Longvarchar, check_compat_sizes,
+ convert_array< Hvarchar, Hlongvarchar >},
+ {NDBCOL::Longvarchar, NDBCOL::Char, check_compat_sizes,
+ convert_array< Hlongvarchar, Hchar >},
+ {NDBCOL::Longvarchar, NDBCOL::Varchar, check_compat_sizes,
+ convert_array< Hlongvarchar, Hvarchar >},
+ {NDBCOL::Longvarchar, NDBCOL::Longvarchar, check_compat_sizes,
+ convert_array< Hlongvarchar, Hlongvarchar >},
+
+ // binary array promotions/demotions
+ {NDBCOL::Binary, NDBCOL::Binary, check_compat_sizes,
+ convert_array< Hbinary, Hbinary >},
+ {NDBCOL::Binary, NDBCOL::Varbinary, check_compat_sizes,
+ convert_array< Hbinary, Hvarbinary >},
+ {NDBCOL::Binary, NDBCOL::Longvarbinary, check_compat_sizes,
+ convert_array< Hbinary, Hlongvarbinary >},
+ {NDBCOL::Varbinary, NDBCOL::Binary, check_compat_sizes,
+ convert_array< Hvarbinary, Hbinary >},
+ {NDBCOL::Varbinary, NDBCOL::Varbinary, check_compat_sizes,
+ convert_array< Hvarbinary, Hvarbinary >},
+ {NDBCOL::Varbinary, NDBCOL::Longvarbinary, check_compat_sizes,
+ convert_array< Hvarbinary, Hlongvarbinary >},
+ {NDBCOL::Longvarbinary, NDBCOL::Binary, check_compat_sizes,
+ convert_array< Hlongvarbinary, Hbinary >},
+ {NDBCOL::Longvarbinary, NDBCOL::Varbinary, check_compat_sizes,
+ convert_array< Hlongvarbinary, Hvarbinary >},
+ {NDBCOL::Longvarbinary, NDBCOL::Longvarbinary, check_compat_sizes,
+ convert_array< Hlongvarbinary, Hlongvarbinary >},
// integral promotions
- {NDBCOL::Tinyint, NDBCOL::Smallint, check_compat_promotion, convert_int8_int16},
- {NDBCOL::Tinyint, NDBCOL::Mediumint, check_compat_promotion, convert_int8_int24},
- {NDBCOL::Tinyint, NDBCOL::Int, check_compat_promotion, convert_int8_int32},
- {NDBCOL::Tinyint, NDBCOL::Bigint, check_compat_promotion, convert_int8_int64},
- {NDBCOL::Smallint, NDBCOL::Mediumint, check_compat_promotion, convert_int16_int24},
- {NDBCOL::Smallint, NDBCOL::Int, check_compat_promotion, convert_int16_int32},
- {NDBCOL::Smallint, NDBCOL::Bigint, check_compat_promotion, convert_int16_int64},
- {NDBCOL::Mediumint, NDBCOL::Int, check_compat_promotion, convert_int24_int32},
- {NDBCOL::Mediumint, NDBCOL::Bigint, check_compat_promotion, convert_int24_int64},
- {NDBCOL::Int, NDBCOL::Bigint, check_compat_promotion, convert_int32_int64},
- {NDBCOL::Tinyunsigned, NDBCOL::Smallunsigned, check_compat_promotion, convert_uint8_uint16},
- {NDBCOL::Tinyunsigned, NDBCOL::Mediumunsigned, check_compat_promotion, convert_uint8_uint24},
- {NDBCOL::Tinyunsigned, NDBCOL::Unsigned, check_compat_promotion, convert_uint8_uint32},
- {NDBCOL::Tinyunsigned, NDBCOL::Bigunsigned, check_compat_promotion, convert_uint8_uint64},
- {NDBCOL::Smallunsigned, NDBCOL::Mediumunsigned, check_compat_promotion, convert_uint16_uint24},
- {NDBCOL::Smallunsigned, NDBCOL::Unsigned, check_compat_promotion, convert_uint16_uint32},
- {NDBCOL::Smallunsigned, NDBCOL::Bigunsigned, check_compat_promotion, convert_uint16_uint64},
- {NDBCOL::Mediumunsigned, NDBCOL::Unsigned, check_compat_promotion, convert_uint24_uint32},
- {NDBCOL::Mediumunsigned, NDBCOL::Bigunsigned, check_compat_promotion, convert_uint24_uint64},
- {NDBCOL::Unsigned, NDBCOL::Bigunsigned, check_compat_promotion, convert_uint32_uint64},
+ {NDBCOL::Tinyint, NDBCOL::Smallint, check_compat_promotion,
+ convert_integral< Hint8, Hint16>},
+ {NDBCOL::Tinyint, NDBCOL::Mediumint, check_compat_promotion,
+ convert_integral< Hint8, Hint24>},
+ {NDBCOL::Tinyint, NDBCOL::Int, check_compat_promotion,
+ convert_integral< Hint8, Hint32>},
+ {NDBCOL::Tinyint, NDBCOL::Bigint, check_compat_promotion,
+ convert_integral< Hint8, Hint64>},
+ {NDBCOL::Smallint, NDBCOL::Mediumint, check_compat_promotion,
+ convert_integral< Hint16, Hint24>},
+ {NDBCOL::Smallint, NDBCOL::Int, check_compat_promotion,
+ convert_integral< Hint16, Hint32>},
+ {NDBCOL::Smallint, NDBCOL::Bigint, check_compat_promotion,
+ convert_integral< Hint16, Hint64>},
+ {NDBCOL::Mediumint, NDBCOL::Int, check_compat_promotion,
+ convert_integral< Hint24, Hint32>},
+ {NDBCOL::Mediumint, NDBCOL::Bigint, check_compat_promotion,
+ convert_integral< Hint24, Hint64>},
+ {NDBCOL::Int, NDBCOL::Bigint, check_compat_promotion,
+ convert_integral< Hint32, Hint64>},
+ {NDBCOL::Tinyunsigned, NDBCOL::Smallunsigned, check_compat_promotion,
+ convert_integral< Huint8, Huint16>},
+ {NDBCOL::Tinyunsigned, NDBCOL::Mediumunsigned, check_compat_promotion,
+ convert_integral< Huint8, Huint24>},
+ {NDBCOL::Tinyunsigned, NDBCOL::Unsigned, check_compat_promotion,
+ convert_integral< Huint8, Huint32>},
+ {NDBCOL::Tinyunsigned, NDBCOL::Bigunsigned, check_compat_promotion,
+ convert_integral< Huint8, Huint64>},
+ {NDBCOL::Smallunsigned, NDBCOL::Mediumunsigned, check_compat_promotion,
+ convert_integral< Huint16, Huint24>},
+ {NDBCOL::Smallunsigned, NDBCOL::Unsigned, check_compat_promotion,
+ convert_integral< Huint16, Huint32>},
+ {NDBCOL::Smallunsigned, NDBCOL::Bigunsigned, check_compat_promotion,
+ convert_integral< Huint16, Huint64>},
+ {NDBCOL::Mediumunsigned, NDBCOL::Unsigned, check_compat_promotion,
+ convert_integral< Huint24, Huint32>},
+ {NDBCOL::Mediumunsigned, NDBCOL::Bigunsigned, check_compat_promotion,
+ convert_integral< Huint24, Huint64>},
+ {NDBCOL::Unsigned, NDBCOL::Bigunsigned, check_compat_promotion,
+ convert_integral< Huint32, Huint64>},
// integral demotions
- {NDBCOL::Smallint, NDBCOL::Tinyint, check_compat_lossy, convert_int16_int8},
- {NDBCOL::Mediumint, NDBCOL::Tinyint, check_compat_lossy, convert_int24_int8},
- {NDBCOL::Mediumint, NDBCOL::Smallint, check_compat_lossy, convert_int24_int16},
- {NDBCOL::Int, NDBCOL::Tinyint, check_compat_lossy, convert_int32_int8},
- {NDBCOL::Int, NDBCOL::Smallint, check_compat_lossy, convert_int32_int16},
- {NDBCOL::Int, NDBCOL::Mediumint, check_compat_lossy, convert_int32_int24},
- {NDBCOL::Bigint, NDBCOL::Tinyint, check_compat_lossy, convert_int64_int8},
- {NDBCOL::Bigint, NDBCOL::Smallint, check_compat_lossy, convert_int64_int16},
- {NDBCOL::Bigint, NDBCOL::Mediumint, check_compat_lossy, convert_int64_int24},
- {NDBCOL::Bigint, NDBCOL::Int, check_compat_lossy, convert_int64_int32},
- {NDBCOL::Smallunsigned, NDBCOL::Tinyunsigned, check_compat_lossy, convert_uint16_uint8},
- {NDBCOL::Mediumunsigned, NDBCOL::Tinyunsigned, check_compat_lossy, convert_uint24_uint8},
- {NDBCOL::Mediumunsigned, NDBCOL::Smallunsigned, check_compat_lossy, convert_uint24_uint16},
- {NDBCOL::Unsigned, NDBCOL::Tinyunsigned, check_compat_lossy, convert_uint32_uint8},
- {NDBCOL::Unsigned, NDBCOL::Smallunsigned, check_compat_lossy, convert_uint32_uint16},
- {NDBCOL::Unsigned, NDBCOL::Mediumunsigned, check_compat_lossy, convert_uint32_uint24},
- {NDBCOL::Bigunsigned, NDBCOL::Tinyunsigned, check_compat_lossy, convert_uint64_uint8},
- {NDBCOL::Bigunsigned, NDBCOL::Smallunsigned, check_compat_lossy, convert_uint64_uint16},
- {NDBCOL::Bigunsigned, NDBCOL::Mediumunsigned, check_compat_lossy, convert_uint64_uint24},
- {NDBCOL::Bigunsigned, NDBCOL::Unsigned, check_compat_lossy, convert_uint64_uint32},
+ {NDBCOL::Smallint, NDBCOL::Tinyint, check_compat_lossy,
+ convert_integral< Hint16, Hint8>},
+ {NDBCOL::Mediumint, NDBCOL::Tinyint, check_compat_lossy,
+ convert_integral< Hint24, Hint8>},
+ {NDBCOL::Mediumint, NDBCOL::Smallint, check_compat_lossy,
+ convert_integral< Hint24, Hint16>},
+ {NDBCOL::Int, NDBCOL::Tinyint, check_compat_lossy,
+ convert_integral< Hint32, Hint8>},
+ {NDBCOL::Int, NDBCOL::Smallint, check_compat_lossy,
+ convert_integral< Hint32, Hint16>},
+ {NDBCOL::Int, NDBCOL::Mediumint, check_compat_lossy,
+ convert_integral< Hint32, Hint24>},
+ {NDBCOL::Bigint, NDBCOL::Tinyint, check_compat_lossy,
+ convert_integral< Hint64, Hint8>},
+ {NDBCOL::Bigint, NDBCOL::Smallint, check_compat_lossy,
+ convert_integral< Hint64, Hint16>},
+ {NDBCOL::Bigint, NDBCOL::Mediumint, check_compat_lossy,
+ convert_integral< Hint64, Hint24>},
+ {NDBCOL::Bigint, NDBCOL::Int, check_compat_lossy,
+ convert_integral< Hint64, Hint32>},
+ {NDBCOL::Smallunsigned, NDBCOL::Tinyunsigned, check_compat_lossy,
+ convert_integral< Huint16, Huint8>},
+ {NDBCOL::Mediumunsigned, NDBCOL::Tinyunsigned, check_compat_lossy,
+ convert_integral< Huint24, Huint8>},
+ {NDBCOL::Mediumunsigned, NDBCOL::Smallunsigned, check_compat_lossy,
+ convert_integral< Huint24, Huint16>},
+ {NDBCOL::Unsigned, NDBCOL::Tinyunsigned, check_compat_lossy,
+ convert_integral< Huint32, Huint8>},
+ {NDBCOL::Unsigned, NDBCOL::Smallunsigned, check_compat_lossy,
+ convert_integral< Huint32, Huint16>},
+ {NDBCOL::Unsigned, NDBCOL::Mediumunsigned, check_compat_lossy,
+ convert_integral< Huint32, Huint24>},
+ {NDBCOL::Bigunsigned, NDBCOL::Tinyunsigned, check_compat_lossy,
+ convert_integral< Huint64, Huint8>},
+ {NDBCOL::Bigunsigned, NDBCOL::Smallunsigned, check_compat_lossy,
+ convert_integral< Huint64, Huint16>},
+ {NDBCOL::Bigunsigned, NDBCOL::Mediumunsigned, check_compat_lossy,
+ convert_integral< Huint64, Huint24>},
+ {NDBCOL::Bigunsigned, NDBCOL::Unsigned, check_compat_lossy,
+ convert_integral< Huint64, Huint32>},
// integral signedness conversions
- {NDBCOL::Tinyint, NDBCOL::Tinyunsigned, check_compat_lossy, convert_int8_uint8},
- {NDBCOL::Smallint, NDBCOL::Smallunsigned, check_compat_lossy, convert_int16_uint16},
- {NDBCOL::Mediumint, NDBCOL::Mediumunsigned, check_compat_lossy, convert_int24_uint24},
- {NDBCOL::Int, NDBCOL::Unsigned, check_compat_lossy, convert_int32_uint32},
- {NDBCOL::Bigint, NDBCOL::Bigunsigned, check_compat_lossy, convert_int64_uint64},
- {NDBCOL::Tinyunsigned, NDBCOL::Tinyint, check_compat_lossy, convert_uint8_int8},
- {NDBCOL::Smallunsigned, NDBCOL::Smallint, check_compat_lossy, convert_uint16_int16},
- {NDBCOL::Mediumunsigned, NDBCOL::Mediumint, check_compat_lossy, convert_uint24_int24},
- {NDBCOL::Unsigned, NDBCOL::Int, check_compat_lossy, convert_uint32_int32},
- {NDBCOL::Bigunsigned, NDBCOL::Bigint, check_compat_lossy, convert_uint64_int64},
+ {NDBCOL::Tinyint, NDBCOL::Tinyunsigned, check_compat_lossy,
+ convert_integral< Hint8, Huint8>},
+ {NDBCOL::Smallint, NDBCOL::Smallunsigned, check_compat_lossy,
+ convert_integral< Hint16, Huint16>},
+ {NDBCOL::Mediumint, NDBCOL::Mediumunsigned, check_compat_lossy,
+ convert_integral< Hint24, Huint24>},
+ {NDBCOL::Int, NDBCOL::Unsigned, check_compat_lossy,
+ convert_integral< Hint32, Huint32>},
+ {NDBCOL::Bigint, NDBCOL::Bigunsigned, check_compat_lossy,
+ convert_integral< Hint64, Huint64>},
+ {NDBCOL::Tinyunsigned, NDBCOL::Tinyint, check_compat_lossy,
+ convert_integral< Huint8, Hint8>},
+ {NDBCOL::Smallunsigned, NDBCOL::Smallint, check_compat_lossy,
+ convert_integral< Huint16, Hint16>},
+ {NDBCOL::Mediumunsigned, NDBCOL::Mediumint, check_compat_lossy,
+ convert_integral< Huint24, Hint24>},
+ {NDBCOL::Unsigned, NDBCOL::Int, check_compat_lossy,
+ convert_integral< Huint32, Hint32>},
+ {NDBCOL::Bigunsigned, NDBCOL::Bigint, check_compat_lossy,
+ convert_integral< Huint64, Hint64>},
// integral signedness+promotion conversions
- {NDBCOL::Tinyint, NDBCOL::Smallunsigned, check_compat_lossy, convert_int8_uint16},
- {NDBCOL::Tinyint, NDBCOL::Mediumunsigned, check_compat_lossy, convert_int8_uint24},
- {NDBCOL::Tinyint, NDBCOL::Unsigned, check_compat_lossy, convert_int8_uint32},
- {NDBCOL::Tinyint, NDBCOL::Bigunsigned, check_compat_lossy, convert_int8_uint64},
- {NDBCOL::Smallint, NDBCOL::Mediumunsigned, check_compat_lossy, convert_int16_uint24},
- {NDBCOL::Smallint, NDBCOL::Unsigned, check_compat_lossy, convert_int16_uint32},
- {NDBCOL::Smallint, NDBCOL::Bigunsigned, check_compat_lossy, convert_int16_uint64},
- {NDBCOL::Mediumint, NDBCOL::Unsigned, check_compat_lossy, convert_int24_uint32},
- {NDBCOL::Mediumint, NDBCOL::Bigunsigned, check_compat_lossy, convert_int24_uint64},
- {NDBCOL::Int, NDBCOL::Bigunsigned, check_compat_lossy, convert_int32_uint64},
- {NDBCOL::Tinyunsigned, NDBCOL::Smallint, check_compat_lossy, convert_uint8_int16},
- {NDBCOL::Tinyunsigned, NDBCOL::Mediumint, check_compat_lossy, convert_uint8_int24},
- {NDBCOL::Tinyunsigned, NDBCOL::Int, check_compat_lossy, convert_uint8_int32},
- {NDBCOL::Tinyunsigned, NDBCOL::Bigint, check_compat_lossy, convert_uint8_int64},
- {NDBCOL::Smallunsigned, NDBCOL::Mediumint, check_compat_lossy, convert_uint16_int24},
- {NDBCOL::Smallunsigned, NDBCOL::Int, check_compat_lossy, convert_uint16_int32},
- {NDBCOL::Smallunsigned, NDBCOL::Bigint, check_compat_lossy, convert_uint16_int64},
- {NDBCOL::Mediumunsigned, NDBCOL::Int, check_compat_lossy, convert_uint24_int32},
- {NDBCOL::Mediumunsigned, NDBCOL::Bigint, check_compat_lossy, convert_uint24_int64},
- {NDBCOL::Unsigned, NDBCOL::Bigint, check_compat_lossy, convert_uint32_int64},
+ {NDBCOL::Tinyint, NDBCOL::Smallunsigned, check_compat_lossy,
+ convert_integral< Hint8, Huint16>},
+ {NDBCOL::Tinyint, NDBCOL::Mediumunsigned, check_compat_lossy,
+ convert_integral< Hint8, Huint24>},
+ {NDBCOL::Tinyint, NDBCOL::Unsigned, check_compat_lossy,
+ convert_integral< Hint8, Huint32>},
+ {NDBCOL::Tinyint, NDBCOL::Bigunsigned, check_compat_lossy,
+ convert_integral< Hint8, Huint64>},
+ {NDBCOL::Smallint, NDBCOL::Mediumunsigned, check_compat_lossy,
+ convert_integral< Hint16, Huint24>},
+ {NDBCOL::Smallint, NDBCOL::Unsigned, check_compat_lossy,
+ convert_integral< Hint16, Huint32>},
+ {NDBCOL::Smallint, NDBCOL::Bigunsigned, check_compat_lossy,
+ convert_integral< Hint16, Huint64>},
+ {NDBCOL::Mediumint, NDBCOL::Unsigned, check_compat_lossy,
+ convert_integral< Hint24, Huint32>},
+ {NDBCOL::Mediumint, NDBCOL::Bigunsigned, check_compat_lossy,
+ convert_integral< Hint24, Huint64>},
+ {NDBCOL::Int, NDBCOL::Bigunsigned, check_compat_lossy,
+ convert_integral< Hint32, Huint64>},
+ {NDBCOL::Tinyunsigned, NDBCOL::Smallint, check_compat_lossy,
+ convert_integral< Huint8, Hint16>},
+ {NDBCOL::Tinyunsigned, NDBCOL::Mediumint, check_compat_lossy,
+ convert_integral< Huint8, Hint24>},
+ {NDBCOL::Tinyunsigned, NDBCOL::Int, check_compat_lossy,
+ convert_integral< Huint8, Hint32>},
+ {NDBCOL::Tinyunsigned, NDBCOL::Bigint, check_compat_lossy,
+ convert_integral< Huint8, Hint64>},
+ {NDBCOL::Smallunsigned, NDBCOL::Mediumint, check_compat_lossy,
+ convert_integral< Huint16, Hint24>},
+ {NDBCOL::Smallunsigned, NDBCOL::Int, check_compat_lossy,
+ convert_integral< Huint16, Hint32>},
+ {NDBCOL::Smallunsigned, NDBCOL::Bigint, check_compat_lossy,
+ convert_integral< Huint16, Hint64>},
+ {NDBCOL::Mediumunsigned, NDBCOL::Int, check_compat_lossy,
+ convert_integral< Huint24, Hint32>},
+ {NDBCOL::Mediumunsigned, NDBCOL::Bigint, check_compat_lossy,
+ convert_integral< Huint24, Hint64>},
+ {NDBCOL::Unsigned, NDBCOL::Bigint, check_compat_lossy,
+ convert_integral< Huint32, Hint64>},
// integral signedness+demotion conversions
- {NDBCOL::Smallint, NDBCOL::Tinyunsigned, check_compat_lossy, convert_int16_uint8},
- {NDBCOL::Mediumint, NDBCOL::Tinyunsigned, check_compat_lossy, convert_int24_uint8},
- {NDBCOL::Mediumint, NDBCOL::Smallunsigned, check_compat_lossy, convert_int24_uint16},
- {NDBCOL::Int, NDBCOL::Tinyunsigned, check_compat_lossy, convert_int32_uint8},
- {NDBCOL::Int, NDBCOL::Smallunsigned, check_compat_lossy, convert_int32_uint16},
- {NDBCOL::Int, NDBCOL::Mediumunsigned, check_compat_lossy, convert_int32_uint24},
- {NDBCOL::Bigint, NDBCOL::Tinyunsigned, check_compat_lossy, convert_int64_uint8},
- {NDBCOL::Bigint, NDBCOL::Smallunsigned, check_compat_lossy, convert_int64_uint16},
- {NDBCOL::Bigint, NDBCOL::Mediumunsigned, check_compat_lossy, convert_int64_uint24},
- {NDBCOL::Bigint, NDBCOL::Unsigned, check_compat_lossy, convert_int64_uint32},
- {NDBCOL::Smallunsigned, NDBCOL::Tinyint, check_compat_lossy, convert_uint16_int8},
- {NDBCOL::Mediumunsigned, NDBCOL::Tinyint, check_compat_lossy, convert_uint24_int8},
- {NDBCOL::Mediumunsigned, NDBCOL::Smallint, check_compat_lossy, convert_uint24_int16},
- {NDBCOL::Unsigned, NDBCOL::Tinyint, check_compat_lossy, convert_uint32_int8},
- {NDBCOL::Unsigned, NDBCOL::Smallint, check_compat_lossy, convert_uint32_int16},
- {NDBCOL::Unsigned, NDBCOL::Mediumint, check_compat_lossy, convert_uint32_int24},
- {NDBCOL::Bigunsigned, NDBCOL::Tinyint, check_compat_lossy, convert_uint64_int8},
- {NDBCOL::Bigunsigned, NDBCOL::Smallint, check_compat_lossy, convert_uint64_int16},
- {NDBCOL::Bigunsigned, NDBCOL::Mediumint, check_compat_lossy, convert_uint64_int24},
- {NDBCOL::Bigunsigned, NDBCOL::Int, check_compat_lossy, convert_uint64_int32},
+ {NDBCOL::Smallint, NDBCOL::Tinyunsigned, check_compat_lossy,
+ convert_integral< Hint16, Huint8>},
+ {NDBCOL::Mediumint, NDBCOL::Tinyunsigned, check_compat_lossy,
+ convert_integral< Hint24, Huint8>},
+ {NDBCOL::Mediumint, NDBCOL::Smallunsigned, check_compat_lossy,
+ convert_integral< Hint24, Huint16>},
+ {NDBCOL::Int, NDBCOL::Tinyunsigned, check_compat_lossy,
+ convert_integral< Hint32, Huint8>},
+ {NDBCOL::Int, NDBCOL::Smallunsigned, check_compat_lossy,
+ convert_integral< Hint32, Huint16>},
+ {NDBCOL::Int, NDBCOL::Mediumunsigned, check_compat_lossy,
+ convert_integral< Hint32, Huint24>},
+ {NDBCOL::Bigint, NDBCOL::Tinyunsigned, check_compat_lossy,
+ convert_integral< Hint64, Huint8>},
+ {NDBCOL::Bigint, NDBCOL::Smallunsigned, check_compat_lossy,
+ convert_integral< Hint64, Huint16>},
+ {NDBCOL::Bigint, NDBCOL::Mediumunsigned, check_compat_lossy,
+ convert_integral< Hint64, Huint24>},
+ {NDBCOL::Bigint, NDBCOL::Unsigned, check_compat_lossy,
+ convert_integral< Hint64, Huint32>},
+ {NDBCOL::Smallunsigned, NDBCOL::Tinyint, check_compat_lossy,
+ convert_integral< Huint16, Hint8>},
+ {NDBCOL::Mediumunsigned, NDBCOL::Tinyint, check_compat_lossy,
+ convert_integral< Huint24, Hint8>},
+ {NDBCOL::Mediumunsigned, NDBCOL::Smallint, check_compat_lossy,
+ convert_integral< Huint24, Hint16>},
+ {NDBCOL::Unsigned, NDBCOL::Tinyint, check_compat_lossy,
+ convert_integral< Huint32, Hint8>},
+ {NDBCOL::Unsigned, NDBCOL::Smallint, check_compat_lossy,
+ convert_integral< Huint32, Hint16>},
+ {NDBCOL::Unsigned, NDBCOL::Mediumint, check_compat_lossy,
+ convert_integral< Huint32, Hint24>},
+ {NDBCOL::Bigunsigned, NDBCOL::Tinyint, check_compat_lossy,
+ convert_integral< Huint64, Hint8>},
+ {NDBCOL::Bigunsigned, NDBCOL::Smallint, check_compat_lossy,
+ convert_integral< Huint64, Hint16>},
+ {NDBCOL::Bigunsigned, NDBCOL::Mediumint, check_compat_lossy,
+ convert_integral< Huint64, Hint24>},
+ {NDBCOL::Bigunsigned, NDBCOL::Int, check_compat_lossy,
+ convert_integral< Huint64, Hint32>},
{NDBCOL::Undefined, NDBCOL::Undefined, NULL, NULL}
};
@@ -2487,2204 +2771,135 @@ BackupRestore::check_compat_sizes(const
}
// ----------------------------------------------------------------------
-// integral attribute promotion conversions
-// ----------------------------------------------------------------------
-
-void *
-BackupRestore::convert_int8_int16(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int8 old_data8;
- memcpy(&old_data8, old_data, 1);
- Int16 new_data16 = old_data8;
- truncated = false;
- memcpy(parameter, &new_data16, 2);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int8_int24(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int8 old_data8;
- memcpy(&old_data8, old_data, 1);
- Int32 new_data24 = old_data8;
- truncated = false;
- int3store((char*)parameter, new_data24);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int8_int32(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int8 old_data8;
- memcpy(&old_data8, old_data, 1);
- Int32 new_data32 = old_data8;
- truncated = false;
- memcpy(parameter, &new_data32, 4);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int8_int64(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int8 old_data8;
- memcpy(&old_data8, old_data, 1);
- Int64 new_data64 = old_data8;
- truncated = false;
- memcpy(parameter, &new_data64, 8);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int16_int24(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int16 old_data16;
- memcpy(&old_data16, old_data, 2);
- Int32 new_data24 = old_data16;
- truncated = false;
- int3store((char*)parameter, new_data24);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int16_int32(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int16 old_data16;
- memcpy(&old_data16, old_data, 2);
- Int32 new_data32 = old_data16;
- truncated = false;
- memcpy(parameter, &new_data32, 4);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int16_int64(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int16 old_data16;
- memcpy(&old_data16, old_data, 2);
- Int64 new_data64 = old_data16;
- truncated = false;
- memcpy(parameter, &new_data64, 8);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int24_int32(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int32 old_data24 = sint3korr((char*)old_data);
- Int32 new_data32 = old_data24;
- truncated = false;
- memcpy(parameter, &new_data32, 4);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int24_int64(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int32 old_data24 = sint3korr((char*)old_data);
- Int64 new_data64 = old_data24;
- truncated = false;
- memcpy(parameter, &new_data64, 8);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int32_int64(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int32 old_data32;
- memcpy(&old_data32, old_data, 4);
- Int64 new_data64 = old_data32;
- truncated = false;
- memcpy(parameter, &new_data64, 8);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint8_uint16(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint8 old_data8;
- memcpy(&old_data8, old_data, 1);
- Uint16 new_data16 = old_data8;
- truncated = false;
- memcpy(parameter, &new_data16, 2);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint8_uint24(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint8 old_data8;
- memcpy(&old_data8, old_data, 1);
- Uint32 new_data24 = old_data8;
- truncated = false;
- int3store((char*)parameter, new_data24);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint8_uint32(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint8 old_data8;
- memcpy(&old_data8, old_data, 1);
- Uint32 new_data32 = old_data8;
- truncated = false;
- memcpy(parameter, &new_data32, 4);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint8_uint64(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint8 old_data8;
- memcpy(&old_data8, old_data, 1);
- Uint64 new_data64 = old_data8;
- truncated = false;
- memcpy(parameter, &new_data64, 8);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint16_uint24(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint16 old_data16;
- memcpy(&old_data16, old_data, 2);
- Uint32 new_data24 = old_data16;
- truncated = false;
- int3store((char*)parameter, new_data24);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint16_uint32(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint16 old_data16;
- memcpy(&old_data16, old_data, 2);
- Uint32 new_data32 = old_data16;
- truncated = false;
- memcpy(parameter, &new_data32, 4);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint16_uint64(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint16 old_data16;
- memcpy(&old_data16, old_data, 2);
- Uint64 new_data64 = old_data16;
- truncated = false;
- memcpy(parameter, &new_data64, 8);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint24_uint32(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint32 old_data24 = uint3korr((char*)old_data);
- Uint32 new_data32 = old_data24;
- truncated = false;
- memcpy(parameter, &new_data32, 4);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint24_uint64(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint32 old_data24 = uint3korr((char*)old_data);
- Uint64 new_data64 = old_data24;
- truncated = false;
- memcpy(parameter, &new_data64, 8);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint32_uint64(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint32 old_data32;
- memcpy(&old_data32, old_data, 4);
- Uint64 new_data64 = old_data32;
- truncated = false;
- memcpy(parameter, &new_data64, 8);
-
- return parameter;
-}
-
-// ----------------------------------------------------------------------
-// integral attribute demotion conversions
-// (follows MySQL replication semantics truncating to nearest legal value)
+// explicit template instantiations
// ----------------------------------------------------------------------
-void *
-BackupRestore::convert_int16_int8(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int16 old_data16;
- memcpy(&old_data16, old_data, 2);
- Int8 new_data8;
- if (old_data16 < INT_MIN8) {
- new_data8 = (Int8)(INT_MIN8);
- truncated = true;
- } else if (old_data16 > INT_MAX8) {
- new_data8 = (Int8)(INT_MAX8);
- truncated = true;
- } else {
- new_data8 = (Int8)(old_data16);
- truncated = false;
- }
- memcpy(parameter, &new_data8, 1);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int24_int8(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int32 old_data24 = sint3korr((char*)old_data);
- Int8 new_data8;
- if (old_data24 < INT_MIN8) {
- new_data8 = (Int8)(INT_MIN8);
- truncated = true;
- } else if (old_data24 > INT_MAX8) {
- new_data8 = (Int8)(INT_MAX8);
- truncated = true;
- } else {
- new_data8 = (Int8)(old_data24);
- truncated = false;
- }
- memcpy(parameter, &new_data8, 1);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int24_int16(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int32 old_data24 = sint3korr((char*)old_data);
- Int16 new_data16;
- if (old_data24 < INT_MIN16) {
- new_data16 = (Int16)(INT_MIN16);
- truncated = true;
- } else if (old_data24 > INT_MAX16) {
- new_data16 = (Int16)(INT_MAX16);
- truncated = true;
- } else {
- new_data16 = (Int16)(old_data24);
- truncated = false;
- }
- memcpy(parameter, &new_data16, 2);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int32_int8(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int32 old_data32;
- memcpy(&old_data32, old_data, 4);
- Int8 new_data8;
- if (old_data32 < INT_MIN8) {
- new_data8 = (Int8)(INT_MIN8);
- truncated = true;
- } else if (old_data32 > INT_MAX8) {
- new_data8 = (Int8)(INT_MAX8);
- truncated = true;
- } else {
- new_data8 = (Int8)(old_data32);
- truncated = false;
- }
- memcpy(parameter, &new_data8, 1);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int32_int16(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int32 old_data32;
- memcpy(&old_data32, old_data, 4);
- Int16 new_data16;
- if (old_data32 < INT_MIN16) {
- new_data16 = (Int16)(INT_MIN16);
- truncated = true;
- } else if (old_data32 > INT_MAX16) {
- new_data16 = (Int16)(INT_MAX16);
- truncated = true;
- } else {
- new_data16 = (Int16)(old_data32);
- truncated = false;
- }
- memcpy(parameter, &new_data16, 2);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int32_int24(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int32 old_data32;
- memcpy(&old_data32, old_data, 4);
- Int32 new_data24;
- if (old_data32 < INT_MIN24) {
- new_data24 = (Int32)(INT_MIN24);
- truncated = true;
- } else if (old_data32 > INT_MAX24) {
- new_data24 = (Int32)(INT_MAX24);
- truncated = true;
- } else {
- new_data24 = (Int32)(old_data32);
- truncated = false;
- }
- int3store((char*)parameter, new_data24);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int64_int8(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int64 old_data64;
- memcpy(&old_data64, old_data, 8);
- Int8 new_data8;
- if (old_data64 < INT_MIN8) {
- new_data8 = (Int8)(INT_MIN8);
- truncated = true;
- } else if (old_data64 > INT_MAX8) {
- new_data8 = (Int8)(INT_MAX8);
- truncated = true;
- } else {
- new_data8 = (Int8)(old_data64);
- truncated = false;
- }
- memcpy(parameter, &new_data8, 1);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int64_int16(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int64 old_data64;
- memcpy(&old_data64, old_data, 8);
- Int16 new_data16;
- if (old_data64 < INT_MIN16) {
- new_data16 = (Int16)(INT_MIN16);
- truncated = true;
- } else if (old_data64 > INT_MAX16) {
- new_data16 = (Int16)(INT_MAX16);
- truncated = true;
- } else {
- new_data16 = (Int16)(old_data64);
- truncated = false;
- }
- memcpy(parameter, &new_data16, 2);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int64_int24(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int64 old_data64;
- memcpy(&old_data64, old_data, 8);
- Int32 new_data24;
- if (old_data64 < INT_MIN24) {
- new_data24 = (Int32)(INT_MIN24);
- truncated = true;
- } else if (old_data64 > INT_MAX24) {
- new_data24 = (Int32)(INT_MAX24);
- truncated = true;
- } else {
- new_data24 = (Int32)(old_data64);
- truncated = false;
- }
- int3store((char*)parameter, new_data24);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int64_int32(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int64 old_data64;
- memcpy(&old_data64, old_data, 8);
- Int32 new_data32;
- if (old_data64 < INT_MIN32) {
- new_data32 = (Int32)(INT_MIN32);
- truncated = true;
- } else if (old_data64 > INT_MAX32) {
- new_data32 = (Int32)(INT_MAX32);
- truncated = true;
- } else {
- new_data32 = (Int32)(old_data64);
- truncated = false;
- }
- memcpy(parameter, &new_data32, 4);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint16_uint8(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint16 old_data16;
- memcpy(&old_data16, old_data, 2);
- Uint8 new_data8;
- if (old_data16 > UINT_MAX8) {
- new_data8 = (Uint8)(UINT_MAX8);
- truncated = true;
- } else {
- new_data8 = (Uint8)(old_data16);
- truncated = false;
- }
- memcpy(parameter, &new_data8, 1);
-
- return parameter;
-}
+template class Vector<NdbDictionary::Table*>;
+template class Vector<const NdbDictionary::Table*>;
+template class Vector<NdbDictionary::Tablespace*>;
+template class Vector<NdbDictionary::LogfileGroup*>;
+template class Vector<NdbDictionary::HashMap*>;
+template class Vector<NdbDictionary::Index*>;
+template class Vector<Vector<NdbDictionary::Index*> >;
-void *
-BackupRestore::convert_uint24_uint8(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint32 old_data24 = uint3korr((char*)old_data);
- Uint8 new_data8;
- if (old_data24 > UINT_MAX8) {
- new_data8 = (Uint8)(UINT_MAX8);
- truncated = true;
- } else {
- new_data8 = (Uint8)(old_data24);
- truncated = false;
- }
- memcpy(parameter, &new_data8, 1);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint24_uint16(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint32 old_data24 = uint3korr((char*)old_data);
- Uint16 new_data16;
- if (old_data24 > UINT_MAX16) {
- new_data16 = (Uint16)(UINT_MAX16);
- truncated = true;
- } else {
- new_data16 = (Uint16)(old_data24);
- truncated = false;
- }
- memcpy(parameter, &new_data16, 2);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint32_uint8(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint32 old_data32;
- memcpy(&old_data32, old_data, 4);
- Uint8 new_data8;
- if (old_data32 > UINT_MAX8) {
- new_data8 = (Uint8)(UINT_MAX8);
- truncated = true;
- } else {
- new_data8 = (Uint8)(old_data32);
- truncated = false;
- }
- memcpy(parameter, &new_data8, 1);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint32_uint16(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint32 old_data32;
- memcpy(&old_data32, old_data, 4);
- Uint16 new_data16;
- if (old_data32 > UINT_MAX16) {
- new_data16 = (Uint16)(UINT_MAX16);
- truncated = true;
- } else {
- new_data16 = (Uint16)(old_data32);
- truncated = false;
- }
- memcpy(parameter, &new_data16, 2);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint32_uint24(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint32 old_data32;
- memcpy(&old_data32, old_data, 4);
- Uint32 new_data24;
- if (old_data32 > UINT_MAX24) {
- new_data24 = (Uint32)(UINT_MAX24);
- truncated = true;
- } else {
- new_data24 = (Uint32)(old_data32);
- truncated = false;
- }
- int3store((char*)parameter, new_data24);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint64_uint8(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint64 old_data64;
- memcpy(&old_data64, old_data, 8);
- Uint8 new_data8;
- if (old_data64 > UINT_MAX8) {
- new_data8 = (Uint8)(UINT_MAX8);
- truncated = true;
- } else {
- new_data8 = (Uint8)(old_data64);
- truncated = false;
- }
- memcpy(parameter, &new_data8, 1);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint64_uint16(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint64 old_data64;
- memcpy(&old_data64, old_data, 8);
- Uint16 new_data16;
- if (old_data64 > UINT_MAX16) {
- new_data16 = (Uint16)(UINT_MAX16);
- truncated = true;
- } else {
- new_data16 = (Uint16)(old_data64);
- truncated = false;
- }
- memcpy(parameter, &new_data16, 2);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint64_uint24(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint64 old_data64;
- memcpy(&old_data64, old_data, 8);
- Uint32 new_data24;
- if (old_data64 > UINT_MAX24) {
- new_data24 = (Uint32)(UINT_MAX24);
- truncated = true;
- } else {
- new_data24 = (Uint32)(old_data64);
- truncated = false;
- }
- int3store((char*)parameter, new_data24);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint64_uint32(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint64 old_data64;
- memcpy(&old_data64, old_data, 8);
- Uint32 new_data32;
- if (old_data64 > UINT_MAX32) {
- new_data32 = (Uint32)(UINT_MAX32);
- truncated = true;
- } else {
- new_data32 = (Uint32)(old_data64);
- truncated = false;
- }
- memcpy(parameter, &new_data32, 4);
-
- return parameter;
-}
-
-// ----------------------------------------------------------------------
-// integral attribute signedness conversions
-// (follows MySQL replication semantics truncating to nearest legal value)
-// ----------------------------------------------------------------------
-
-void *
-BackupRestore::convert_int8_uint8(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int8 old_data8;
- memcpy(&old_data8, old_data, 1);
- Uint8 new_data8;
- if (old_data8 < 0) {
- new_data8 = (Uint8)0;
- truncated = true;
- } else {
- new_data8 = (Uint8)(old_data8);
- truncated = false;
- }
- memcpy(parameter, &new_data8, 1);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int16_uint16(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int16 old_data16;
- memcpy(&old_data16, old_data, 2);
- Uint16 new_data16;
- if (old_data16 < 0) {
- new_data16 = (Uint16)0;
- truncated = true;
- } else {
- new_data16 = (Uint16)(old_data16);
- truncated = false;
- }
- memcpy(parameter, &new_data16, 2);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int24_uint24(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int32 old_data24 = sint3korr((char*)old_data);
- Uint32 new_data24;
- if (old_data24 < 0) {
- new_data24 = (Uint32)0;
- truncated = true;
- } else {
- new_data24 = (Uint32)(old_data24);
- truncated = false;
- }
- int3store((char*)parameter, new_data24);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int32_uint32(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int32 old_data32;
- memcpy(&old_data32, old_data, 4);
- Uint32 new_data32;
- if (old_data32 < 0) {
- new_data32 = (Uint32)0;
- truncated = true;
- } else {
- new_data32 = (Uint32)(old_data32);
- truncated = false;
- }
- memcpy(parameter, &new_data32, 4);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int64_uint64(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int64 old_data64;
- memcpy(&old_data64, old_data, 8);
- Uint64 new_data64;
- if (old_data64 < 0) {
- new_data64 = (Uint64)0;
- truncated = true;
- } else {
- new_data64 = (Uint64)(old_data64);
- truncated = false;
- }
- memcpy(parameter, &new_data64, 8);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint8_int8(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint8 old_data8;
- memcpy(&old_data8, old_data, 1);
- Int8 new_data8;
- if (old_data8 > INT_MAX8) {
- new_data8 = (Int8)(INT_MAX8);
- truncated = true;
- } else {
- new_data8 = (Int8)(old_data8);
- truncated = false;
- }
- memcpy(parameter, &new_data8, 1);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint16_int16(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint16 old_data16;
- memcpy(&old_data16, old_data, 2);
- Int16 new_data16;
- if (old_data16 > INT_MAX16) {
- new_data16 = (Int16)(INT_MAX16);
- truncated = true;
- } else {
- new_data16 = (Int16)(old_data16);
- truncated = false;
- }
- memcpy(parameter, &new_data16, 2);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint24_int24(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint32 old_data24 = uint3korr((char*)old_data);
- Int32 new_data24 = (Int32)((old_data24 > INT_MAX24) ? INT_MAX24
- : old_data24);
- if (old_data24 > INT_MAX24) {
- new_data24 = (Int32)(INT_MAX24);
- truncated = true;
- } else {
- new_data24 = (Int32)(old_data24);
- truncated = false;
- }
- int3store((char*)parameter, new_data24);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint32_int32(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint32 old_data32;
- memcpy(&old_data32, old_data, 4);
- Int32 new_data32;
- if (old_data32 > INT_MAX32) {
- new_data32 = (Int32)(INT_MAX32);
- truncated = true;
- } else {
- new_data32 = (Int32)(old_data32);
- truncated = false;
- }
- memcpy(parameter, &new_data32, 4);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint64_int64(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint64 old_data64;
- memcpy(&old_data64, old_data, 8);
- Int64 new_data64;
- if (old_data64 > INT_MAX64) {
- new_data64 = (Int64)(INT_MAX64);
- truncated = true;
- } else {
- new_data64 = (Int64)(old_data64);
- truncated = false;
- }
- memcpy(parameter, &new_data64, 8);
-
- return parameter;
-}
-
-// ----------------------------------------------------------------------
-// integral attribute signedness+promotion conversions
-// (follows MySQL replication semantics truncating to nearest legal value)
-// ----------------------------------------------------------------------
-
-void *
-BackupRestore::convert_int8_uint16(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int8 old_data8;
- memcpy(&old_data8, old_data, 1);
- Uint16 new_data16;
- if (old_data8 < 0) {
- new_data16 = (Uint16)0;
- truncated = true;
- } else {
- new_data16 = (Uint16)old_data8;
- truncated = false;
- }
- memcpy(parameter, &new_data16, 2);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int8_uint24(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int8 old_data8;
- memcpy(&old_data8, old_data, 1);
- Uint32 new_data24;
- if (old_data8 < 0) {
- new_data24 = (Uint32)0;
- truncated = true;
- } else {
- new_data24 = (Uint32)old_data8;
- truncated = false;
- }
- int3store((char*)parameter, new_data24);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int8_uint32(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int8 old_data8;
- memcpy(&old_data8, old_data, 1);
- Uint32 new_data32;
- if (old_data8 < 0) {
- new_data32 = (Uint32)0;
- truncated = true;
- } else {
- new_data32 = (Uint32)old_data8;
- truncated = false;
- }
- memcpy(parameter, &new_data32, 4);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int8_uint64(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int8 old_data8;
- memcpy(&old_data8, old_data, 1);
- Uint64 new_data64;
- if (old_data8 < 0) {
- new_data64 = (Uint64)0;
- truncated = true;
- } else {
- new_data64 = (Uint64)old_data8;
- truncated = false;
- }
- memcpy(parameter, &new_data64, 8);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int16_uint24(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int16 old_data16;
- memcpy(&old_data16, old_data, 2);
- Uint32 new_data24;
- if (old_data16 < 0) {
- new_data24 = (Uint32)0;
- truncated = true;
- } else {
- new_data24 = (Uint32)old_data16;
- truncated = false;
- }
- int3store((char*)parameter, new_data24);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int16_uint32(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int16 old_data16;
- memcpy(&old_data16, old_data, 2);
- Uint32 new_data32;
- if (old_data16 < 0) {
- new_data32 = (Uint32)0;
- truncated = true;
- } else {
- new_data32 = (Uint32)old_data16;
- truncated = false;
- }
- memcpy(parameter, &new_data32, 4);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int16_uint64(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int16 old_data16;
- memcpy(&old_data16, old_data, 2);
- Uint64 new_data64;
- if (old_data16 < 0) {
- new_data64 = (Uint64)0;
- truncated = true;
- } else {
- new_data64 = (Uint64)old_data16;
- truncated = false;
- }
- memcpy(parameter, &new_data64, 8);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int24_uint32(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int32 old_data24 = sint3korr((char*)old_data);
- Uint32 new_data32;
- if (old_data24 < 0) {
- new_data32 = (Uint32)0;
- truncated = true;
- } else {
- new_data32 = (Uint32)old_data24;
- truncated = false;
- }
- memcpy(parameter, &new_data32, 4);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int24_uint64(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int32 old_data24 = sint3korr((char*)old_data);
- Uint64 new_data64;
- if (old_data24 < 0) {
- new_data64 = (Uint64)0;
- truncated = true;
- } else {
- new_data64 = (Uint64)old_data24;
- truncated = false;
- }
- memcpy(parameter, &new_data64, 8);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int32_uint64(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int32 old_data32;
- memcpy(&old_data32, old_data, 4);
- Uint64 new_data64;
- if (old_data32 < 0) {
- new_data64 = (Uint64)0;
- truncated = true;
- } else {
- new_data64 = (Uint64)old_data32;
- truncated = false;
- }
- memcpy(parameter, &new_data64, 8);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint8_int16(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint8 old_data8;
- memcpy(&old_data8, old_data, 1);
- Int16 new_data16 = old_data8;
- truncated = false;
- memcpy(parameter, &new_data16, 2);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint8_int24(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint8 old_data8;
- memcpy(&old_data8, old_data, 1);
- Int32 new_data24 = old_data8;
- truncated = false;
- int3store((char*)parameter, new_data24);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint8_int32(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint8 old_data8;
- memcpy(&old_data8, old_data, 1);
- Int32 new_data32 = old_data8;
- truncated = false;
- memcpy(parameter, &new_data32, 4);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint8_int64(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint8 old_data8;
- memcpy(&old_data8, old_data, 1);
- Int64 new_data64 = old_data8;
- truncated = false;
- memcpy(parameter, &new_data64, 8);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint16_int24(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint16 old_data16;
- memcpy(&old_data16, old_data, 2);
- Int32 new_data24 = old_data16;
- truncated = false;
- int3store((char*)parameter, new_data24);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint16_int32(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint16 old_data16;
- memcpy(&old_data16, old_data, 2);
- Int32 new_data32 = old_data16;
- truncated = false;
- memcpy(parameter, &new_data32, 4);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint16_int64(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint16 old_data16;
- memcpy(&old_data16, old_data, 2);
- Int64 new_data64 = old_data16;
- truncated = false;
- memcpy(parameter, &new_data64, 8);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint24_int32(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint32 old_data24 = uint3korr((char*)old_data);
- Int32 new_data32 = old_data24;
- truncated = false;
- memcpy(parameter, &new_data32, 4);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint24_int64(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint32 old_data24 = uint3korr((char*)old_data);
- Int64 new_data64 = old_data24;
- truncated = false;
- memcpy(parameter, &new_data64, 8);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint32_int64(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint32 old_data32;
- memcpy(&old_data32, old_data, 4);
- Int64 new_data64 = old_data32;
- truncated = false;
- memcpy(parameter, &new_data64, 8);
-
- return parameter;
-}
-
-// ----------------------------------------------------------------------
-// integral attribute signedness+demotion conversions
-// (follows MySQL replication semantics truncating to nearest legal value)
-// ----------------------------------------------------------------------
-
-void *
-BackupRestore::convert_int16_uint8(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int16 old_data16;
- memcpy(&old_data16, old_data, 2);
- Uint8 new_data8;
- if (old_data16 < 0) {
- new_data8 = (Uint8)0;
- truncated = true;
- } else if (old_data16 > UINT_MAX8) {
- new_data8 = (Uint8)UINT_MAX8;
- truncated = true;
- } else {
- new_data8 = (Uint8)old_data16;
- truncated = false;
- }
- memcpy(parameter, &new_data8, 1);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int24_uint8(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int32 old_data24 = sint3korr((char*)old_data);
- Uint8 new_data8;
- if (old_data24 < 0) {
- new_data8 = (Uint8)0;
- truncated = true;
- } else if (old_data24 > UINT_MAX8) {
- new_data8 = (Uint8)UINT_MAX8;
- truncated = true;
- } else {
- new_data8 = (Uint8)old_data24;
- truncated = false;
- }
- memcpy(parameter, &new_data8, 1);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int24_uint16(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int32 old_data24 = sint3korr((char*)old_data);
- Uint16 new_data16;
- if (old_data24 < 0) {
- new_data16 = (Uint16)0;
- truncated = true;
- } else if (old_data24 > UINT_MAX16) {
- new_data16 = (Uint16)UINT_MAX16;
- truncated = true;
- } else {
- new_data16 = (Uint16)old_data24;
- truncated = false;
- }
- memcpy(parameter, &new_data16, 2);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int32_uint8(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int32 old_data32;
- memcpy(&old_data32, old_data, 4);
- Uint8 new_data8;
- if (old_data32 < 0) {
- new_data8 = (Uint8)0;
- truncated = true;
- } else if (old_data32 > UINT_MAX8) {
- new_data8 = (Uint8)UINT_MAX8;
- truncated = true;
- } else {
- new_data8 = (Uint8)old_data32;
- truncated = false;
- }
- memcpy(parameter, &new_data8, 1);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int32_uint16(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int32 old_data32;
- memcpy(&old_data32, old_data, 4);
- Uint16 new_data16;
- if (old_data32 < 0) {
- new_data16 = (Uint16)0;
- truncated = true;
- } else if (old_data32 > UINT_MAX16) {
- new_data16 = (Uint16)UINT_MAX16;
- truncated = true;
- } else {
- new_data16 = (Uint16)old_data32;
- truncated = false;
- }
- memcpy(parameter, &new_data16, 2);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int32_uint24(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int32 old_data32;
- memcpy(&old_data32, old_data, 4);
- Uint32 new_data24;
- if (old_data32 < 0) {
- new_data24 = (Uint32)0;
- truncated = true;
- } else if (old_data32 > UINT_MAX24) {
- new_data24 = (Uint32)UINT_MAX24;
- truncated = true;
- } else {
- new_data24 = (Uint32)old_data32;
- truncated = false;
- }
- int3store((char*)parameter, new_data24);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int64_uint8(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int64 old_data64;
- memcpy(&old_data64, old_data, 8);
- Uint8 new_data8;
- if (old_data64 < 0) {
- new_data8 = (Uint8)0;
- truncated = true;
- } else if (old_data64 > UINT_MAX8) {
- new_data8 = (Uint8)UINT_MAX8;
- truncated = true;
- } else {
- new_data8 = (Uint8)old_data64;
- truncated = false;
- }
- memcpy(parameter, &new_data8, 1);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int64_uint16(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int64 old_data64;
- memcpy(&old_data64, old_data, 8);
- Uint16 new_data16;
- if (old_data64 < 0) {
- new_data16 = (Uint16)0;
- truncated = true;
- } else if (old_data64 > UINT_MAX16) {
- new_data16 = (Uint16)UINT_MAX16;
- truncated = true;
- } else {
- new_data16 = (Uint16)old_data64;
- truncated = false;
- }
- memcpy(parameter, &new_data16, 2);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int64_uint24(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int64 old_data64;
- memcpy(&old_data64, old_data, 8);
- Uint32 new_data24;
- if (old_data64 < 0) {
- new_data24 = (Uint32)0;
- truncated = true;
- } else if (old_data64 > UINT_MAX24) {
- new_data24 = (Uint32)UINT_MAX24;
- truncated = true;
- } else {
- new_data24 = (Uint32)old_data64;
- truncated = false;
- }
- int3store((char*)parameter, new_data24);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_int64_uint32(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Int64 old_data64;
- memcpy(&old_data64, old_data, 8);
- Uint32 new_data32;
- if (old_data64 < 0) {
- new_data32 = (Uint32)0;
- truncated = true;
- } else if (old_data64 > UINT_MAX32) {
- new_data32 = (Uint32)UINT_MAX32;
- truncated = true;
- } else {
- new_data32 = (Uint32)old_data64;
- truncated = false;
- }
- memcpy(parameter, &new_data32, 4);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint16_int8(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint16 old_data16;
- memcpy(&old_data16, old_data, 2);
- Int8 new_data8;
- if (old_data16 > INT_MAX8) {
- new_data8 = (Int8)INT_MAX8;
- truncated = true;
- } else {
- new_data8 = (Int8)old_data16;
- truncated = false;
- }
- memcpy(parameter, &new_data8, 1);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint24_int8(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint32 old_data24 = uint3korr((char*)old_data);
- Int8 new_data8;
- if (old_data24 > INT_MAX8) {
- new_data8 = (Int8)INT_MAX8;
- truncated = true;
- } else {
- new_data8 = (Int8)old_data24;
- truncated = false;
- }
- memcpy(parameter, &new_data8, 1);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint24_int16(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint32 old_data24 = uint3korr((char*)old_data);
- Int16 new_data16;
- if (old_data24 > INT_MAX16) {
- new_data16 = (Int16)INT_MAX16;
- truncated = true;
- } else {
- new_data16 = (Int16)old_data24;
- truncated = false;
- }
- memcpy(parameter, &new_data16, 2);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint32_int8(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint32 old_data32;
- memcpy(&old_data32, old_data, 4);
- Int8 new_data8;
- if (old_data32 > INT_MAX8) {
- new_data8 = (Int8)INT_MAX8;
- truncated = true;
- } else {
- new_data8 = (Int8)old_data32;
- truncated = false;
- }
- memcpy(parameter, &new_data8, 1);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint32_int16(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint32 old_data32;
- memcpy(&old_data32, old_data, 4);
- Int16 new_data16;
- if (old_data32 > INT_MAX16) {
- new_data16 = (Int16)INT_MAX16;
- truncated = true;
- } else {
- new_data16 = (Int16)old_data32;
- truncated = false;
- }
- memcpy(parameter, &new_data16, 2);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint32_int24(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint32 old_data32;
- memcpy(&old_data32, old_data, 4);
- Int32 new_data24;
- if (old_data32 > INT_MAX24) {
- new_data24 = (Int32)INT_MAX24;
- truncated = true;
- } else {
- new_data24 = (Int32)old_data32;
- truncated = false;
- }
- int3store((char*)parameter, new_data24);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint64_int8(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint64 old_data64;
- memcpy(&old_data64, old_data, 8);
- Int8 new_data8;
- if (old_data64 > INT_MAX8) {
- new_data8 = (Int8)INT_MAX8;
- truncated = true;
- } else {
- new_data8 = (Int8)old_data64;
- truncated = false;
- }
- memcpy(parameter, &new_data8, 1);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint64_int16(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint64 old_data64;
- memcpy(&old_data64, old_data, 8);
- Int16 new_data16;
- if (old_data64 > INT_MAX16) {
- new_data16 = (Int16)INT_MAX16;
- truncated = true;
- } else {
- new_data16 = (Int16)old_data64;
- truncated = false;
- }
- memcpy(parameter, &new_data16, 2);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint64_int24(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint64 old_data64;
- memcpy(&old_data64, old_data, 8);
- Int32 new_data24;
- if (old_data64 > INT_MAX24) {
- new_data24 = (Int32)INT_MAX24;
- truncated = true;
- } else {
- new_data24 = (Int32)old_data64;
- truncated = false;
- }
- int3store((char*)parameter, new_data24);
-
- return parameter;
-}
-
-void *
-BackupRestore::convert_uint64_int32(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- Uint64 old_data64;
- memcpy(&old_data64, old_data, 8);
- Int32 new_data32;
- if (old_data64 > INT_MAX32) {
- new_data32 = (Int32)INT_MAX32;
- truncated = true;
- } else {
- new_data32 = (Int32)old_data64;
- truncated = false;
- }
- memcpy(parameter, &new_data32, 4);
-
- return parameter;
-}
-
-// ----------------------------------------------------------------------
-// attribute promotion/demotion conversions
-// ----------------------------------------------------------------------
-
-void *
-BackupRestore::convert_bit_bit(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- if (!old_data || !parameter)
- return NULL;
-
- // shortcuts
- const unsigned char * const s = (const unsigned char *)old_data;
- char_n_padding_struct * const t = (char_n_padding_struct *)parameter;
-
- // write data
- if (t->n_new >= t->n_old)
- {
- // clear all bits
- memset(t->new_row, 0, t->n_new);
-
- memcpy(t->new_row, s, t->n_old);
- truncated = false;
- } else {
- // set all bits, for parity with replication's demotion semantics
- memset(t->new_row, 0xFF, t->n_new);
- truncated = true;
- }
-
- return t->new_row;
-}
-
-void *
-BackupRestore::convert_char_char(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- if (!old_data || !parameter)
- return NULL;
-
- // shortcuts
- const char * const s = (const char *)old_data;
- char_n_padding_struct * const t = (char_n_padding_struct *)parameter;
- const Uint32 s_prefix_length = 0;
- const Uint32 t_prefix_length = 0;
-
- // read and adjust length
- Uint32 length = t->n_old;
- const Uint32 max_length = t->n_new - t_prefix_length;
- if (!m_preserve_trailing_spaces) {
- // ignore padding chars for data copying or truncation reporting
- while (length > 0 && s[length - 1] == ' ')
- length--;
- }
- if (length <= max_length) {
- truncated = false;
- } else {
- length = max_length;
- truncated = true;
- }
-
- // write data and padding
- memcpy(t->new_row + t_prefix_length, s + s_prefix_length, length);
- const Uint32 l = max_length - length;
- memset(t->new_row + t_prefix_length + length, ' ', l);
-
- return t->new_row;
-}
-
-void *
-BackupRestore::convert_binary_binary(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- if (!old_data || !parameter)
- return NULL;
-
- // shortcuts
- const char * const s = (const char *)old_data;
- char_n_padding_struct * const t = (char_n_padding_struct *)parameter;
- const Uint32 s_prefix_length = 0;
- const Uint32 t_prefix_length = 0;
-
- // read and adjust length
- Uint32 length = t->n_old;
- if (!m_preserve_trailing_spaces) {
- // ignore padding chars for data copying or truncation reporting
- while (length > 0 && s[length - 1] == 0x00)
- length--;
- }
- const Uint32 max_length = t->n_new - t_prefix_length;
- if (length <= max_length) {
- truncated = false;
- } else {
- length = max_length;
- truncated = true;
- }
-
- // write data and padding
- memcpy(t->new_row + t_prefix_length, s + s_prefix_length, length);
- const Uint32 l = max_length - length;
- memset(t->new_row + t_prefix_length + length, 0x00, l);
-
- return t->new_row;
-}
-
-void *
-BackupRestore::convert_char_varchar(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- if (!old_data || !parameter)
- return NULL;
-
- // shortcuts
- const char * const s = (const char *)old_data;
- char_n_padding_struct * const t = (char_n_padding_struct *)parameter;
- const Uint32 s_prefix_length = 0;
- const Uint32 t_prefix_length = 1;
-
- // read and adjust length
- Uint32 length = t->n_old;
- if (!m_preserve_trailing_spaces) {
- // ignore padding chars for data copying or truncation reporting
- while (length > 0 && s[length - 1] == ' ')
- length--;
- }
- const Uint32 max_length = t->n_new - t_prefix_length;
- if (length <= max_length) {
- truncated = false;
- } else {
- length = max_length;
- truncated = true;
- }
-
- // write length prefix and data
- t->new_row[0] = length & 0x000000FF;
- memcpy(t->new_row + t_prefix_length, s + s_prefix_length, length);
-
- return t->new_row;
-}
-
-void *
-BackupRestore::convert_varchar_char(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- if (!old_data || !parameter)
- return NULL;
-
- // shortcuts
- const unsigned char * const s = (const unsigned char *)old_data;
- char_n_padding_struct * const t = (char_n_padding_struct *)parameter;
- const Uint32 s_prefix_length = 1;
- const Uint32 t_prefix_length = 0;
-
- // read and adjust length
- Uint32 length = s[0];
- const Uint32 max_length = t->n_new - t_prefix_length;
- if (length <= max_length) {
- truncated = false;
- } else {
- length = max_length;
- truncated = true;
- }
-
- // write data and padding
- memcpy(t->new_row + t_prefix_length, s + s_prefix_length, length);
- const Uint32 l = max_length - length;
- memset(t->new_row + t_prefix_length + length, ' ', l);
-
- return t->new_row;
-}
-
-void *
-BackupRestore::convert_char_longvarchar(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- if (!old_data || !parameter)
- return NULL;
-
- // shortcuts
- const char * const s = (const char *)old_data;
- char_n_padding_struct * const t = (char_n_padding_struct *)parameter;
- const Uint32 s_prefix_length = 0;
- const Uint32 t_prefix_length = 2;
-
- // read and adjust length
- Uint32 length = t->n_old;
- if (!m_preserve_trailing_spaces) {
- // ignore padding chars for data copying or truncation reporting
- while (length > 0 && s[length - 1] == ' ')
- length--;
- }
- const Uint32 max_length = t->n_new - t_prefix_length;
- if (length <= max_length) {
- truncated = false;
- } else {
- length = max_length;
- truncated = true;
- }
-
- // write length prefix and data
- t->new_row[0] = length & 0x000000FF;
- t->new_row[1] = (length & 0x0000FF00) >> 8;
- memcpy(t->new_row + t_prefix_length, s + s_prefix_length, length);
-
- return t->new_row;
-}
-
-void *
-BackupRestore::convert_longvarchar_char(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- if (!old_data || !parameter)
- return NULL;
-
- // shortcuts
- const unsigned char * const s = (const unsigned char *)old_data;
- char_n_padding_struct * const t = (char_n_padding_struct *)parameter;
- const Uint32 s_prefix_length = 2;
- const Uint32 t_prefix_length = 0;
-
- // read and adjust length
- Uint32 length = s[0] + (s[1] << 8);
- const Uint32 max_length = t->n_new - t_prefix_length;
- if (length <= max_length) {
- truncated = false;
- } else {
- length = max_length;
- truncated = true;
- }
-
- // write data and padding
- memcpy(t->new_row + t_prefix_length, s + s_prefix_length, length);
- const Uint32 l = max_length - length;
- memset(t->new_row + t_prefix_length + length, ' ', l);
-
- return t->new_row;
-}
-
-void *
-BackupRestore::convert_binary_varbinary(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- if (!old_data || !parameter)
- return NULL;
-
- // shortcuts
- const char * const s = (const char *)old_data;
- char_n_padding_struct * const t = (char_n_padding_struct *)parameter;
- const Uint32 s_prefix_length = 0;
- const Uint32 t_prefix_length = 1;
-
- // read and adjust length
- Uint32 length = t->n_old;
- if (!m_preserve_trailing_spaces) {
- // ignore padding chars for data copying or truncation reporting
- while (length > 0 && s[length - 1] == 0x00)
- length--;
- }
- const Uint32 max_length = t->n_new - t_prefix_length;
- if (length <= max_length) {
- truncated = false;
- } else {
- length = max_length;
- truncated = true;
- }
-
- // write length prefix and data
- t->new_row[0] = length & 0x000000FF;
- memcpy(t->new_row + t_prefix_length, s + s_prefix_length, length);
-
- return t->new_row;
-}
-
-void *
-BackupRestore::convert_varbinary_binary(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- if (!old_data || !parameter)
- return NULL;
-
- // shortcuts
- const unsigned char * const s = (const unsigned char *)old_data;
- char_n_padding_struct * const t = (char_n_padding_struct *)parameter;
- const Uint32 s_prefix_length = 1;
- const Uint32 t_prefix_length = 0;
-
- // read and adjust length
- Uint32 length = s[0];
- const Uint32 max_length = t->n_new - t_prefix_length;
- if (length <= max_length) {
- truncated = false;
- } else {
- length = max_length;
- truncated = true;
- }
-
- // write data and padding
- memcpy(t->new_row + t_prefix_length, s + s_prefix_length, length);
- const Uint32 l = max_length - length;
- memset(t->new_row + t_prefix_length + length, 0x00, l);
-
- return t->new_row;
-}
-
-void *
-BackupRestore::convert_binary_longvarbinary(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- if (!old_data || !parameter)
- return NULL;
-
- // shortcuts
- const char * const s = (const char *)old_data;
- char_n_padding_struct * const t = (char_n_padding_struct *)parameter;
- const Uint32 s_prefix_length = 0;
- const Uint32 t_prefix_length = 2;
-
- // read and adjust length
- Uint32 length = t->n_old;
- if (!m_preserve_trailing_spaces) {
- // ignore padding chars for data copying or truncation reporting
- while (length > 0 && s[length - 1] == 0x00)
- length--;
- }
- const Uint32 max_length = t->n_new - t_prefix_length;
- if (length <= max_length) {
- truncated = false;
- } else {
- length = max_length;
- truncated = true;
- }
-
- // write length prefix and data
- t->new_row[0] = length & 0x000000FF;
- t->new_row[1] = (length & 0x0000FF00) >> 8;
- memcpy(t->new_row + t_prefix_length, s + s_prefix_length, length);
-
- return t->new_row;
-}
-
-void *
-BackupRestore::convert_longvarbinary_binary(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- if (!old_data || !parameter)
- return NULL;
-
- // shortcuts
- const unsigned char * const s = (const unsigned char *)old_data;
- char_n_padding_struct * const t = (char_n_padding_struct *)parameter;
- const Uint32 s_prefix_length = 2;
- const Uint32 t_prefix_length = 0;
-
- // read and adjust length
- Uint32 length = s[0] + (s[1] << 8);
- const Uint32 max_length = t->n_new - t_prefix_length;
- if (length <= max_length) {
- truncated = false;
- } else {
- length = max_length;
- truncated = true;
- }
-
- // write data and padding
- memcpy(t->new_row + t_prefix_length, s + s_prefix_length, length);
- const Uint32 l = max_length - length;
- memset(t->new_row + t_prefix_length + length, 0x00, l);
-
- return t->new_row;
-}
-
-void *
-BackupRestore::convert_var_var(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- if (!old_data || !parameter)
- return NULL;
-
- // shortcuts
- const unsigned char * const s = (const unsigned char *)old_data;
- char_n_padding_struct * const t = (char_n_padding_struct *)parameter;
- const Uint32 s_prefix_length = 1;
- const Uint32 t_prefix_length = 1;
-
- // read and adjust length
- Uint32 length = s[0];
- const Uint32 max_length = t->n_new - t_prefix_length;
- if (length <= max_length) {
- truncated = false;
- } else {
- length = max_length;
- truncated = true;
- }
-
- // write length prefix and data
- t->new_row[0] = length & 0x000000FF;
- memcpy(t->new_row + t_prefix_length, s + s_prefix_length, length);
-
- return t->new_row;
-}
-
-void *
-BackupRestore::convert_var_longvar(const void *old_data,
- void *parameter,
- bool &truncated)
-
-{
- if (!old_data || !parameter)
- return NULL;
-
- // shortcuts
- const unsigned char * const s = (const unsigned char *)old_data;
- char_n_padding_struct * const t = (char_n_padding_struct *)parameter;
- const Uint32 s_prefix_length = 1;
- const Uint32 t_prefix_length = 2;
-
- // read and adjust length
- Uint32 length = s[0];
- const Uint32 max_length = t->n_new - t_prefix_length;
- if (length <= max_length) {
- truncated = false;
- } else {
- length = max_length;
- truncated = true;
- }
-
- // write length prefix and data
- t->new_row[0] = length & 0x000000FF;
- t->new_row[1] = (length & 0x0000FF00) >> 8;
- memcpy(t->new_row + t_prefix_length, s + s_prefix_length, length);
-
- return t->new_row;
-}
-
-void *
-BackupRestore::convert_longvar_var(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- if (!old_data || !parameter)
- return NULL;
-
- // shortcuts
- const unsigned char * const s = (const unsigned char *)old_data;
- char_n_padding_struct * const t = (char_n_padding_struct *)parameter;
- const Uint32 s_prefix_length = 2;
- const Uint32 t_prefix_length = 1;
-
- // read and adjust length
- Uint32 length = s[0] + (s[1] << 8);
- const Uint32 max_length = t->n_new - t_prefix_length;
- if (length <= max_length) {
- truncated = false;
- } else {
- length = max_length;
- truncated = true;
- }
-
- // write length prefix and data
- t->new_row[0] = length & 0x000000FF;
- memcpy(t->new_row + t_prefix_length, s + s_prefix_length, length);
-
- return t->new_row;
-}
-
-void *
-BackupRestore::convert_longvar_longvar(const void *old_data,
- void *parameter,
- bool &truncated)
-{
- if (!old_data || !parameter)
- return NULL;
-
- // shortcuts
- const unsigned char * const s = (const unsigned char *)old_data;
- char_n_padding_struct * const t = (char_n_padding_struct *)parameter;
- const Uint32 s_prefix_length = 2;
- const Uint32 t_prefix_length = 2;
-
- // read and adjust length
- Uint32 length = s[0] + (s[1] << 8);
- const Uint32 max_length = t->n_new - t_prefix_length;
- if (length <= max_length) {
- truncated = false;
- } else {
- length = max_length;
- truncated = true;
- }
-
- // write length prefix and data
- t->new_row[0] = length & 0x000000FF;
- t->new_row[1] = (length & 0x0000FF00) >> 8;
- memcpy(t->new_row + t_prefix_length, s + s_prefix_length, length);
-
- return t->new_row;
-}
-
-template class Vector<NdbDictionary::Table*>;
-template class Vector<const NdbDictionary::Table*>;
-template class Vector<NdbDictionary::Tablespace*>;
-template class Vector<NdbDictionary::LogfileGroup*>;
-template class Vector<NdbDictionary::HashMap*>;
-template class Vector<NdbDictionary::Index*>;
-template class Vector<Vector<NdbDictionary::Index*> >;
+// char array promotions/demotions
+template void * BackupRestore::convert_array< Hchar, Hchar >(const void *, void *, bool &);
+template void * BackupRestore::convert_array< Hchar, Hvarchar >(const void *, void *, bool &);
+template void * BackupRestore::convert_array< Hchar, Hlongvarchar >(const void *, void *, bool &);
+template void * BackupRestore::convert_array< Hvarchar, Hchar >(const void *, void *, bool &);
+template void * BackupRestore::convert_array< Hvarchar, Hvarchar >(const void *, void *, bool &);
+template void * BackupRestore::convert_array< Hvarchar, Hlongvarchar >(const void *, void *, bool &);
+template void * BackupRestore::convert_array< Hlongvarchar, Hchar >(const void *, void *, bool &);
+template void * BackupRestore::convert_array< Hlongvarchar, Hvarchar >(const void *, void *, bool &);
+template void * BackupRestore::convert_array< Hlongvarchar, Hlongvarchar >(const void *, void *, bool &);
+
+// binary array promotions/demotions
+template void * BackupRestore::convert_array< Hbinary, Hbinary >(const void *, void *, bool &);
+template void * BackupRestore::convert_array< Hbinary, Hvarbinary >(const void *, void *, bool &);
+template void * BackupRestore::convert_array< Hbinary, Hlongvarbinary >(const void *, void *, bool &);
+template void * BackupRestore::convert_array< Hvarbinary, Hbinary >(const void *, void *, bool &);
+template void * BackupRestore::convert_array< Hvarbinary, Hvarbinary >(const void *, void *, bool &);
+template void * BackupRestore::convert_array< Hvarbinary, Hlongvarbinary >(const void *, void *, bool &);
+template void * BackupRestore::convert_array< Hlongvarbinary, Hbinary >(const void *, void *, bool &);
+template void * BackupRestore::convert_array< Hlongvarbinary, Hvarbinary >(const void *, void *, bool &);
+template void * BackupRestore::convert_array< Hlongvarbinary, Hlongvarbinary >(const void *, void *, bool &);
+
+// integral promotions
+template void * BackupRestore::convert_integral<Hint8, Hint16>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint8, Hint24>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint8, Hint32>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint8, Hint64>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint16, Hint24>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint16, Hint32>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint16, Hint64>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint24, Hint32>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint24, Hint64>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint32, Hint64>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint8, Huint16>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint8, Huint24>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint8, Huint32>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint8, Huint64>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint16, Huint24>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint16, Huint32>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint16, Huint64>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint24, Huint32>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint24, Huint64>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint32, Huint64>(const void *, void *, bool &);
+
+// integral demotions
+template void * BackupRestore::convert_integral<Hint16, Hint8>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint24, Hint8>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint24, Hint16>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint32, Hint8>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint32, Hint16>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint32, Hint24>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint64, Hint8>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint64, Hint16>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint64, Hint24>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint64, Hint32>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint16, Huint8>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint24, Huint8>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint24, Huint16>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint32, Huint8>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint32, Huint16>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint32, Huint24>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint64, Huint8>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint64, Huint16>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint64, Huint24>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint64, Huint32>(const void *, void *, bool &);
+
+// integral signedness BackupRestore::conversions
+template void * BackupRestore::convert_integral<Hint8, Huint8>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint16, Huint16>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint24, Huint24>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint32, Huint32>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint64, Huint64>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint8, Hint8>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint16, Hint16>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint24, Hint24>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint32, Hint32>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint64, Hint64>(const void *, void *, bool &);
+
+// integral signedness+promotion BackupRestore::conversions
+template void * BackupRestore::convert_integral<Hint8, Huint16>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint8, Huint24>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint8, Huint32>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint8, Huint64>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint16, Huint24>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint16, Huint32>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint16, Huint64>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint24, Huint32>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint24, Huint64>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint32, Huint64>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint8, Hint16>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint8, Hint24>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint8, Hint32>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint8, Hint64>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint16, Hint24>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint16, Hint32>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint16, Hint64>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint24, Hint32>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint24, Hint64>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint32, Hint64>(const void *, void *, bool &);
+
+// integral signedness+demotion BackupRestore::conversions
+template void * BackupRestore::convert_integral<Hint16, Huint8>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint24, Huint8>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint24, Huint16>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint32, Huint8>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint32, Huint16>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint32, Huint24>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint64, Huint8>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint64, Huint16>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint64, Huint24>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Hint64, Huint32>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint16, Hint8>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint24, Hint8>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint24, Hint16>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint32, Hint8>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint32, Hint16>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint32, Hint24>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint64, Hint8>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint64, Hint16>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint64, Hint24>(const void *, void *, bool &);
+template void * BackupRestore::convert_integral<Huint64, Hint32>(const void *, void *, bool &);
=== modified file 'storage/ndb/tools/restore/consumer_restore.hpp'
--- a/storage/ndb/tools/restore/consumer_restore.hpp 2011-02-01 23:27:25 +0000
+++ b/storage/ndb/tools/restore/consumer_restore.hpp 2011-02-19 03:13:04 +0000
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
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
@@ -138,227 +138,20 @@ public:
static AttrConvType check_compat_lossy(const NDBCOL &old_col,
const NDBCOL &new_col);
- // integral attribute promotion conversions
- static void* convert_int8_int16(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int8_int24(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int8_int32(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int8_int64(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int16_int24(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int16_int32(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int16_int64(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int24_int32(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int24_int64(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int32_int64(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint8_uint16(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint8_uint24(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint8_uint32(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint8_uint64(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint16_uint24(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint16_uint32(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint16_uint64(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint24_uint32(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint24_uint64(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint32_uint64(const void *old_data,
- void *parameter, bool &truncated);
-
- // integral attribute demotion conversions
- static void* convert_int16_int8(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int24_int8(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int24_int16(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int32_int8(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int32_int16(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int32_int24(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int64_int8(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int64_int16(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int64_int24(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int64_int32(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint16_uint8(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint24_uint8(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint24_uint16(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint32_uint8(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint32_uint16(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint32_uint24(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint64_uint8(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint64_uint16(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint64_uint24(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint64_uint32(const void *old_data,
- void *parameter, bool &truncated);
-
- // integral attribute signedness conversions
- static void* convert_int8_uint8(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int16_uint16(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int24_uint24(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int32_uint32(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int64_uint64(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint8_int8(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint16_int16(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint24_int24(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint32_int32(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint64_int64(const void *old_data,
- void *parameter, bool &truncated);
-
- // integral attribute signedness+promotion conversions
- static void* convert_int8_uint16(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int8_uint24(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int8_uint32(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int8_uint64(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int16_uint24(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int16_uint32(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int16_uint64(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int24_uint32(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int24_uint64(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int32_uint64(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint8_int16(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint8_int24(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint8_int32(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint8_int64(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint16_int24(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint16_int32(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint16_int64(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint24_int32(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint24_int64(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint32_int64(const void *old_data,
- void *parameter, bool &truncated);
-
- // integral attribute signedness+demotion conversions
- static void* convert_int16_uint8(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int24_uint8(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int24_uint16(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int32_uint8(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int32_uint16(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int32_uint24(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int64_uint8(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int64_uint16(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int64_uint24(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_int64_uint32(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint16_int8(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint24_int8(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint24_int16(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint32_int8(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint32_int16(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint32_int24(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint64_int8(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint64_int16(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint64_int24(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_uint64_int32(const void *old_data,
- void *parameter, bool &truncated);
-
- // char/binary promotion/demotion conversions
- static void* convert_bit_bit(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_char_char(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_binary_binary(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_char_varchar(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_varchar_char(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_char_longvarchar(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_longvarchar_char(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_binary_varbinary(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_varbinary_binary(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_binary_longvarbinary(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_longvarbinary_binary(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_var_var(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_var_longvar(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_longvar_var(const void *old_data,
- void *parameter, bool &truncated);
- static void* convert_longvar_longvar(const void *old_data,
- void *parameter, bool &truncated);
+ // bitset conversion handler
+ static void*
+ convert_bitset(const void * source, void * target, bool &truncated);
+
+ // char/binary array conversion handler
+ template< typename S, typename T >
+ static void *
+ convert_array(const void * source, void * target, bool & truncated);
+
+ // integral type conversion handler
+ // (follows MySQL replication semantics truncating to nearest legal value)
+ template< typename T, typename S >
+ static void *
+ convert_integral(const void * source, void * target, bool & truncated);
// returns the handler function checking type conversion compatibility
AttrCheckCompatFunc
No bundle (reason: revision is a merge (you can force generation of a bundle with env var BZR_FORCE_BUNDLE=1)).| Thread |
|---|
| • bzr commit into mysql-5.5-telco-7.0 branch (magnus.blaudd:3216) | Magnus Blåudd | 21 Feb |