Commit 7e3d8d61 authored by unknown's avatar unknown

Merge pnousiainen@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb

into mysql.com:/export/space/pekka/ndb/version/my50-dt

parents 5233b3c0 07ed3805
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/common.mk.am
ndbinclude_HEADERS = \ ndbinclude_HEADERS = \
ndb_constants.h \
ndb_types.h \ ndb_types.h \
ndb_version.h ndb_version.h
......
...@@ -28,7 +28,6 @@ private: ...@@ -28,7 +28,6 @@ private:
static void setType(Uint32 &, Uint32 type); static void setType(Uint32 &, Uint32 type);
static void setSize(Uint32 &, Uint32 size); static void setSize(Uint32 &, Uint32 size);
static void setArray(Uint32 &, Uint32 arraySize); static void setArray(Uint32 &, Uint32 arraySize);
static void setOriginal(Uint32 &, Uint32 original);
static void setNullable(Uint32 &, Uint32 nullable); static void setNullable(Uint32 &, Uint32 nullable);
static void setDKey(Uint32 &, Uint32 dkey); static void setDKey(Uint32 &, Uint32 dkey);
static void setPrimaryKey(Uint32 &, Uint32 dkey); static void setPrimaryKey(Uint32 &, Uint32 dkey);
...@@ -40,7 +39,6 @@ private: ...@@ -40,7 +39,6 @@ private:
static Uint32 getSizeInWords(const Uint32 &); static Uint32 getSizeInWords(const Uint32 &);
static Uint32 getArrayType(const Uint32 &); static Uint32 getArrayType(const Uint32 &);
static Uint32 getArraySize(const Uint32 &); static Uint32 getArraySize(const Uint32 &);
static Uint32 getOriginal(const Uint32 &);
static Uint32 getNullable(const Uint32 &); static Uint32 getNullable(const Uint32 &);
static Uint32 getDKey(const Uint32 &); static Uint32 getDKey(const Uint32 &);
static Uint32 getPrimaryKey(const Uint32 &); static Uint32 getPrimaryKey(const Uint32 &);
...@@ -50,19 +48,19 @@ private: ...@@ -50,19 +48,19 @@ private:
/** /**
* *
* a = Array type - 2 Bits -> Max 3 (Bit 0-1) * a = Array type - 2 Bits -> Max 3 (Bit 0-1)
* t = Attribute type - 2 Bits -> Max 3 (Bit 2-3) * t = Attribute type - 5 Bits -> Max 31 (Bit 2-6)
* s = Attribute size - 3 Bits -> Max 7 (Bit 4-6) * s = Attribute size - 3 Bits -> Max 7 (Bit 8-10)
* o = Original attribute - 1 Bit 7 * d = Disk based - 1 Bit 11
* n = Nullable - 1 Bit 8 * n = Nullable - 1 Bit 12
* d = Disk based - 1 Bit 10 * k = Distribution Key Ind - 1 Bit 13
* k = Distribution Key Ind - 1 Bit 12
* p = Primary key attribute - 1 Bit 14 * p = Primary key attribute - 1 Bit 14
* y = Dynamic attribute - 1 Bit 15 * y = Dynamic attribute - 1 Bit 15
* z = Array size - 16 Bits -> Max 65535 (Bit 16-31) * z = Array size - 16 Bits -> Max 65535 (Bit 16-31)
* *
* 1111111111222222222233 * 1111111111222222222233
* 01234567890123456789012345678901 * 01234567890123456789012345678901
* aattsss n d k pyzzzzzzzzzzzzzzzz * aattttt sssdnkpyzzzzzzzzzzzzzzzz
* aattsss n d k pyzzzzzzzzzzzzzzzz [ old format ]
* *
*/ */
...@@ -70,20 +68,17 @@ private: ...@@ -70,20 +68,17 @@ private:
#define AD_ARRAY_TYPE_MASK (3) #define AD_ARRAY_TYPE_MASK (3)
#define AD_TYPE_SHIFT (2) #define AD_TYPE_SHIFT (2)
#define AD_TYPE_MASK (3) #define AD_TYPE_MASK (31)
#define AD_SIZE_SHIFT (4) #define AD_SIZE_SHIFT (8)
#define AD_SIZE_MASK (7) #define AD_SIZE_MASK (7)
#define AD_SIZE_IN_BYTES_SHIFT (3) #define AD_SIZE_IN_BYTES_SHIFT (3)
#define AD_SIZE_IN_WORDS_OFFSET (31) #define AD_SIZE_IN_WORDS_OFFSET (31)
#define AD_SIZE_IN_WORDS_SHIFT (5) #define AD_SIZE_IN_WORDS_SHIFT (5)
#define AD_ORIGINAL_SHIFT (8) #define AD_NULLABLE_SHIFT (12)
#define AD_NULLABLE_SHIFT (8) #define AD_DISTR_KEY_SHIFT (13)
#define AD_DISTR_KEY_SHIFT (12)
#define AD_PRIMARY_KEY (14) #define AD_PRIMARY_KEY (14)
#define AD_DYNAMIC (15) #define AD_DYNAMIC (15)
...@@ -123,13 +118,6 @@ AttributeDescriptor::setNullable(Uint32 & desc, Uint32 nullable){ ...@@ -123,13 +118,6 @@ AttributeDescriptor::setNullable(Uint32 & desc, Uint32 nullable){
desc |= (nullable << AD_NULLABLE_SHIFT); desc |= (nullable << AD_NULLABLE_SHIFT);
} }
inline
void
AttributeDescriptor::setOriginal(Uint32 & desc, Uint32 original){
ASSERT_BOOL(original, "AttributeDescriptor::setOriginal");
desc |= (original << AD_ORIGINAL_SHIFT);
}
inline inline
void void
AttributeDescriptor::setDKey(Uint32 & desc, Uint32 dkey){ AttributeDescriptor::setDKey(Uint32 & desc, Uint32 dkey){
...@@ -199,12 +187,6 @@ AttributeDescriptor::getNullable(const Uint32 & desc){ ...@@ -199,12 +187,6 @@ AttributeDescriptor::getNullable(const Uint32 & desc){
return (desc >> AD_NULLABLE_SHIFT) & 1; return (desc >> AD_NULLABLE_SHIFT) & 1;
} }
inline
Uint32
AttributeDescriptor::getOriginal(const Uint32 & desc){
return (desc >> AD_ORIGINAL_SHIFT) & 1;
}
inline inline
Uint32 Uint32
AttributeDescriptor::getDKey(const Uint32 & desc){ AttributeDescriptor::getDKey(const Uint32 & desc){
......
...@@ -100,14 +100,14 @@ public: ...@@ -100,14 +100,14 @@ public:
AttributeName = 1000, // String, Mandatory AttributeName = 1000, // String, Mandatory
AttributeId = 1001, //Mandatory between DICT's otherwise not allowed AttributeId = 1001, //Mandatory between DICT's otherwise not allowed
AttributeType = 1002, //Default UnSignedType AttributeType = 1002, //for osu 4.1->5.0.x
AttributeSize = 1003, //Default DictTabInfo::a32Bit AttributeSize = 1003, //Default DictTabInfo::a32Bit
AttributeArraySize = 1005, //Default 1 AttributeArraySize = 1005, //Default 1
AttributeKeyFlag = 1006, //Default noKey AttributeKeyFlag = 1006, //Default noKey
AttributeStorage = 1007, //Default MainMemory AttributeStorage = 1007, //Default MainMemory
AttributeNullableFlag = 1008, //Default NotNullable AttributeNullableFlag = 1008, //Default NotNullable
AttributeDKey = 1010, //Default NotDKey AttributeDKey = 1010, //Default NotDKey
AttributeExtType = 1013, //Default 0 (undefined) AttributeExtType = 1013, //Default ExtUnsigned
AttributeExtPrecision = 1014, //Default 0 AttributeExtPrecision = 1014, //Default 0
AttributeExtScale = 1015, //Default 0 AttributeExtScale = 1015, //Default 0
AttributeExtLength = 1016, //Default 0 AttributeExtLength = 1016, //Default 0
...@@ -201,12 +201,6 @@ public: ...@@ -201,12 +201,6 @@ public:
StorePermanent = 2 StorePermanent = 2
}; };
// AttributeType constants
STATIC_CONST( SignedType = 0 );
STATIC_CONST( UnSignedType = 1 );
STATIC_CONST( FloatingPointType = 2 );
STATIC_CONST( StringType = 3 );
// AttributeSize constants // AttributeSize constants
STATIC_CONST( aBit = 0 ); STATIC_CONST( aBit = 0 );
STATIC_CONST( an8Bit = 3 ); STATIC_CONST( an8Bit = 3 );
...@@ -282,7 +276,7 @@ public: ...@@ -282,7 +276,7 @@ public:
struct Attribute { struct Attribute {
char AttributeName[MAX_TAB_NAME_SIZE]; char AttributeName[MAX_TAB_NAME_SIZE];
Uint32 AttributeId; Uint32 AttributeId;
Uint32 AttributeType; Uint32 AttributeType; // for osu 4.1->5.0.x
Uint32 AttributeSize; Uint32 AttributeSize;
Uint32 AttributeArraySize; Uint32 AttributeArraySize;
Uint32 AttributeKeyFlag; Uint32 AttributeKeyFlag;
...@@ -306,66 +300,55 @@ public: ...@@ -306,66 +300,55 @@ public:
// translate to old kernel types and sizes // translate to old kernel types and sizes
inline bool inline bool
translateExtType() { translateExtType() {
AttributeType = ~0; // deprecated
switch (AttributeExtType) { switch (AttributeExtType) {
case DictTabInfo::ExtUndefined: case DictTabInfo::ExtUndefined:
break; break;
case DictTabInfo::ExtTinyint: case DictTabInfo::ExtTinyint:
AttributeType = DictTabInfo::SignedType;
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; return true;
case DictTabInfo::ExtTinyunsigned: case DictTabInfo::ExtTinyunsigned:
AttributeType = DictTabInfo::UnSignedType;
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; return true;
case DictTabInfo::ExtSmallint: case DictTabInfo::ExtSmallint:
AttributeType = DictTabInfo::SignedType;
AttributeSize = DictTabInfo::a16Bit; AttributeSize = DictTabInfo::a16Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; return true;
case DictTabInfo::ExtSmallunsigned: case DictTabInfo::ExtSmallunsigned:
AttributeType = DictTabInfo::UnSignedType;
AttributeSize = DictTabInfo::a16Bit; AttributeSize = DictTabInfo::a16Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; return true;
case DictTabInfo::ExtMediumint: case DictTabInfo::ExtMediumint:
AttributeType = DictTabInfo::SignedType;
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = 3 * AttributeExtLength; AttributeArraySize = 3 * AttributeExtLength;
return true; return true;
case DictTabInfo::ExtMediumunsigned: case DictTabInfo::ExtMediumunsigned:
AttributeType = DictTabInfo::UnSignedType;
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = 3 * AttributeExtLength; AttributeArraySize = 3 * AttributeExtLength;
return true; return true;
case DictTabInfo::ExtInt: case DictTabInfo::ExtInt:
AttributeType = DictTabInfo::SignedType;
AttributeSize = DictTabInfo::a32Bit; AttributeSize = DictTabInfo::a32Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; return true;
case DictTabInfo::ExtUnsigned: case DictTabInfo::ExtUnsigned:
AttributeType = DictTabInfo::UnSignedType;
AttributeSize = DictTabInfo::a32Bit; AttributeSize = DictTabInfo::a32Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; return true;
case DictTabInfo::ExtBigint: case DictTabInfo::ExtBigint:
AttributeType = DictTabInfo::SignedType;
AttributeSize = DictTabInfo::a64Bit; AttributeSize = DictTabInfo::a64Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; return true;
case DictTabInfo::ExtBigunsigned: case DictTabInfo::ExtBigunsigned:
AttributeType = DictTabInfo::UnSignedType;
AttributeSize = DictTabInfo::a64Bit; AttributeSize = DictTabInfo::a64Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; return true;
case DictTabInfo::ExtFloat: case DictTabInfo::ExtFloat:
AttributeType = DictTabInfo::FloatingPointType;
AttributeSize = DictTabInfo::a32Bit; AttributeSize = DictTabInfo::a32Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; return true;
case DictTabInfo::ExtDouble: case DictTabInfo::ExtDouble:
AttributeType = DictTabInfo::FloatingPointType;
AttributeSize = DictTabInfo::a64Bit; AttributeSize = DictTabInfo::a64Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; return true;
...@@ -374,35 +357,32 @@ public: ...@@ -374,35 +357,32 @@ public:
break; break;
case DictTabInfo::ExtChar: case DictTabInfo::ExtChar:
case DictTabInfo::ExtBinary: case DictTabInfo::ExtBinary:
AttributeType = DictTabInfo::StringType;
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; return true;
case DictTabInfo::ExtVarchar: case DictTabInfo::ExtVarchar:
case DictTabInfo::ExtVarbinary: case DictTabInfo::ExtVarbinary:
AttributeType = DictTabInfo::StringType; // to fix
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = AttributeExtLength + 2; AttributeArraySize = AttributeExtLength + 2;
return true; return true;
case DictTabInfo::ExtDatetime: case DictTabInfo::ExtDatetime:
AttributeType = DictTabInfo::StringType; // to fix
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = 8 * AttributeExtLength; AttributeArraySize = 8 * AttributeExtLength;
return true; return true;
case DictTabInfo::ExtTimespec: case DictTabInfo::ExtTimespec:
AttributeType = DictTabInfo::StringType; // to fix
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = 12 * AttributeExtLength; AttributeArraySize = 12 * AttributeExtLength;
return true; return true;
case DictTabInfo::ExtBlob: case DictTabInfo::ExtBlob:
case DictTabInfo::ExtText: case DictTabInfo::ExtText:
AttributeType = DictTabInfo::StringType;
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
// head + inline part [ attr precision lower half ] // head + inline part [ attr precision lower half ]
AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + (AttributeExtPrecision & 0xFFFF); AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + (AttributeExtPrecision & 0xFFFF);
return true; return true;
case DictTabInfo::ExtBit: case DictTabInfo::ExtBit:
AttributeType = DictTabInfo::UnSignedType;
AttributeSize = DictTabInfo::aBit; AttributeSize = DictTabInfo::aBit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
return true; return true;
......
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/**
* @file ndb_constants.h
*
* Constants common to NDB API and NDB kernel.
* Changing the values makes database upgrade impossible.
*
* New or removed definitions must be replicated to
* NdbDictionary.hpp and NdbSqlUtil.cpp.
*
* Not for use by application programs.
* Use the enums provided by NdbDictionary instead.
*/
#ifndef NDB_CONSTANTS_H
#define NDB_CONSTANTS_H
/*
* Data type constants.
*/
#define NDB_TYPE_UNDEFINED 0
#define NDB_TYPE_TINYINT 1
#define NDB_TYPE_TINYUNSIGNED 2
#define NDB_TYPE_SMALLINT 3
#define NDB_TYPE_SMALLUNSIGNED 4
#define NDB_TYPE_MEDIUMINT 5
#define NDB_TYPE_MEDIUMUNSIGNED 6
#define NDB_TYPE_INT 7
#define NDB_TYPE_UNSIGNED 8
#define NDB_TYPE_BIGINT 9
#define NDB_TYPE_BIGUNSIGNED 10
#define NDB_TYPE_FLOAT 11
#define NDB_TYPE_DOUBLE 12
#define NDB_TYPE_DECIMAL 13 // not used
#define NDB_TYPE_CHAR 14
#define NDB_TYPE_VARCHAR 15
#define NDB_TYPE_BINARY 16
#define NDB_TYPE_VARBINARY 17
#define NDB_TYPE_DATETIME 18 // need to fix
#define NDB_TYPE_TIMESPEC 19 // need to fix
#define NDB_TYPE_BLOB 20
#define NDB_TYPE_TEXT 21
#define NDB_TYPE_BIT 22
#define NDB_TYPE_MAX 23
#endif
...@@ -56,5 +56,6 @@ typedef unsigned long long Uint64; ...@@ -56,5 +56,6 @@ typedef unsigned long long Uint64;
typedef signed long long Int64; typedef signed long long Int64;
#endif #endif
#include "ndb_constants.h"
#endif #endif
...@@ -164,29 +164,29 @@ public: ...@@ -164,29 +164,29 @@ public:
* The builtin column types * The builtin column types
*/ */
enum Type { enum Type {
Undefined=0, ///< Undefined Undefined = NDB_TYPE_UNDEFINED, ///< Undefined
Tinyint, ///< 8 bit. 1 byte signed integer, can be used in array Tinyint = NDB_TYPE_TINYINT, ///< 8 bit. 1 byte signed integer, can be used in array
Tinyunsigned, ///< 8 bit. 1 byte unsigned integer, can be used in array Tinyunsigned = NDB_TYPE_TINYUNSIGNED, ///< 8 bit. 1 byte unsigned integer, can be used in array
Smallint, ///< 16 bit. 2 byte signed integer, can be used in array Smallint = NDB_TYPE_SMALLINT, ///< 16 bit. 2 byte signed integer, can be used in array
Smallunsigned, ///< 16 bit. 2 byte unsigned integer, can be used in array Smallunsigned = NDB_TYPE_SMALLUNSIGNED, ///< 16 bit. 2 byte unsigned integer, can be used in array
Mediumint, ///< 24 bit. 3 byte signed integer, can be used in array Mediumint = NDB_TYPE_MEDIUMINT, ///< 24 bit. 3 byte signed integer, can be used in array
Mediumunsigned,///< 24 bit. 3 byte unsigned integer, can be used in array Mediumunsigned = NDB_TYPE_MEDIUMUNSIGNED,///< 24 bit. 3 byte unsigned integer, can be used in array
Int, ///< 32 bit. 4 byte signed integer, can be used in array Int = NDB_TYPE_INT, ///< 32 bit. 4 byte signed integer, can be used in array
Unsigned, ///< 32 bit. 4 byte unsigned integer, can be used in array Unsigned = NDB_TYPE_UNSIGNED, ///< 32 bit. 4 byte unsigned integer, can be used in array
Bigint, ///< 64 bit. 8 byte signed integer, can be used in array Bigint = NDB_TYPE_BIGINT, ///< 64 bit. 8 byte signed integer, can be used in array
Bigunsigned, ///< 64 Bit. 8 byte signed integer, can be used in array Bigunsigned = NDB_TYPE_BIGUNSIGNED, ///< 64 Bit. 8 byte signed integer, can be used in array
Float, ///< 32-bit float. 4 bytes float, can be used in array Float = NDB_TYPE_FLOAT, ///< 32-bit float. 4 bytes float, can be used in array
Double, ///< 64-bit float. 8 byte float, can be used in array Double = NDB_TYPE_DOUBLE, ///< 64-bit float. 8 byte float, can be used in array
Decimal, ///< Precision, Scale are applicable Decimal = NDB_TYPE_DECIMAL, ///< Precision, Scale are applicable
Char, ///< Len. A fixed array of 1-byte chars Char = NDB_TYPE_CHAR, ///< Len. A fixed array of 1-byte chars
Varchar, ///< Max len Varchar = NDB_TYPE_VARCHAR, ///< Max len
Binary, ///< Len Binary = NDB_TYPE_BINARY, ///< Len
Varbinary, ///< Max len Varbinary = NDB_TYPE_VARBINARY, ///< Max len
Datetime, ///< Precision down to 1 sec (sizeof(Datetime) == 8 bytes ) Datetime = NDB_TYPE_DATETIME, ///< Precision down to 1 sec (sizeof(Datetime) == 8 bytes )
Timespec, ///< Precision down to 1 nsec(sizeof(Datetime) == 12 bytes ) Timespec = NDB_TYPE_TIMESPEC, ///< Precision down to 1 nsec(sizeof(Datetime) == 12 bytes )
Blob, ///< Binary large object (see NdbBlob) Blob = NDB_TYPE_BLOB, ///< Binary large object (see NdbBlob)
Text, ///< Text blob, Text = NDB_TYPE_TEXT, ///< Text blob,
Bit ///< Bit, length specifies no of bits Bit = NDB_TYPE_BIT ///< Bit, length specifies no of bits
}; };
/** /**
......
...@@ -62,35 +62,31 @@ public: ...@@ -62,35 +62,31 @@ public:
CmpUnknown = 2 // insufficient partial data CmpUnknown = 2 // insufficient partial data
}; };
/**
* Kernel data types. Must match m_typeList in NdbSqlUtil.cpp.
* Now also must match types in NdbDictionary.
*/
struct Type { struct Type {
enum Enum { enum Enum {
Undefined = 0, // Undefined Undefined = NDB_TYPE_UNDEFINED,
Tinyint, // 8 bit Tinyint = NDB_TYPE_TINYINT,
Tinyunsigned, // 8 bit Tinyunsigned = NDB_TYPE_TINYUNSIGNED,
Smallint, // 16 bit Smallint = NDB_TYPE_SMALLINT,
Smallunsigned, // 16 bit Smallunsigned = NDB_TYPE_SMALLUNSIGNED,
Mediumint, // 24 bit Mediumint = NDB_TYPE_MEDIUMINT,
Mediumunsigned, // 24 bit Mediumunsigned = NDB_TYPE_MEDIUMUNSIGNED,
Int, // 32 bit Int = NDB_TYPE_INT,
Unsigned, // 32 bit Unsigned = NDB_TYPE_UNSIGNED,
Bigint, // 64 bit Bigint = NDB_TYPE_BIGINT,
Bigunsigned, // 64 Bit Bigunsigned = NDB_TYPE_BIGUNSIGNED,
Float, // 32-bit float Float = NDB_TYPE_FLOAT,
Double, // 64-bit float Double = NDB_TYPE_DOUBLE,
Decimal, // Precision, Scale Decimal = NDB_TYPE_DECIMAL,
Char, // Len Char = NDB_TYPE_CHAR,
Varchar, // Max len Varchar = NDB_TYPE_VARCHAR,
Binary, // Len Binary = NDB_TYPE_BINARY,
Varbinary, // Max len Varbinary = NDB_TYPE_VARBINARY,
Datetime, // Precision down to 1 sec (size 8 bytes) Datetime = NDB_TYPE_DATETIME,
Timespec, // Precision down to 1 nsec (size 12 bytes) Timespec = NDB_TYPE_TIMESPEC,
Blob, // Blob Blob = NDB_TYPE_BLOB,
Text, // Text blob, Text = NDB_TYPE_TEXT,
Bit // A bit Bit = NDB_TYPE_BIT
}; };
Enum m_typeId; Enum m_typeId;
Cmp* m_cmp; // comparison method Cmp* m_cmp; // comparison method
......
...@@ -59,7 +59,7 @@ SimpleProperties::SP2StructMapping ...@@ -59,7 +59,7 @@ SimpleProperties::SP2StructMapping
DictTabInfo::AttributeMapping[] = { DictTabInfo::AttributeMapping[] = {
DTIMAPS(Attribute, AttributeName, AttributeName, 0, MAX_ATTR_NAME_SIZE), DTIMAPS(Attribute, AttributeName, AttributeName, 0, MAX_ATTR_NAME_SIZE),
DTIMAP(Attribute, AttributeId, AttributeId), DTIMAP(Attribute, AttributeId, AttributeId),
DTIMAP2(Attribute, AttributeType, AttributeType, 0, 3), DTIMAP(Attribute, AttributeType, AttributeType),
DTIMAP2(Attribute, AttributeSize, AttributeSize, 3, 7), DTIMAP2(Attribute, AttributeSize, AttributeSize, 3, 7),
DTIMAP2(Attribute, AttributeArraySize, AttributeArraySize, 0, 65535), DTIMAP2(Attribute, AttributeArraySize, AttributeArraySize, 0, 65535),
DTIMAP2(Attribute, AttributeKeyFlag, AttributeKeyFlag, 0, 1), DTIMAP2(Attribute, AttributeKeyFlag, AttributeKeyFlag, 0, 1),
...@@ -126,13 +126,13 @@ void ...@@ -126,13 +126,13 @@ void
DictTabInfo::Attribute::init(){ DictTabInfo::Attribute::init(){
memset(AttributeName, 0, sizeof(AttributeName));//AttributeName[0] = 0; memset(AttributeName, 0, sizeof(AttributeName));//AttributeName[0] = 0;
AttributeId = 0; AttributeId = 0;
AttributeType = DictTabInfo::UnSignedType; AttributeType = ~0, // deprecated
AttributeSize = DictTabInfo::a32Bit; AttributeSize = DictTabInfo::a32Bit;
AttributeArraySize = 1; AttributeArraySize = 1;
AttributeKeyFlag = 0; AttributeKeyFlag = 0;
AttributeNullableFlag = 0; AttributeNullableFlag = 0;
AttributeDKey = 0; AttributeDKey = 0;
AttributeExtType = 0, AttributeExtType = DictTabInfo::ExtUnsigned,
AttributeExtPrecision = 0, AttributeExtPrecision = 0,
AttributeExtScale = 0, AttributeExtScale = 0,
AttributeExtLength = 0, AttributeExtLength = 0,
......
...@@ -290,12 +290,12 @@ Dbdict::packTableIntoPagesImpl(SimpleProperties::Writer & w, ...@@ -290,12 +290,12 @@ Dbdict::packTableIntoPagesImpl(SimpleProperties::Writer & w,
const Uint32 nullable = AttributeDescriptor::getNullable(desc); const Uint32 nullable = AttributeDescriptor::getNullable(desc);
const Uint32 DKey = AttributeDescriptor::getDKey(desc); const Uint32 DKey = AttributeDescriptor::getDKey(desc);
w.add(DictTabInfo::AttributeType, attrType); // AttributeType deprecated
w.add(DictTabInfo::AttributeSize, attrSize); w.add(DictTabInfo::AttributeSize, attrSize);
w.add(DictTabInfo::AttributeArraySize, arraySize); w.add(DictTabInfo::AttributeArraySize, arraySize);
w.add(DictTabInfo::AttributeNullableFlag, nullable); w.add(DictTabInfo::AttributeNullableFlag, nullable);
w.add(DictTabInfo::AttributeDKey, DKey); w.add(DictTabInfo::AttributeDKey, DKey);
w.add(DictTabInfo::AttributeExtType, attrPtr.p->extType); w.add(DictTabInfo::AttributeExtType, attrType);
w.add(DictTabInfo::AttributeExtPrecision, attrPtr.p->extPrecision); w.add(DictTabInfo::AttributeExtPrecision, attrPtr.p->extPrecision);
w.add(DictTabInfo::AttributeExtScale, attrPtr.p->extScale); w.add(DictTabInfo::AttributeExtScale, attrPtr.p->extScale);
w.add(DictTabInfo::AttributeExtLength, attrPtr.p->extLength); w.add(DictTabInfo::AttributeExtLength, attrPtr.p->extLength);
...@@ -4169,7 +4169,7 @@ Dbdict::sendLQHADDATTRREQ(Signal* signal, ...@@ -4169,7 +4169,7 @@ Dbdict::sendLQHADDATTRREQ(Signal* signal,
LqhAddAttrReq::Entry& entry = req->attributes[i]; LqhAddAttrReq::Entry& entry = req->attributes[i];
entry.attrId = attrPtr.p->attributeId; entry.attrId = attrPtr.p->attributeId;
entry.attrDescriptor = attrPtr.p->attributeDescriptor; entry.attrDescriptor = attrPtr.p->attributeDescriptor;
entry.extTypeInfo = attrPtr.p->extType; entry.extTypeInfo = 0;
// charset number passed to TUP, TUX in upper half // charset number passed to TUP, TUX in upper half
entry.extTypeInfo |= (attrPtr.p->extPrecision & ~0xFFFF); entry.extTypeInfo |= (attrPtr.p->extPrecision & ~0xFFFF);
if (tabPtr.p->isIndex()) { if (tabPtr.p->isIndex()) {
...@@ -4792,7 +4792,6 @@ void Dbdict::handleTabInfo(SimpleProperties::Reader & it, ...@@ -4792,7 +4792,6 @@ void Dbdict::handleTabInfo(SimpleProperties::Reader & it,
attrPtr.p->attributeId = attrDesc.AttributeId; attrPtr.p->attributeId = attrDesc.AttributeId;
attrPtr.p->tupleKey = (keyCount + 1) * attrDesc.AttributeKeyFlag; attrPtr.p->tupleKey = (keyCount + 1) * attrDesc.AttributeKeyFlag;
attrPtr.p->extType = attrDesc.AttributeExtType;
attrPtr.p->extPrecision = attrDesc.AttributeExtPrecision; attrPtr.p->extPrecision = attrDesc.AttributeExtPrecision;
attrPtr.p->extScale = attrDesc.AttributeExtScale; attrPtr.p->extScale = attrDesc.AttributeExtScale;
attrPtr.p->extLength = attrDesc.AttributeExtLength; attrPtr.p->extLength = attrDesc.AttributeExtLength;
...@@ -4843,7 +4842,7 @@ void Dbdict::handleTabInfo(SimpleProperties::Reader & it, ...@@ -4843,7 +4842,7 @@ void Dbdict::handleTabInfo(SimpleProperties::Reader & it,
} }
Uint32 desc = 0; Uint32 desc = 0;
AttributeDescriptor::setType(desc, attrDesc.AttributeType); AttributeDescriptor::setType(desc, attrDesc.AttributeExtType);
AttributeDescriptor::setSize(desc, attrDesc.AttributeSize); AttributeDescriptor::setSize(desc, attrDesc.AttributeSize);
AttributeDescriptor::setArray(desc, attrDesc.AttributeArraySize); AttributeDescriptor::setArray(desc, attrDesc.AttributeArraySize);
AttributeDescriptor::setNullable(desc, attrDesc.AttributeNullableFlag); AttributeDescriptor::setNullable(desc, attrDesc.AttributeNullableFlag);
...@@ -6406,6 +6405,7 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr) ...@@ -6406,6 +6405,7 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr)
jam(); jam();
const Uint32 a = aRec->attributeDescriptor; const Uint32 a = aRec->attributeDescriptor;
bool isNullable = AttributeDescriptor::getNullable(a); bool isNullable = AttributeDescriptor::getNullable(a);
Uint32 attrType = AttributeDescriptor::getType(a);
w.add(DictTabInfo::AttributeName, aRec->attributeName); w.add(DictTabInfo::AttributeName, aRec->attributeName);
w.add(DictTabInfo::AttributeId, k); w.add(DictTabInfo::AttributeId, k);
if (indexPtr.p->isHashIndex()) { if (indexPtr.p->isHashIndex()) {
...@@ -6416,8 +6416,7 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr) ...@@ -6416,8 +6416,7 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr)
w.add(DictTabInfo::AttributeKeyFlag, (Uint32)false); w.add(DictTabInfo::AttributeKeyFlag, (Uint32)false);
w.add(DictTabInfo::AttributeNullableFlag, (Uint32)isNullable); w.add(DictTabInfo::AttributeNullableFlag, (Uint32)isNullable);
} }
// ext type overrides w.add(DictTabInfo::AttributeExtType, attrType);
w.add(DictTabInfo::AttributeExtType, aRec->extType);
w.add(DictTabInfo::AttributeExtPrecision, aRec->extPrecision); w.add(DictTabInfo::AttributeExtPrecision, aRec->extPrecision);
w.add(DictTabInfo::AttributeExtScale, aRec->extScale); w.add(DictTabInfo::AttributeExtScale, aRec->extScale);
w.add(DictTabInfo::AttributeExtLength, aRec->extLength); w.add(DictTabInfo::AttributeExtLength, aRec->extLength);
...@@ -6431,7 +6430,6 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr) ...@@ -6431,7 +6430,6 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr)
w.add(DictTabInfo::AttributeId, opPtr.p->m_attrList.sz); w.add(DictTabInfo::AttributeId, opPtr.p->m_attrList.sz);
w.add(DictTabInfo::AttributeKeyFlag, (Uint32)false); w.add(DictTabInfo::AttributeKeyFlag, (Uint32)false);
w.add(DictTabInfo::AttributeNullableFlag, (Uint32)false); w.add(DictTabInfo::AttributeNullableFlag, (Uint32)false);
// ext type overrides
w.add(DictTabInfo::AttributeExtType, (Uint32)DictTabInfo::ExtUnsigned); w.add(DictTabInfo::AttributeExtType, (Uint32)DictTabInfo::ExtUnsigned);
w.add(DictTabInfo::AttributeExtLength, tablePtr.p->tupKeyLength); w.add(DictTabInfo::AttributeExtLength, tablePtr.p->tupKeyLength);
w.add(DictTabInfo::AttributeEnd, (Uint32)true); w.add(DictTabInfo::AttributeEnd, (Uint32)true);
...@@ -6443,7 +6441,6 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr) ...@@ -6443,7 +6441,6 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr)
w.add(DictTabInfo::AttributeId, opPtr.p->m_attrList.sz); w.add(DictTabInfo::AttributeId, opPtr.p->m_attrList.sz);
w.add(DictTabInfo::AttributeKeyFlag, (Uint32)true); w.add(DictTabInfo::AttributeKeyFlag, (Uint32)true);
w.add(DictTabInfo::AttributeNullableFlag, (Uint32)false); w.add(DictTabInfo::AttributeNullableFlag, (Uint32)false);
// ext type overrides
w.add(DictTabInfo::AttributeExtType, (Uint32)DictTabInfo::ExtUnsigned); w.add(DictTabInfo::AttributeExtType, (Uint32)DictTabInfo::ExtUnsigned);
w.add(DictTabInfo::AttributeExtLength, indexPtr.p->tupKeyLength); w.add(DictTabInfo::AttributeExtLength, indexPtr.p->tupKeyLength);
w.add(DictTabInfo::AttributeEnd, (Uint32)true); w.add(DictTabInfo::AttributeEnd, (Uint32)true);
......
...@@ -1540,13 +1540,8 @@ int Dbtup::interpreterNextLab(Signal* signal, ...@@ -1540,13 +1540,8 @@ int Dbtup::interpreterNextLab(Signal* signal,
// Calculate the number of words of this attribute. // Calculate the number of words of this attribute.
// We allow writes into arrays as long as they fit into the 64 bit // We allow writes into arrays as long as they fit into the 64 bit
// register size. // register size.
//TEST_MR See to that TattrNoOfWords can be
// read faster from attribute description.
/* --------------------------------------------------------------- */ /* --------------------------------------------------------------- */
Uint32 TarraySize = (TattrDesc1 >> 16); Uint32 TattrNoOfWords = AttributeDescriptor::getSizeInWords(TattrDesc1);
Uint32 TattrLogLen = (TattrDesc1 >> 4) & 0xf;
Uint32 TattrNoOfBits = TarraySize << TattrLogLen;
Uint32 TattrNoOfWords = (TattrNoOfBits + 31) >> 5;
Uint32 Toptype = operPtr.p->optype; Uint32 Toptype = operPtr.p->optype;
Uint32 TdataForUpdate[3]; Uint32 TdataForUpdate[3];
......
...@@ -288,8 +288,7 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* signal) ...@@ -288,8 +288,7 @@ void Dbtup::execTUP_ADD_ATTRREQ(Signal* signal)
ptrCheckGuard(fragOperPtr, cnoOfFragoprec, fragoperrec); ptrCheckGuard(fragOperPtr, cnoOfFragoprec, fragoperrec);
Uint32 attrId = signal->theData[2]; Uint32 attrId = signal->theData[2];
Uint32 attrDescriptor = signal->theData[3]; Uint32 attrDescriptor = signal->theData[3];
// DICT sends extended type (ignored) and charset number // DICT sends charset number in upper half
Uint32 extType = (signal->theData[4] & 0xFF);
Uint32 csNumber = (signal->theData[4] >> 16); Uint32 csNumber = (signal->theData[4] >> 16);
regTabPtr.i = fragOperPtr.p->tableidFrag; regTabPtr.i = fragOperPtr.p->tableidFrag;
......
...@@ -201,7 +201,7 @@ Dbtux::execTUX_ADD_ATTRREQ(Signal* signal) ...@@ -201,7 +201,7 @@ Dbtux::execTUX_ADD_ATTRREQ(Signal* signal)
DescAttr& descAttr = descEnt.m_descAttr[attrId]; DescAttr& descAttr = descEnt.m_descAttr[attrId];
descAttr.m_attrDesc = req->attrDescriptor; descAttr.m_attrDesc = req->attrDescriptor;
descAttr.m_primaryAttrId = req->primaryAttrId; descAttr.m_primaryAttrId = req->primaryAttrId;
descAttr.m_typeId = req->extTypeInfo & 0xFF; descAttr.m_typeId = AttributeDescriptor::getType(req->attrDescriptor);
descAttr.m_charset = (req->extTypeInfo >> 16); descAttr.m_charset = (req->extTypeInfo >> 16);
#ifdef VM_TRACE #ifdef VM_TRACE
if (debugFlags & DebugMeta) { if (debugFlags & DebugMeta) {
......
...@@ -1562,13 +1562,9 @@ void Ndbcntr::createSystableLab(Signal* signal, unsigned index) ...@@ -1562,13 +1562,9 @@ void Ndbcntr::createSystableLab(Signal* signal, unsigned index)
ndbassert(column.pos == i); ndbassert(column.pos == i);
w.add(DictTabInfo::AttributeName, column.name); w.add(DictTabInfo::AttributeName, column.name);
w.add(DictTabInfo::AttributeId, (Uint32)column.pos); w.add(DictTabInfo::AttributeId, (Uint32)column.pos);
//w.add(DictTabInfo::AttributeType, DictTabInfo::UnSignedType);
//w.add(DictTabInfo::AttributeSize, DictTabInfo::a32Bit);
//w.add(DictTabInfo::AttributeArraySize, 1);
w.add(DictTabInfo::AttributeKeyFlag, (Uint32)column.keyFlag); w.add(DictTabInfo::AttributeKeyFlag, (Uint32)column.keyFlag);
//w.add(DictTabInfo::AttributeStorage, (Uint32)DictTabInfo::MainMemory); //w.add(DictTabInfo::AttributeStorage, (Uint32)DictTabInfo::MainMemory);
w.add(DictTabInfo::AttributeNullableFlag, (Uint32)column.nullable); w.add(DictTabInfo::AttributeNullableFlag, (Uint32)column.nullable);
// ext type overrides
w.add(DictTabInfo::AttributeExtType, (Uint32)column.type); w.add(DictTabInfo::AttributeExtType, (Uint32)column.type);
w.add(DictTabInfo::AttributeExtLength, (Uint32)column.length); w.add(DictTabInfo::AttributeExtLength, (Uint32)column.length);
w.add(DictTabInfo::AttributeEnd, (Uint32)true); w.add(DictTabInfo::AttributeEnd, (Uint32)true);
......
...@@ -160,7 +160,6 @@ public: ...@@ -160,7 +160,6 @@ public:
Uint32 attributeDescriptor; Uint32 attributeDescriptor;
/* Extended attributes */ /* Extended attributes */
Uint32 extType;
Uint32 extPrecision; Uint32 extPrecision;
Uint32 extScale; Uint32 extScale;
Uint32 extLength; Uint32 extLength;
......
...@@ -912,7 +912,8 @@ Ndb::setTupleIdInNdb(Uint32 aTableId, Uint64 val, bool increase ) ...@@ -912,7 +912,8 @@ Ndb::setTupleIdInNdb(Uint32 aTableId, Uint64 val, bool increase )
Uint64 Uint64
Ndb::opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op) Ndb::opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op)
{ {
DEBUG_TRACE("opTupleIdOnNdb"); DBUG_ENTER("Ndb::opTupleIdOnNdb");
DBUG_PRINT("enter", ("table=%u value=%llu op=%u", aTableId, opValue, op));
NdbTransaction* tConnection; NdbTransaction* tConnection;
NdbOperation* tOperation; NdbOperation* tOperation;
...@@ -1008,7 +1009,7 @@ Ndb::opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op) ...@@ -1008,7 +1009,7 @@ Ndb::opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op)
setDatabaseName(currentDb.c_str()); setDatabaseName(currentDb.c_str());
setDatabaseSchemaName(currentSchema.c_str()); setDatabaseSchemaName(currentSchema.c_str());
return ret; DBUG_RETURN(ret);
error_handler: error_handler:
theError.code = tConnection->theError.code; theError.code = tConnection->theError.code;
...@@ -1018,7 +1019,11 @@ Ndb::opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op) ...@@ -1018,7 +1019,11 @@ Ndb::opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op)
setDatabaseName(currentDb.c_str()); setDatabaseName(currentDb.c_str());
setDatabaseSchemaName(currentSchema.c_str()); setDatabaseSchemaName(currentSchema.c_str());
return ~0; DBUG_PRINT("error", ("ndb=%d con=%d op=%d",
theError.code,
tConnection ? tConnection->theError.code : -1,
tOperation ? tOperation->theError.code : -1));
DBUG_RETURN(~0);
} }
static const Uint32 MAX_KEY_LEN_64_WORDS = 4; static const Uint32 MAX_KEY_LEN_64_WORDS = 4;
......
...@@ -74,7 +74,6 @@ NdbColumnImpl::operator=(const NdbColumnImpl& col) ...@@ -74,7 +74,6 @@ NdbColumnImpl::operator=(const NdbColumnImpl& col)
m_autoIncrement = col.m_autoIncrement; m_autoIncrement = col.m_autoIncrement;
m_autoIncrementInitialValue = col.m_autoIncrementInitialValue; m_autoIncrementInitialValue = col.m_autoIncrementInitialValue;
m_defaultValue = col.m_defaultValue; m_defaultValue = col.m_defaultValue;
m_attrType = col.m_attrType;
m_attrSize = col.m_attrSize; m_attrSize = col.m_attrSize;
m_arraySize = col.m_arraySize; m_arraySize = col.m_arraySize;
m_keyInfoPos = col.m_keyInfoPos; m_keyInfoPos = col.m_keyInfoPos;
...@@ -228,7 +227,6 @@ NdbColumnImpl::create_psuedo(const char * name){ ...@@ -228,7 +227,6 @@ NdbColumnImpl::create_psuedo(const char * name){
col->m_impl.m_attrId = AttributeHeader::RANGE_NO; col->m_impl.m_attrId = AttributeHeader::RANGE_NO;
col->m_impl.m_attrSize = 4; col->m_impl.m_attrSize = 4;
col->m_impl.m_arraySize = 1; col->m_impl.m_arraySize = 1;
col->m_impl.m_extType = NdbSqlUtil::Type::Unsigned;
} else { } else {
abort(); abort();
} }
...@@ -1149,35 +1147,6 @@ indexTypeMapping[] = { ...@@ -1149,35 +1147,6 @@ indexTypeMapping[] = {
{ -1, -1 } { -1, -1 }
}; };
// TODO: remove, api-kernel type codes must match now
static const
ApiKernelMapping
columnTypeMapping[] = {
{ DictTabInfo::ExtTinyint, NdbDictionary::Column::Tinyint },
{ DictTabInfo::ExtTinyunsigned, NdbDictionary::Column::Tinyunsigned },
{ DictTabInfo::ExtSmallint, NdbDictionary::Column::Smallint },
{ DictTabInfo::ExtSmallunsigned, NdbDictionary::Column::Smallunsigned },
{ DictTabInfo::ExtMediumint, NdbDictionary::Column::Mediumint },
{ DictTabInfo::ExtMediumunsigned, NdbDictionary::Column::Mediumunsigned },
{ DictTabInfo::ExtInt, NdbDictionary::Column::Int },
{ DictTabInfo::ExtUnsigned, NdbDictionary::Column::Unsigned },
{ DictTabInfo::ExtBigint, NdbDictionary::Column::Bigint },
{ DictTabInfo::ExtBigunsigned, NdbDictionary::Column::Bigunsigned },
{ DictTabInfo::ExtFloat, NdbDictionary::Column::Float },
{ DictTabInfo::ExtDouble, NdbDictionary::Column::Double },
{ DictTabInfo::ExtDecimal, NdbDictionary::Column::Decimal },
{ DictTabInfo::ExtChar, NdbDictionary::Column::Char },
{ DictTabInfo::ExtVarchar, NdbDictionary::Column::Varchar },
{ DictTabInfo::ExtBinary, NdbDictionary::Column::Binary },
{ DictTabInfo::ExtVarbinary, NdbDictionary::Column::Varbinary },
{ DictTabInfo::ExtDatetime, NdbDictionary::Column::Datetime },
{ DictTabInfo::ExtTimespec, NdbDictionary::Column::Timespec },
{ DictTabInfo::ExtBlob, NdbDictionary::Column::Blob },
{ DictTabInfo::ExtText, NdbDictionary::Column::Text },
{ DictTabInfo::ExtBit, NdbDictionary::Column::Bit },
{ -1, -1 }
};
int int
NdbDictInterface::parseTableInfo(NdbTableImpl ** ret, NdbDictInterface::parseTableInfo(NdbTableImpl ** ret,
const Uint32 * data, Uint32 len, const Uint32 * data, Uint32 len,
...@@ -1249,15 +1218,11 @@ NdbDictInterface::parseTableInfo(NdbTableImpl ** ret, ...@@ -1249,15 +1218,11 @@ NdbDictInterface::parseTableInfo(NdbTableImpl ** ret,
NdbColumnImpl * col = new NdbColumnImpl(); NdbColumnImpl * col = new NdbColumnImpl();
col->m_attrId = attrDesc.AttributeId; col->m_attrId = attrDesc.AttributeId;
col->setName(attrDesc.AttributeName); col->setName(attrDesc.AttributeName);
col->m_type = (NdbDictionary::Column::Type) if (attrDesc.AttributeExtType >= NDB_TYPE_MAX) {
getApiConstant(attrDesc.AttributeExtType,
columnTypeMapping,
NdbDictionary::Column::Undefined);
if (col->m_type == NdbDictionary::Column::Undefined) {
delete impl; delete impl;
return 703; return 703;
} }
col->m_extType = attrDesc.AttributeExtType; col->m_type = (NdbDictionary::Column::Type)attrDesc.AttributeExtType;
col->m_precision = (attrDesc.AttributeExtPrecision & 0xFFFF); col->m_precision = (attrDesc.AttributeExtPrecision & 0xFFFF);
col->m_scale = attrDesc.AttributeExtScale; col->m_scale = attrDesc.AttributeExtScale;
col->m_length = attrDesc.AttributeExtLength; col->m_length = attrDesc.AttributeExtLength;
...@@ -1281,7 +1246,6 @@ NdbDictInterface::parseTableInfo(NdbTableImpl ** ret, ...@@ -1281,7 +1246,6 @@ NdbDictInterface::parseTableInfo(NdbTableImpl ** ret,
delete impl; delete impl;
return 703; return 703;
} }
col->m_attrType =attrDesc.AttributeType;
col->m_attrSize = (1 << attrDesc.AttributeSize) / 8; col->m_attrSize = (1 << attrDesc.AttributeSize) / 8;
col->m_arraySize = attrDesc.AttributeArraySize; col->m_arraySize = attrDesc.AttributeArraySize;
if(attrDesc.AttributeSize == 0) if(attrDesc.AttributeSize == 0)
...@@ -1535,10 +1499,11 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb, ...@@ -1535,10 +1499,11 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
tmpAttr.AttributeNullableFlag = col->m_nullable; tmpAttr.AttributeNullableFlag = col->m_nullable;
tmpAttr.AttributeDKey = col->m_distributionKey; tmpAttr.AttributeDKey = col->m_distributionKey;
tmpAttr.AttributeExtType = if (col->m_type >= NDB_TYPE_MAX) {
getKernelConstant(col->m_type, m_error.code = 703;
columnTypeMapping, return -1;
DictTabInfo::ExtUndefined); }
tmpAttr.AttributeExtType = (Uint32)col->m_type;
tmpAttr.AttributeExtPrecision = ((unsigned)col->m_precision & 0xFFFF); tmpAttr.AttributeExtPrecision = ((unsigned)col->m_precision & 0xFFFF);
tmpAttr.AttributeExtScale = col->m_scale; tmpAttr.AttributeExtScale = col->m_scale;
tmpAttr.AttributeExtLength = col->m_length; tmpAttr.AttributeExtLength = col->m_length;
......
...@@ -73,11 +73,9 @@ public: ...@@ -73,11 +73,9 @@ public:
/** /**
* Internal types and sizes, and aggregates * Internal types and sizes, and aggregates
*/ */
Uint32 m_attrType; // type outsize API and DICT
Uint32 m_attrSize; // element size (size when arraySize==1) Uint32 m_attrSize; // element size (size when arraySize==1)
Uint32 m_arraySize; // length or length+2 for Var* types Uint32 m_arraySize; // length or length+2 for Var* types
Uint32 m_keyInfoPos; Uint32 m_keyInfoPos;
Uint32 m_extType; // used by restore (kernel type in versin v2x)
bool getInterpretableType() const ; bool getInterpretableType() const ;
bool getCharType() const; bool getCharType() const;
bool getBlobType() const; bool getBlobType() const;
......
...@@ -1284,7 +1284,7 @@ NdbIndexScanOperation::compare(Uint32 skip, Uint32 cols, ...@@ -1284,7 +1284,7 @@ NdbIndexScanOperation::compare(Uint32 skip, Uint32 cols,
const NdbColumnImpl & col = NdbColumnImpl::getImpl(* r1->m_column); const NdbColumnImpl & col = NdbColumnImpl::getImpl(* r1->m_column);
Uint32 len = r1->theAttrSize * r1->theArraySize; Uint32 len = r1->theAttrSize * r1->theArraySize;
if(!r1_null){ if(!r1_null){
const NdbSqlUtil::Type& sqlType = NdbSqlUtil::getType(col.m_extType); const NdbSqlUtil::Type& sqlType = NdbSqlUtil::getType(col.m_type);
int r = (*sqlType.m_cmp)(col.m_cs, d1, len, d2, len, true); int r = (*sqlType.m_cmp)(col.m_cs, d1, len, d2, len, true);
if(r){ if(r){
assert(r != NdbSqlUtil::CmpUnknown); assert(r != NdbSqlUtil::CmpUnknown);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment