Commit a3f5d652 authored by mskold@mysql.com's avatar mskold@mysql.com

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

into mysql.com:/usr/local/home/marty/MySQL/mysql-5.0-ndb
parents 37301115 e7ebc032
...@@ -31,18 +31,25 @@ functions */ ...@@ -31,18 +31,25 @@ functions */
#define HAVE_SMEM 1 #define HAVE_SMEM 1
#if defined(__NT__) #if defined(_WIN64) || defined(WIN64)
#define SYSTEM_TYPE "NT" #define SYSTEM_TYPE "Win64"
#elif defined(__WIN2000__) #elif defined(_WIN32) || defined(WIN32)
#define SYSTEM_TYPE "WIN2000" #define SYSTEM_TYPE "Win32"
#else #else
#define SYSTEM_TYPE "Win95/Win98" #define SYSTEM_TYPE "Windows"
#endif #endif
#if defined(_WIN64) || defined(WIN64) #if defined(_M_IA64)
#define MACHINE_TYPE "ia64" /* Define to machine type name */ #define MACHINE_TYPE "ia64"
#elif defined(_M_IX86)
#define MACHINE_TYPE "ia32"
#elif defined(_M_ALPHA)
#define MACHINE_TYPE "axp"
#else #else
#define MACHINE_TYPE "i32" /* Define to machine type name */ #define MACHINE_TYPE "unknown" /* Define to machine type name */
#endif
#if !(defined(_WIN64) || defined(WIN64))
#ifndef _WIN32 #ifndef _WIN32
#define _WIN32 /* Compatible with old source */ #define _WIN32 /* Compatible with old source */
#endif #endif
......
...@@ -2059,6 +2059,16 @@ call bug6029()| ...@@ -2059,6 +2059,16 @@ call bug6029()|
1136 1136
drop procedure bug6029| drop procedure bug6029|
drop table t3| drop table t3|
drop procedure if exists bug8540|
create procedure bug8540()
begin
declare x int default 1;
select x as y, x+0 as z;
end|
call bug8540()|
y z
1 1
drop procedure bug8540|
drop table if exists fac| drop table if exists fac|
create table fac (n int unsigned not null primary key, f bigint unsigned)| create table fac (n int unsigned not null primary key, f bigint unsigned)|
drop procedure if exists ifac| drop procedure if exists ifac|
......
...@@ -280,6 +280,58 @@ select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59'; ...@@ -280,6 +280,58 @@ select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59';
drop table t1; drop table t1;
# decimal (not the new 5.0 thing)
#create table t1 (
# a int primary key,
# s decimal(12),
# t decimal(12, 5),
# u decimal(12) unsigned,
# v decimal(12, 5) unsigned,
# key (s),
# key (t),
# key (u),
# key (v)
#) engine=ndb;
##
#insert into t1 values
# ( 0, -000000000007, -0000061.00003, 000000000061, 0000965.00042),
# ( 1, -000000000007, -0000061.00042, 000000000061, 0000965.00003),
# ( 2, -071006035767, 4210253.00024, 000000000001, 0000001.84488),
# ( 3, 000000007115, 0000000.77607, 000077350625, 0000018.00013),
# ( 4, -000000068391, -0346486.00000, 000000005071, 0005334.00002),
# ( 5, -521579890459, -1936874.00001, 000000000154, 0000003.00018),
# ( 6, -521579890459, -1936874.00018, 000000000154, 0000003.00001),
# ( 7, 000000000333, 0000051.39140, 000000907958, 0788643.08374),
# ( 8, 000042731229, 0000009.00000, 000000000009, 6428667.00000),
# ( 9, -000008159769, 0000918.00004, 000096951421, 7607730.00008);
##
#select count(*)- 5 from t1 use index (s) where s < -000000000007;
#select count(*)- 7 from t1 use index (s) where s <= -000000000007;
#select count(*)- 2 from t1 use index (s) where s = -000000000007;
#select count(*)- 5 from t1 use index (s) where s >= -000000000007;
#select count(*)- 3 from t1 use index (s) where s > -000000000007;
##
#select count(*)- 4 from t1 use index (t) where t < -0000061.00003;
#select count(*)- 5 from t1 use index (t) where t <= -0000061.00003;
#select count(*)- 1 from t1 use index (t) where t = -0000061.00003;
#select count(*)- 6 from t1 use index (t) where t >= -0000061.00003;
#select count(*)- 5 from t1 use index (t) where t > -0000061.00003;
##
#select count(*)- 2 from t1 use index (u) where u < 000000000061;
#select count(*)- 4 from t1 use index (u) where u <= 000000000061;
#select count(*)- 2 from t1 use index (u) where u = 000000000061;
#select count(*)- 8 from t1 use index (u) where u >= 000000000061;
#select count(*)- 6 from t1 use index (u) where u > 000000000061;
##
#select count(*)- 5 from t1 use index (v) where v < 0000965.00042;
#select count(*)- 6 from t1 use index (v) where v <= 0000965.00042;
#select count(*)- 1 from t1 use index (v) where v = 0000965.00042;
#select count(*)- 5 from t1 use index (v) where v >= 0000965.00042;
#select count(*)- 4 from t1 use index (v) where v > 0000965.00042;
#
#drop table t1;
# bug#7798 # bug#7798
create table t1(a int primary key, b int not null, index(b)); create table t1(a int primary key, b int not null, index(b));
insert into t1 values (1,1), (2,2); insert into t1 values (1,1), (2,2);
......
...@@ -2520,6 +2520,22 @@ call bug6029()| ...@@ -2520,6 +2520,22 @@ call bug6029()|
drop procedure bug6029| drop procedure bug6029|
drop table t3| drop table t3|
#
# BUG#8540: Local variable overrides an alias
#
--disable_warnings
drop procedure if exists bug8540|
--enable_warnings
create procedure bug8540()
begin
declare x int default 1;
select x as y, x+0 as z;
end|
call bug8540()|
drop procedure bug8540|
# #
# Some "real" examples # Some "real" examples
......
...@@ -264,7 +264,8 @@ public: ...@@ -264,7 +264,8 @@ public:
ExtBigunsigned = NdbSqlUtil::Type::Bigunsigned, ExtBigunsigned = NdbSqlUtil::Type::Bigunsigned,
ExtFloat = NdbSqlUtil::Type::Float, ExtFloat = NdbSqlUtil::Type::Float,
ExtDouble = NdbSqlUtil::Type::Double, ExtDouble = NdbSqlUtil::Type::Double,
ExtDecimal = NdbSqlUtil::Type::Decimal, ExtOlddecimal = NdbSqlUtil::Type::Olddecimal,
ExtOlddecimalunsigned = NdbSqlUtil::Type::Olddecimalunsigned,
ExtChar = NdbSqlUtil::Type::Char, ExtChar = NdbSqlUtil::Type::Char,
ExtVarchar = NdbSqlUtil::Type::Varchar, ExtVarchar = NdbSqlUtil::Type::Varchar,
ExtBinary = NdbSqlUtil::Type::Binary, ExtBinary = NdbSqlUtil::Type::Binary,
...@@ -345,9 +346,18 @@ public: ...@@ -345,9 +346,18 @@ public:
AttributeSize = DictTabInfo::a64Bit; AttributeSize = DictTabInfo::a64Bit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
break; break;
case DictTabInfo::ExtDecimal: case DictTabInfo::ExtOlddecimal:
// not yet implemented anywhere AttributeSize = DictTabInfo::an8Bit;
return false; AttributeArraySize =
(1 + AttributeExtPrecision + (int(AttributeExtScale) > 0)) *
AttributeExtLength;
break;
case DictTabInfo::ExtOlddecimalunsigned:
AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize =
(0 + AttributeExtPrecision + (int(AttributeExtScale) > 0)) *
AttributeExtLength;
break;
case DictTabInfo::ExtChar: case DictTabInfo::ExtChar:
case DictTabInfo::ExtBinary: case DictTabInfo::ExtBinary:
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#define NDB_TYPE_BIGUNSIGNED 10 #define NDB_TYPE_BIGUNSIGNED 10
#define NDB_TYPE_FLOAT 11 #define NDB_TYPE_FLOAT 11
#define NDB_TYPE_DOUBLE 12 #define NDB_TYPE_DOUBLE 12
#define NDB_TYPE_DECIMAL 13 /* not used */ #define NDB_TYPE_OLDDECIMAL 13
#define NDB_TYPE_CHAR 14 #define NDB_TYPE_CHAR 14
#define NDB_TYPE_VARCHAR 15 #define NDB_TYPE_VARCHAR 15
#define NDB_TYPE_BINARY 16 #define NDB_TYPE_BINARY 16
...@@ -63,7 +63,8 @@ ...@@ -63,7 +63,8 @@
#define NDB_TYPE_TIME 25 #define NDB_TYPE_TIME 25
#define NDB_TYPE_YEAR 26 #define NDB_TYPE_YEAR 26
#define NDB_TYPE_TIMESTAMP 27 #define NDB_TYPE_TIMESTAMP 27
#define NDB_TYPE_OLDDECIMALUNSIGNED 28
#define NDB_TYPE_MAX 28 #define NDB_TYPE_MAX 29
#endif #endif
...@@ -184,7 +184,8 @@ public: ...@@ -184,7 +184,8 @@ public:
Bigunsigned = NDB_TYPE_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 = NDB_TYPE_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 = NDB_TYPE_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 = NDB_TYPE_DECIMAL, ///< Precision, Scale are applicable Olddecimal = NDB_TYPE_OLDDECIMAL, ///< MySQL < 5.0 signed decimal, Precision, Scale
Olddecimalunsigned = NDB_TYPE_OLDDECIMALUNSIGNED,
Char = NDB_TYPE_CHAR, ///< Len. A fixed array of 1-byte chars Char = NDB_TYPE_CHAR, ///< Len. A fixed array of 1-byte chars
Varchar = NDB_TYPE_VARCHAR, ///< Length bytes: 1, Max: 255 Varchar = NDB_TYPE_VARCHAR, ///< Length bytes: 1, Max: 255
Binary = NDB_TYPE_BINARY, ///< Len Binary = NDB_TYPE_BINARY, ///< Len
...@@ -248,13 +249,13 @@ public: ...@@ -248,13 +249,13 @@ public:
/** /**
* Get precision of column. * Get precision of column.
* @note Only applicable for builtin type Decimal * @note Only applicable for decimal types
*/ */
int getPrecision() const; int getPrecision() const;
/** /**
* Get scale of column. * Get scale of column.
* @note Only applicable for builtin type Decimal * @note Only applicable for decimal types
*/ */
int getScale() const; int getScale() const;
...@@ -372,13 +373,13 @@ public: ...@@ -372,13 +373,13 @@ public:
/** /**
* Set precision of column. * Set precision of column.
* @note Only applicable for builtin type Decimal * @note Only applicable for decimal types
*/ */
void setPrecision(int); void setPrecision(int);
/** /**
* Set scale of column. * Set scale of column.
* @note Only applicable for builtin type Decimal * @note Only applicable for decimal types
*/ */
void setScale(int); void setScale(int);
......
...@@ -80,7 +80,7 @@ public: ...@@ -80,7 +80,7 @@ public:
Bigunsigned = NDB_TYPE_BIGUNSIGNED, Bigunsigned = NDB_TYPE_BIGUNSIGNED,
Float = NDB_TYPE_FLOAT, Float = NDB_TYPE_FLOAT,
Double = NDB_TYPE_DOUBLE, Double = NDB_TYPE_DOUBLE,
Decimal = NDB_TYPE_DECIMAL, Olddecimal = NDB_TYPE_OLDDECIMAL,
Char = NDB_TYPE_CHAR, Char = NDB_TYPE_CHAR,
Varchar = NDB_TYPE_VARCHAR, Varchar = NDB_TYPE_VARCHAR,
Binary = NDB_TYPE_BINARY, Binary = NDB_TYPE_BINARY,
...@@ -94,7 +94,8 @@ public: ...@@ -94,7 +94,8 @@ public:
Longvarbinary = NDB_TYPE_LONG_VARBINARY, Longvarbinary = NDB_TYPE_LONG_VARBINARY,
Time = NDB_TYPE_TIME, Time = NDB_TYPE_TIME,
Year = NDB_TYPE_YEAR, Year = NDB_TYPE_YEAR,
Timestamp = NDB_TYPE_TIMESTAMP Timestamp = NDB_TYPE_TIMESTAMP,
Olddecimalunsigned = NDB_TYPE_OLDDECIMALUNSIGNED
}; };
Enum m_typeId; // redundant Enum m_typeId; // redundant
Cmp* m_cmp; // comparison method Cmp* m_cmp; // comparison method
...@@ -130,6 +131,11 @@ public: ...@@ -130,6 +131,11 @@ public:
*/ */
static int strnxfrm_bug7284(CHARSET_INFO* cs, unsigned char* dst, unsigned dstLen, const unsigned char*src, unsigned srcLen); static int strnxfrm_bug7284(CHARSET_INFO* cs, unsigned char* dst, unsigned dstLen, const unsigned char*src, unsigned srcLen);
/**
* Compare decimal numbers.
*/
static int cmp_olddecimal(const uchar* s1, const uchar* s2, unsigned n);
private: private:
/** /**
* List of all types. Must match Type::Enum. * List of all types. Must match Type::Enum.
...@@ -150,7 +156,7 @@ private: ...@@ -150,7 +156,7 @@ private:
static Cmp cmpBigunsigned; static Cmp cmpBigunsigned;
static Cmp cmpFloat; static Cmp cmpFloat;
static Cmp cmpDouble; static Cmp cmpDouble;
static Cmp cmpDecimal; static Cmp cmpOlddecimal;
static Cmp cmpChar; static Cmp cmpChar;
static Cmp cmpVarchar; static Cmp cmpVarchar;
static Cmp cmpBinary; static Cmp cmpBinary;
...@@ -165,6 +171,7 @@ private: ...@@ -165,6 +171,7 @@ private:
static Cmp cmpTime; static Cmp cmpTime;
static Cmp cmpYear; static Cmp cmpYear;
static Cmp cmpTimestamp; static Cmp cmpTimestamp;
static Cmp cmpOlddecimalunsigned;
}; };
#endif #endif
...@@ -77,117 +77,121 @@ NdbSqlUtil::char_like(const char* s1, unsigned n1, ...@@ -77,117 +77,121 @@ NdbSqlUtil::char_like(const char* s1, unsigned n1,
const NdbSqlUtil::Type const NdbSqlUtil::Type
NdbSqlUtil::m_typeList[] = { NdbSqlUtil::m_typeList[] = {
{ { // 0
Type::Undefined, Type::Undefined,
NULL NULL
}, },
{ { // 1
Type::Tinyint, Type::Tinyint,
cmpTinyint cmpTinyint
}, },
{ { // 2
Type::Tinyunsigned, Type::Tinyunsigned,
cmpTinyunsigned cmpTinyunsigned
}, },
{ { // 3
Type::Smallint, Type::Smallint,
cmpSmallint cmpSmallint
}, },
{ { // 4
Type::Smallunsigned, Type::Smallunsigned,
cmpSmallunsigned cmpSmallunsigned
}, },
{ { // 5
Type::Mediumint, Type::Mediumint,
cmpMediumint cmpMediumint
}, },
{ { // 6
Type::Mediumunsigned, Type::Mediumunsigned,
cmpMediumunsigned cmpMediumunsigned
}, },
{ { // 7
Type::Int, Type::Int,
cmpInt cmpInt
}, },
{ { // 8
Type::Unsigned, Type::Unsigned,
cmpUnsigned cmpUnsigned
}, },
{ { // 9
Type::Bigint, Type::Bigint,
cmpBigint cmpBigint
}, },
{ { // 10
Type::Bigunsigned, Type::Bigunsigned,
cmpBigunsigned cmpBigunsigned
}, },
{ { // 11
Type::Float, Type::Float,
cmpFloat cmpFloat
}, },
{ { // 12
Type::Double, Type::Double,
cmpDouble cmpDouble
}, },
{ { // 13
Type::Decimal, Type::Olddecimal,
NULL // cmpDecimal cmpOlddecimal
}, },
{ { // 14
Type::Char, Type::Char,
cmpChar cmpChar
}, },
{ { // 15
Type::Varchar, Type::Varchar,
cmpVarchar cmpVarchar
}, },
{ { // 16
Type::Binary, Type::Binary,
cmpBinary cmpBinary
}, },
{ { // 17
Type::Varbinary, Type::Varbinary,
cmpVarbinary cmpVarbinary
}, },
{ { // 18
Type::Datetime, Type::Datetime,
cmpDatetime cmpDatetime
}, },
{ { // 19
Type::Date, Type::Date,
cmpDate cmpDate
}, },
{ { // 20
Type::Blob, Type::Blob,
NULL // cmpBlob NULL // cmpBlob
}, },
{ { // 21
Type::Text, Type::Text,
NULL // cmpText NULL // cmpText
}, },
{ { // 22
Type::Bit, Type::Bit,
NULL // cmpBit NULL // cmpBit
}, },
{ { // 23
Type::Longvarchar, Type::Longvarchar,
cmpLongvarchar cmpLongvarchar
}, },
{ { // 24
Type::Longvarbinary, Type::Longvarbinary,
cmpLongvarbinary cmpLongvarbinary
}, },
{ { // 25
Type::Time, Type::Time,
cmpTime cmpTime
}, },
{ { // 26
Type::Year, Type::Year,
cmpYear cmpYear
}, },
{ { // 27
Type::Timestamp, Type::Timestamp,
cmpTimestamp cmpTimestamp
},
{ // 28
Type::Olddecimalunsigned,
cmpOlddecimalunsigned
} }
}; };
...@@ -430,14 +434,55 @@ NdbSqlUtil::cmpDouble(const void* info, const void* p1, unsigned n1, const void* ...@@ -430,14 +434,55 @@ NdbSqlUtil::cmpDouble(const void* info, const void* p1, unsigned n1, const void*
return CmpUnknown; return CmpUnknown;
} }
// not used by MySQL or NDB
int int
NdbSqlUtil::cmpDecimal(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full) NdbSqlUtil::cmp_olddecimal(const uchar* s1, const uchar* s2, unsigned n)
{ {
assert(false); int sgn = +1;
unsigned i = 0;
while (i < n) {
int c1 = s1[i];
int c2 = s2[i];
if (c1 == c2) {
if (c1 == '-')
sgn = -1;
} else if (c1 == '-') {
return -1;
} else if (c2 == '-') {
return +1;
} else if (c1 < c2) {
return -1 * sgn;
} else {
return +1 * sgn;
}
i++;
}
return 0; return 0;
} }
int
NdbSqlUtil::cmpOlddecimal(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
{
if (full) {
assert(n1 == n2);
const uchar* v1 = (const uchar*)p1;
const uchar* v2 = (const uchar*)p2;
return cmp_olddecimal(v1, v2, n1);
}
return CmpUnknown;
}
int
NdbSqlUtil::cmpOlddecimalunsigned(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
{
if (full) {
assert(n1 == n2);
const uchar* v1 = (const uchar*)p1;
const uchar* v2 = (const uchar*)p2;
return cmp_olddecimal(v1, v2, n1);
}
return CmpUnknown;
}
int int
NdbSqlUtil::cmpChar(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full) NdbSqlUtil::cmpChar(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
{ {
......
...@@ -948,8 +948,11 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col) ...@@ -948,8 +948,11 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col)
case NdbDictionary::Column::Double: case NdbDictionary::Column::Double:
out << "Double"; out << "Double";
break; break;
case NdbDictionary::Column::Decimal: case NdbDictionary::Column::Olddecimal:
out << "Decimal(" << col.getScale() << "," << col.getPrecision() << ")"; out << "Olddecimal(" << col.getPrecision() << "," << col.getScale() << ")";
break;
case NdbDictionary::Column::Olddecimalunsigned:
out << "Olddecimalunsigned(" << col.getPrecision() << "," << col.getScale() << ")";
break; break;
case NdbDictionary::Column::Char: case NdbDictionary::Column::Char:
out << "Char(" << col.getLength() << ";" << csname << ")"; out << "Char(" << col.getLength() << ";" << csname << ")";
......
...@@ -109,7 +109,8 @@ NdbColumnImpl::init(Type t) ...@@ -109,7 +109,8 @@ NdbColumnImpl::init(Type t)
m_length = 1; m_length = 1;
m_cs = NULL; m_cs = NULL;
break; break;
case Decimal: case Olddecimal:
case Olddecimalunsigned:
m_precision = 10; m_precision = 10;
m_scale = 0; m_scale = 0;
m_length = 1; m_length = 1;
......
...@@ -178,7 +178,8 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r) ...@@ -178,7 +178,8 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
return out; return out;
} }
uint length = r.getColumn()->getLength(); const NdbDictionary::Column* c = r.getColumn();
uint length = c->getLength();
if (length > 1) if (length > 1)
out << "["; out << "[";
...@@ -237,6 +238,18 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r) ...@@ -237,6 +238,18 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
case NdbDictionary::Column::Double: case NdbDictionary::Column::Double:
out << r.double_value(); out << r.double_value();
break; break;
case NdbDictionary::Column::Olddecimal:
{
short len = 1 + c->getPrecision() + (c->getScale() > 0);
out.print("%.*s", len, r.aRef());
}
break;
case NdbDictionary::Column::Olddecimalunsigned:
{
short len = 0 + c->getPrecision() + (c->getScale() > 0);
out.print("%.*s", len, r.aRef());
}
break;
// for dates cut-and-paste from field.cc // for dates cut-and-paste from field.cc
case NdbDictionary::Column::Datetime: case NdbDictionary::Column::Datetime:
{ {
......
...@@ -567,7 +567,8 @@ convertColumnTypeToAttrType(NdbDictionary::Column::Type _type) ...@@ -567,7 +567,8 @@ convertColumnTypeToAttrType(NdbDictionary::Column::Type _type)
case NdbDictionary::Column::Unsigned: case NdbDictionary::Column::Unsigned:
return UnSigned; return UnSigned;
case NdbDictionary::Column::Float: case NdbDictionary::Column::Float:
case NdbDictionary::Column::Decimal: case NdbDictionary::Column::Olddecimal:
case NdbDictionary::Column::Olddecimalunsigned:
case NdbDictionary::Column::Double: case NdbDictionary::Column::Double:
return Float; return Float;
case NdbDictionary::Column::Char: case NdbDictionary::Column::Char:
......
...@@ -145,7 +145,8 @@ HugoCalculator::calcValue(int record, ...@@ -145,7 +145,8 @@ HugoCalculator::calcValue(int record,
case NdbDictionary::Column::Bigunsigned: case NdbDictionary::Column::Bigunsigned:
case NdbDictionary::Column::Float: case NdbDictionary::Column::Float:
case NdbDictionary::Column::Double: case NdbDictionary::Column::Double:
case NdbDictionary::Column::Decimal: case NdbDictionary::Column::Olddecimal:
case NdbDictionary::Column::Olddecimalunsigned:
case NdbDictionary::Column::Binary: case NdbDictionary::Column::Binary:
case NdbDictionary::Column::Datetime: case NdbDictionary::Column::Datetime:
case NdbDictionary::Column::Time: case NdbDictionary::Column::Time:
......
...@@ -44,9 +44,12 @@ BackupConsumer::create_table_string(const TableS & table, ...@@ -44,9 +44,12 @@ BackupConsumer::create_table_string(const TableS & table,
case NdbDictionary::Column::Float: case NdbDictionary::Column::Float:
pos += sprintf(buf+pos, "%s", "float"); pos += sprintf(buf+pos, "%s", "float");
break; break;
case NdbDictionary::Column::Decimal: case NdbDictionary::Column::Olddecimal:
pos += sprintf(buf+pos, "%s", "decimal"); pos += sprintf(buf+pos, "%s", "decimal");
break; break;
case NdbDictionary::Column::Olddecimalunsigned:
pos += sprintf(buf+pos, "%s", "decimal unsigned");
break;
case NdbDictionary::Column::Char: case NdbDictionary::Column::Char:
pos += sprintf(buf+pos, "%s", "char"); pos += sprintf(buf+pos, "%s", "char");
break; break;
......
...@@ -602,7 +602,7 @@ innobase_mysql_tmpfile(void) ...@@ -602,7 +602,7 @@ innobase_mysql_tmpfile(void)
{ {
char filename[FN_REFLEN]; char filename[FN_REFLEN];
int fd2 = -1; int fd2 = -1;
File fd = create_temp_file(filename, NullS, "ib", File fd = create_temp_file(filename, mysql_tmpdir, "ib",
#ifdef __WIN__ #ifdef __WIN__
O_BINARY | O_TRUNC | O_SEQUENTIAL | O_BINARY | O_TRUNC | O_SEQUENTIAL |
O_TEMPORARY | O_SHORT_LIVED | O_TEMPORARY | O_SHORT_LIVED |
......
...@@ -3430,10 +3430,6 @@ static int create_ndb_column(NDBCOL &col, ...@@ -3430,10 +3430,6 @@ static int create_ndb_column(NDBCOL &col,
const enum enum_field_types mysql_type= field->real_type(); const enum enum_field_types mysql_type= field->real_type();
switch (mysql_type) { switch (mysql_type) {
// Numeric types // Numeric types
case MYSQL_TYPE_DECIMAL:
col.setType(NDBCOL::Char);
col.setLength(field->pack_length());
break;
case MYSQL_TYPE_TINY: case MYSQL_TYPE_TINY:
if (field->flags & UNSIGNED_FLAG) if (field->flags & UNSIGNED_FLAG)
col.setType(NDBCOL::Tinyunsigned); col.setType(NDBCOL::Tinyunsigned);
...@@ -3477,6 +3473,26 @@ static int create_ndb_column(NDBCOL &col, ...@@ -3477,6 +3473,26 @@ static int create_ndb_column(NDBCOL &col,
col.setType(NDBCOL::Double); col.setType(NDBCOL::Double);
col.setLength(1); col.setLength(1);
break; break;
case MYSQL_TYPE_DECIMAL:
{
Field_decimal *f= (Field_decimal*)field;
uint precision= f->pack_length();
uint scale= f->decimals();
if (field->flags & UNSIGNED_FLAG)
{
col.setType(NDBCOL::Olddecimalunsigned);
precision-= (scale > 0);
}
else
{
col.setType(NDBCOL::Olddecimal);
precision-= 1 + (scale > 0);
}
col.setPrecision(precision);
col.setScale(scale);
col.setLength(1);
}
break;
// Date types // Date types
case MYSQL_TYPE_DATETIME: case MYSQL_TYPE_DATETIME:
col.setType(NDBCOL::Datetime); col.setType(NDBCOL::Datetime);
......
...@@ -460,7 +460,10 @@ class Item_splocal : public Item ...@@ -460,7 +460,10 @@ class Item_splocal : public Item
{ {
Item *it= this_item(); Item *it= this_item();
it->set_name(m_name.str, m_name.length, system_charset_info); if (name)
it->set_name(name, strlen(name), system_charset_info);
else
it->set_name(m_name.str, m_name.length, system_charset_info);
it->make_field(field); it->make_field(field);
} }
......
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