Skip to content

Commit 75b0b94

Browse files
author
kent@mysql.com
committed
Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/Users/kent/mysql/bk/mysql-4.1-perl
2 parents b32f693 + 3261bf1 commit 75b0b94

File tree

13 files changed

+319
-69
lines changed

13 files changed

+319
-69
lines changed

include/config-win.h

+15-8
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,25 @@ functions */
3131

3232
#define HAVE_SMEM 1
3333

34-
#if defined(__NT__)
35-
#define SYSTEM_TYPE "NT"
36-
#elif defined(__WIN2000__)
37-
#define SYSTEM_TYPE "WIN2000"
34+
#if defined(_WIN64) || defined(WIN64)
35+
#define SYSTEM_TYPE "Win64"
36+
#elif defined(_WIN32) || defined(WIN32)
37+
#define SYSTEM_TYPE "Win32"
3838
#else
39-
#define SYSTEM_TYPE "Win95/Win98"
39+
#define SYSTEM_TYPE "Windows"
4040
#endif
4141

42-
#if defined(_WIN64) || defined(WIN64)
43-
#define MACHINE_TYPE "ia64" /* Define to machine type name */
42+
#if defined(_M_IA64)
43+
#define MACHINE_TYPE "ia64"
44+
#elif defined(_M_IX86)
45+
#define MACHINE_TYPE "ia32"
46+
#elif defined(_M_ALPHA)
47+
#define MACHINE_TYPE "axp"
4448
#else
45-
#define MACHINE_TYPE "i32" /* Define to machine type name */
49+
#define MACHINE_TYPE "unknown" /* Define to machine type name */
50+
#endif
51+
52+
#if !(defined(_WIN64) || defined(WIN64))
4653
#ifndef _WIN32
4754
#define _WIN32 /* Compatible with old source */
4855
#endif

mysql-test/r/ndb_index_ordered.result

+83
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,89 @@ select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59';
445445
count(*)-9
446446
0
447447
drop table t1;
448+
create table t1 (
449+
a int primary key,
450+
s decimal(12),
451+
t decimal(12, 5),
452+
u decimal(12) unsigned,
453+
v decimal(12, 5) unsigned,
454+
key (s),
455+
key (t),
456+
key (u),
457+
key (v)
458+
) engine=ndb;
459+
insert into t1 values
460+
( 0, -000000000007, -0000061.00003, 000000000061, 0000965.00042),
461+
( 1, -000000000007, -0000061.00042, 000000000061, 0000965.00003),
462+
( 2, -071006035767, 4210253.00024, 000000000001, 0000001.84488),
463+
( 3, 000000007115, 0000000.77607, 000077350625, 0000018.00013),
464+
( 4, -000000068391, -0346486.00000, 000000005071, 0005334.00002),
465+
( 5, -521579890459, -1936874.00001, 000000000154, 0000003.00018),
466+
( 6, -521579890459, -1936874.00018, 000000000154, 0000003.00001),
467+
( 7, 000000000333, 0000051.39140, 000000907958, 0788643.08374),
468+
( 8, 000042731229, 0000009.00000, 000000000009, 6428667.00000),
469+
( 9, -000008159769, 0000918.00004, 000096951421, 7607730.00008);
470+
select count(*)- 5 from t1 use index (s) where s < -000000000007;
471+
count(*)- 5
472+
0
473+
select count(*)- 7 from t1 use index (s) where s <= -000000000007;
474+
count(*)- 7
475+
0
476+
select count(*)- 2 from t1 use index (s) where s = -000000000007;
477+
count(*)- 2
478+
0
479+
select count(*)- 5 from t1 use index (s) where s >= -000000000007;
480+
count(*)- 5
481+
0
482+
select count(*)- 3 from t1 use index (s) where s > -000000000007;
483+
count(*)- 3
484+
0
485+
select count(*)- 4 from t1 use index (t) where t < -0000061.00003;
486+
count(*)- 4
487+
0
488+
select count(*)- 5 from t1 use index (t) where t <= -0000061.00003;
489+
count(*)- 5
490+
0
491+
select count(*)- 1 from t1 use index (t) where t = -0000061.00003;
492+
count(*)- 1
493+
0
494+
select count(*)- 6 from t1 use index (t) where t >= -0000061.00003;
495+
count(*)- 6
496+
0
497+
select count(*)- 5 from t1 use index (t) where t > -0000061.00003;
498+
count(*)- 5
499+
0
500+
select count(*)- 2 from t1 use index (u) where u < 000000000061;
501+
count(*)- 2
502+
0
503+
select count(*)- 4 from t1 use index (u) where u <= 000000000061;
504+
count(*)- 4
505+
0
506+
select count(*)- 2 from t1 use index (u) where u = 000000000061;
507+
count(*)- 2
508+
0
509+
select count(*)- 8 from t1 use index (u) where u >= 000000000061;
510+
count(*)- 8
511+
0
512+
select count(*)- 6 from t1 use index (u) where u > 000000000061;
513+
count(*)- 6
514+
0
515+
select count(*)- 5 from t1 use index (v) where v < 0000965.00042;
516+
count(*)- 5
517+
0
518+
select count(*)- 6 from t1 use index (v) where v <= 0000965.00042;
519+
count(*)- 6
520+
0
521+
select count(*)- 1 from t1 use index (v) where v = 0000965.00042;
522+
count(*)- 1
523+
0
524+
select count(*)- 5 from t1 use index (v) where v >= 0000965.00042;
525+
count(*)- 5
526+
0
527+
select count(*)- 4 from t1 use index (v) where v > 0000965.00042;
528+
count(*)- 4
529+
0
530+
drop table t1;
448531
create table t1(a int primary key, b int not null, index(b));
449532
insert into t1 values (1,1), (2,2);
450533
set autocommit=0;

mysql-test/t/ndb_index_ordered.test

+52
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,58 @@ select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59';
249249

250250
drop table t1;
251251

252+
# decimal (not the new 5.0 thing)
253+
254+
create table t1 (
255+
a int primary key,
256+
s decimal(12),
257+
t decimal(12, 5),
258+
u decimal(12) unsigned,
259+
v decimal(12, 5) unsigned,
260+
key (s),
261+
key (t),
262+
key (u),
263+
key (v)
264+
) engine=ndb;
265+
#
266+
insert into t1 values
267+
( 0, -000000000007, -0000061.00003, 000000000061, 0000965.00042),
268+
( 1, -000000000007, -0000061.00042, 000000000061, 0000965.00003),
269+
( 2, -071006035767, 4210253.00024, 000000000001, 0000001.84488),
270+
( 3, 000000007115, 0000000.77607, 000077350625, 0000018.00013),
271+
( 4, -000000068391, -0346486.00000, 000000005071, 0005334.00002),
272+
( 5, -521579890459, -1936874.00001, 000000000154, 0000003.00018),
273+
( 6, -521579890459, -1936874.00018, 000000000154, 0000003.00001),
274+
( 7, 000000000333, 0000051.39140, 000000907958, 0788643.08374),
275+
( 8, 000042731229, 0000009.00000, 000000000009, 6428667.00000),
276+
( 9, -000008159769, 0000918.00004, 000096951421, 7607730.00008);
277+
#
278+
select count(*)- 5 from t1 use index (s) where s < -000000000007;
279+
select count(*)- 7 from t1 use index (s) where s <= -000000000007;
280+
select count(*)- 2 from t1 use index (s) where s = -000000000007;
281+
select count(*)- 5 from t1 use index (s) where s >= -000000000007;
282+
select count(*)- 3 from t1 use index (s) where s > -000000000007;
283+
#
284+
select count(*)- 4 from t1 use index (t) where t < -0000061.00003;
285+
select count(*)- 5 from t1 use index (t) where t <= -0000061.00003;
286+
select count(*)- 1 from t1 use index (t) where t = -0000061.00003;
287+
select count(*)- 6 from t1 use index (t) where t >= -0000061.00003;
288+
select count(*)- 5 from t1 use index (t) where t > -0000061.00003;
289+
#
290+
select count(*)- 2 from t1 use index (u) where u < 000000000061;
291+
select count(*)- 4 from t1 use index (u) where u <= 000000000061;
292+
select count(*)- 2 from t1 use index (u) where u = 000000000061;
293+
select count(*)- 8 from t1 use index (u) where u >= 000000000061;
294+
select count(*)- 6 from t1 use index (u) where u > 000000000061;
295+
#
296+
select count(*)- 5 from t1 use index (v) where v < 0000965.00042;
297+
select count(*)- 6 from t1 use index (v) where v <= 0000965.00042;
298+
select count(*)- 1 from t1 use index (v) where v = 0000965.00042;
299+
select count(*)- 5 from t1 use index (v) where v >= 0000965.00042;
300+
select count(*)- 4 from t1 use index (v) where v > 0000965.00042;
301+
302+
drop table t1;
303+
252304
# bug#7798
253305
create table t1(a int primary key, b int not null, index(b));
254306
insert into t1 values (1,1), (2,2);

ndb/include/kernel/signaldata/DictTabInfo.hpp

+16-4
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ class DictTabInfo {
302302
ExtBigunsigned = NdbSqlUtil::Type::Bigunsigned,
303303
ExtFloat = NdbSqlUtil::Type::Float,
304304
ExtDouble = NdbSqlUtil::Type::Double,
305-
ExtDecimal = NdbSqlUtil::Type::Decimal,
305+
ExtOlddecimal = NdbSqlUtil::Type::Olddecimal,
306+
ExtOlddecimalunsigned = NdbSqlUtil::Type::Olddecimalunsigned,
306307
ExtChar = NdbSqlUtil::Type::Char,
307308
ExtVarchar = NdbSqlUtil::Type::Varchar,
308309
ExtBinary = NdbSqlUtil::Type::Binary,
@@ -411,9 +412,20 @@ class DictTabInfo {
411412
AttributeSize = DictTabInfo::a64Bit;
412413
AttributeArraySize = AttributeExtLength;
413414
return true;
414-
case DictTabInfo::ExtDecimal:
415-
// not yet implemented anywhere
416-
break;
415+
case DictTabInfo::ExtOlddecimal:
416+
AttributeType = DictTabInfo::StringType;
417+
AttributeSize = DictTabInfo::an8Bit;
418+
AttributeArraySize =
419+
(1 + AttributeExtPrecision + (int(AttributeExtScale) > 0)) *
420+
AttributeExtLength;
421+
return true;
422+
case DictTabInfo::ExtOlddecimalunsigned:
423+
AttributeType = DictTabInfo::StringType;
424+
AttributeSize = DictTabInfo::an8Bit;
425+
AttributeArraySize =
426+
(0 + AttributeExtPrecision + (int(AttributeExtScale) > 0)) *
427+
AttributeExtLength;
428+
return true;
417429
case DictTabInfo::ExtChar:
418430
case DictTabInfo::ExtBinary:
419431
AttributeType = DictTabInfo::StringType;

ndb/include/ndbapi/NdbDictionary.hpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class NdbDictionary {
179179
Bigunsigned, ///< 64 Bit. 8 byte signed integer, can be used in array
180180
Float, ///< 32-bit float. 4 bytes float, can be used in array
181181
Double, ///< 64-bit float. 8 byte float, can be used in array
182-
Decimal, ///< Precision, Scale are applicable
182+
Olddecimal, ///< MySQL < 5.0 signed decimal, Precision, Scale
183183
Char, ///< Len. A fixed array of 1-byte chars
184184
Varchar, ///< Max len
185185
Binary, ///< Len
@@ -190,7 +190,8 @@ class NdbDictionary {
190190
Text, ///< Text blob
191191
Time = 25, ///< Time without date
192192
Year = 26, ///< Year 1901-2155 (1 byte)
193-
Timestamp = 27 ///< Unix time
193+
Timestamp = 27, ///< Unix time
194+
Olddecimalunsigned = 28
194195
};
195196

196197
/**
@@ -276,25 +277,25 @@ class NdbDictionary {
276277

277278
/**
278279
* Set precision of column.
279-
* @note Only applicable for builtin type Decimal
280+
* @note Only applicable for decimal types
280281
*/
281282
void setPrecision(int);
282283

283284
/**
284285
* Get precision of column.
285-
* @note Only applicable for builtin type Decimal
286+
* @note Only applicable for decimal types
286287
*/
287288
int getPrecision() const;
288289

289290
/**
290291
* Set scale of column.
291-
* @note Only applicable for builtin type Decimal
292+
* @note Only applicable for decimal types
292293
*/
293294
void setScale(int);
294295

295296
/**
296297
* Get scale of column.
297-
* @note Only applicable for builtin type Decimal
298+
* @note Only applicable for decimal types
298299
*/
299300
int getScale() const;
300301

ndb/include/util/NdbSqlUtil.hpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class NdbSqlUtil {
7575
Bigunsigned, // 64 Bit
7676
Float, // 32-bit float
7777
Double, // 64-bit float
78-
Decimal, // Precision, Scale
78+
Olddecimal, // Precision, Scale
7979
Char, // Len
8080
Varchar, // Max len
8181
Binary, // Len
@@ -86,7 +86,8 @@ class NdbSqlUtil {
8686
Text, // Text blob
8787
Time = 25, // Time without date
8888
Year = 26, // Year (size 1 byte)
89-
Timestamp = 27 // Unix seconds (uint32)
89+
Timestamp = 27, // Unix seconds (uint32)
90+
Olddecimalunsigned = 28
9091
};
9192
Enum m_typeId;
9293
Cmp* m_cmp; // comparison method
@@ -109,6 +110,11 @@ class NdbSqlUtil {
109110
static bool usable_in_hash_index(Uint32 typeId, const void* cs);
110111
static bool usable_in_ordered_index(Uint32 typeId, const void* cs);
111112

113+
/**
114+
* Compare decimal numbers.
115+
*/
116+
static int cmp_olddecimal(const uchar* s1, const uchar* s2, unsigned n);
117+
112118
private:
113119
/**
114120
* List of all types. Must match Type::Enum.
@@ -129,7 +135,7 @@ class NdbSqlUtil {
129135
static Cmp cmpBigunsigned;
130136
static Cmp cmpFloat;
131137
static Cmp cmpDouble;
132-
static Cmp cmpDecimal;
138+
static Cmp cmpOlddecimal;
133139
static Cmp cmpChar;
134140
static Cmp cmpVarchar;
135141
static Cmp cmpBinary;
@@ -141,6 +147,7 @@ class NdbSqlUtil {
141147
static Cmp cmpTime;
142148
static Cmp cmpYear;
143149
static Cmp cmpTimestamp;
150+
static Cmp cmpOlddecimalunsigned;
144151
};
145152

146153
#endif

0 commit comments

Comments
 (0)