Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
caa3b1c1
Commit
caa3b1c1
authored
Feb 16, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge dellis@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/dellis/bkl/bug-4.1
parents
c40e31e5
93f46b86
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
343 additions
and
69 deletions
+343
-69
include/config-win.h
include/config-win.h
+15
-8
mysql-test/r/delete.result
mysql-test/r/delete.result
+9
-0
mysql-test/r/ndb_index_ordered.result
mysql-test/r/ndb_index_ordered.result
+83
-0
mysql-test/t/delete.test
mysql-test/t/delete.test
+11
-0
mysql-test/t/ndb_index_ordered.test
mysql-test/t/ndb_index_ordered.test
+52
-0
mysql-test/t/rpl_multi_query.test
mysql-test/t/rpl_multi_query.test
+3
-0
ndb/include/kernel/signaldata/DictTabInfo.hpp
ndb/include/kernel/signaldata/DictTabInfo.hpp
+16
-4
ndb/include/ndbapi/NdbDictionary.hpp
ndb/include/ndbapi/NdbDictionary.hpp
+7
-6
ndb/include/util/NdbSqlUtil.hpp
ndb/include/util/NdbSqlUtil.hpp
+10
-3
ndb/src/common/util/NdbSqlUtil.cpp
ndb/src/common/util/NdbSqlUtil.cpp
+80
-34
ndb/src/ndbapi/NdbDictionary.cpp
ndb/src/ndbapi/NdbDictionary.cpp
+5
-2
ndb/src/ndbapi/NdbDictionaryImpl.cpp
ndb/src/ndbapi/NdbDictionaryImpl.cpp
+4
-2
ndb/src/ndbapi/NdbRecAttr.cpp
ndb/src/ndbapi/NdbRecAttr.cpp
+14
-1
ndb/test/include/NdbSchemaOp.hpp
ndb/test/include/NdbSchemaOp.hpp
+2
-1
ndb/tools/restore/consumer.cpp
ndb/tools/restore/consumer.cpp
+4
-1
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+27
-7
sql/sql_delete.cc
sql/sql_delete.cc
+1
-0
No files found.
include/config-win.h
View file @
caa3b1c1
...
@@ -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 "W
IN2000"
#define SYSTEM_TYPE "W
in32"
#else
#else
#define SYSTEM_TYPE "Win
95/Win98
"
#define SYSTEM_TYPE "Win
dows
"
#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
...
...
mysql-test/r/delete.result
View file @
caa3b1c1
...
@@ -163,3 +163,12 @@ select * from t1;
...
@@ -163,3 +163,12 @@ select * from t1;
a b
a b
7 7
7 7
drop table t1;
drop table t1;
CREATE TABLE t1 ( a int PRIMARY KEY );
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
INSERT INTO t1 VALUES (0),(1),(2);
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
SELECT * FROM t1;
a
0
2
DROP TABLE t1;
mysql-test/r/ndb_index_ordered.result
View file @
caa3b1c1
...
@@ -445,6 +445,89 @@ select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59';
...
@@ -445,6 +445,89 @@ select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59';
count(*)-9
count(*)-9
0
0
drop table t1;
drop table t1;
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;
count(*)- 5
0
select count(*)- 7 from t1 use index (s) where s <= -000000000007;
count(*)- 7
0
select count(*)- 2 from t1 use index (s) where s = -000000000007;
count(*)- 2
0
select count(*)- 5 from t1 use index (s) where s >= -000000000007;
count(*)- 5
0
select count(*)- 3 from t1 use index (s) where s > -000000000007;
count(*)- 3
0
select count(*)- 4 from t1 use index (t) where t < -0000061.00003;
count(*)- 4
0
select count(*)- 5 from t1 use index (t) where t <= -0000061.00003;
count(*)- 5
0
select count(*)- 1 from t1 use index (t) where t = -0000061.00003;
count(*)- 1
0
select count(*)- 6 from t1 use index (t) where t >= -0000061.00003;
count(*)- 6
0
select count(*)- 5 from t1 use index (t) where t > -0000061.00003;
count(*)- 5
0
select count(*)- 2 from t1 use index (u) where u < 000000000061;
count(*)- 2
0
select count(*)- 4 from t1 use index (u) where u <= 000000000061;
count(*)- 4
0
select count(*)- 2 from t1 use index (u) where u = 000000000061;
count(*)- 2
0
select count(*)- 8 from t1 use index (u) where u >= 000000000061;
count(*)- 8
0
select count(*)- 6 from t1 use index (u) where u > 000000000061;
count(*)- 6
0
select count(*)- 5 from t1 use index (v) where v < 0000965.00042;
count(*)- 5
0
select count(*)- 6 from t1 use index (v) where v <= 0000965.00042;
count(*)- 6
0
select count(*)- 1 from t1 use index (v) where v = 0000965.00042;
count(*)- 1
0
select count(*)- 5 from t1 use index (v) where v >= 0000965.00042;
count(*)- 5
0
select count(*)- 4 from t1 use index (v) where v > 0000965.00042;
count(*)- 4
0
drop table t1;
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);
set autocommit=0;
set autocommit=0;
...
...
mysql-test/t/delete.test
View file @
caa3b1c1
...
@@ -141,3 +141,14 @@ delete t1 from t1 where a = 3;
...
@@ -141,3 +141,14 @@ delete t1 from t1 where a = 3;
check
table
t1
;
check
table
t1
;
select
*
from
t1
;
select
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
#
# Bug #8392: delete with ORDER BY containing a direct reference to the table
#
CREATE
TABLE
t1
(
a
int
PRIMARY
KEY
);
DELETE
FROM
t1
WHERE
t1
.
a
>
0
ORDER
BY
t1
.
a
;
INSERT
INTO
t1
VALUES
(
0
),(
1
),(
2
);
DELETE
FROM
t1
WHERE
t1
.
a
>
0
ORDER
BY
t1
.
a
LIMIT
1
;
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
mysql-test/t/ndb_index_ordered.test
View file @
caa3b1c1
...
@@ -249,6 +249,58 @@ select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59';
...
@@ -249,6 +249,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
,
-
00000006
8391
,
-
0346486.00000
,
000000005071
,
0005334.00002
),
(
5
,
-
521579890459
,
-
1936874.00001
,
000000000154
,
0000003.00018
),
(
6
,
-
521579890459
,
-
1936874.00018
,
000000000154
,
0000003.00001
),
(
7
,
000000000333
,
0000051.39140
,
000000
907958
,
0788643.08374
),
(
8
,
00004273122
9
,
0000009.00000
,
00000000000
9
,
6428667.00000
),
(
9
,
-
00000
8159769
,
0000918.00004
,
0000
96951421
,
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
);
...
...
mysql-test/t/rpl_multi_query.test
View file @
caa3b1c1
...
@@ -3,6 +3,9 @@
...
@@ -3,6 +3,9 @@
# CLIENT_MULTI_STATEMENTS) will be binlogged ONE-query-per-event (not
# CLIENT_MULTI_STATEMENTS) will be binlogged ONE-query-per-event (not
# one binlog event containing all queries)
# one binlog event containing all queries)
# PS doesn't support multi-statements
--
disable_ps_protocol
source
include
/
master
-
slave
.
inc
;
source
include
/
master
-
slave
.
inc
;
--
disable_warnings
--
disable_warnings
drop
database
if
exists
mysqltest
;
drop
database
if
exists
mysqltest
;
...
...
ndb/include/kernel/signaldata/DictTabInfo.hpp
View file @
caa3b1c1
...
@@ -302,7 +302,8 @@ public:
...
@@ -302,7 +302,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
,
...
@@ -411,9 +412,20 @@ public:
...
@@ -411,9 +412,20 @@ public:
AttributeSize
=
DictTabInfo
::
a64Bit
;
AttributeSize
=
DictTabInfo
::
a64Bit
;
AttributeArraySize
=
AttributeExtLength
;
AttributeArraySize
=
AttributeExtLength
;
return
true
;
return
true
;
case
DictTabInfo
:
:
ExtDecimal
:
case
DictTabInfo
:
:
ExtOlddecimal
:
// not yet implemented anywhere
AttributeType
=
DictTabInfo
::
StringType
;
break
;
AttributeSize
=
DictTabInfo
::
an8Bit
;
AttributeArraySize
=
(
1
+
AttributeExtPrecision
+
(
int
(
AttributeExtScale
)
>
0
))
*
AttributeExtLength
;
return
true
;
case
DictTabInfo
:
:
ExtOlddecimalunsigned
:
AttributeType
=
DictTabInfo
::
StringType
;
AttributeSize
=
DictTabInfo
::
an8Bit
;
AttributeArraySize
=
(
0
+
AttributeExtPrecision
+
(
int
(
AttributeExtScale
)
>
0
))
*
AttributeExtLength
;
return
true
;
case
DictTabInfo
:
:
ExtChar
:
case
DictTabInfo
:
:
ExtChar
:
case
DictTabInfo
:
:
ExtBinary
:
case
DictTabInfo
:
:
ExtBinary
:
AttributeType
=
DictTabInfo
::
StringType
;
AttributeType
=
DictTabInfo
::
StringType
;
...
...
ndb/include/ndbapi/NdbDictionary.hpp
View file @
caa3b1c1
...
@@ -179,7 +179,7 @@ public:
...
@@ -179,7 +179,7 @@ public:
Bigunsigned
,
///< 64 Bit. 8 byte signed integer, can be used in array
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
,
///< 32-bit float. 4 bytes float, can be used in array
Double
,
///< 64-bit float. 8 byte float, can be used in array
Double
,
///< 64-bit float. 8 byte float, can be used in array
Decimal
,
///< Precision, Scale are applicab
le
Olddecimal
,
///< MySQL < 5.0 signed decimal, Precision, Sca
le
Char
,
///< Len. A fixed array of 1-byte chars
Char
,
///< Len. A fixed array of 1-byte chars
Varchar
,
///< Max len
Varchar
,
///< Max len
Binary
,
///< Len
Binary
,
///< Len
...
@@ -190,7 +190,8 @@ public:
...
@@ -190,7 +190,8 @@ public:
Text
,
///< Text blob
Text
,
///< Text blob
Time
=
25
,
///< Time without date
Time
=
25
,
///< Time without date
Year
=
26
,
///< Year 1901-2155 (1 byte)
Year
=
26
,
///< Year 1901-2155 (1 byte)
Timestamp
=
27
///< Unix time
Timestamp
=
27
,
///< Unix time
Olddecimalunsigned
=
28
};
};
/**
/**
...
@@ -276,25 +277,25 @@ public:
...
@@ -276,25 +277,25 @@ 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
);
/**
/**
* 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
;
/**
/**
* 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
);
/**
/**
* 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
;
...
...
ndb/include/util/NdbSqlUtil.hpp
View file @
caa3b1c1
...
@@ -75,7 +75,7 @@ public:
...
@@ -75,7 +75,7 @@ public:
Bigunsigned
,
// 64 Bit
Bigunsigned
,
// 64 Bit
Float
,
// 32-bit float
Float
,
// 32-bit float
Double
,
// 64-bit float
Double
,
// 64-bit float
Decimal
,
// Precision, Scale
Olddecimal
,
// Precision, Scale
Char
,
// Len
Char
,
// Len
Varchar
,
// Max len
Varchar
,
// Max len
Binary
,
// Len
Binary
,
// Len
...
@@ -86,7 +86,8 @@ public:
...
@@ -86,7 +86,8 @@ public:
Text
,
// Text blob
Text
,
// Text blob
Time
=
25
,
// Time without date
Time
=
25
,
// Time without date
Year
=
26
,
// Year (size 1 byte)
Year
=
26
,
// Year (size 1 byte)
Timestamp
=
27
// Unix seconds (uint32)
Timestamp
=
27
,
// Unix seconds (uint32)
Olddecimalunsigned
=
28
};
};
Enum
m_typeId
;
Enum
m_typeId
;
Cmp
*
m_cmp
;
// comparison method
Cmp
*
m_cmp
;
// comparison method
...
@@ -109,6 +110,11 @@ public:
...
@@ -109,6 +110,11 @@ public:
static
bool
usable_in_hash_index
(
Uint32
typeId
,
const
void
*
cs
);
static
bool
usable_in_hash_index
(
Uint32
typeId
,
const
void
*
cs
);
static
bool
usable_in_ordered_index
(
Uint32
typeId
,
const
void
*
cs
);
static
bool
usable_in_ordered_index
(
Uint32
typeId
,
const
void
*
cs
);
/**
* 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.
...
@@ -129,7 +135,7 @@ private:
...
@@ -129,7 +135,7 @@ private:
static
Cmp
cmpBigunsigned
;
static
Cmp
cmpBigunsigned
;
static
Cmp
cmpFloat
;
static
Cmp
cmpFloat
;
static
Cmp
cmpDouble
;
static
Cmp
cmpDouble
;
static
Cmp
cmp
D
ecimal
;
static
Cmp
cmp
Oldd
ecimal
;
static
Cmp
cmpChar
;
static
Cmp
cmpChar
;
static
Cmp
cmpVarchar
;
static
Cmp
cmpVarchar
;
static
Cmp
cmpBinary
;
static
Cmp
cmpBinary
;
...
@@ -141,6 +147,7 @@ private:
...
@@ -141,6 +147,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
ndb/src/common/util/NdbSqlUtil.cpp
View file @
caa3b1c1
...
@@ -76,117 +76,121 @@ NdbSqlUtil::char_like(const char* s1, unsigned n1,
...
@@ -76,117 +76,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
::
D
ecimal
,
Type
::
Oldd
ecimal
,
NULL
// cmpD
ecimal
cmpOldd
ecimal
},
},
{
{
// 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
,
cmpBlob
cmpBlob
},
},
{
{
// 21
Type
::
Text
,
Type
::
Text
,
cmpText
cmpText
},
},
{
{
// 22
Type
::
Undefined
,
// 5.0 Bit
Type
::
Undefined
,
// 5.0 Bit
NULL
NULL
},
},
{
{
// 23
Type
::
Undefined
,
// 5.0 Longvarchar
Type
::
Undefined
,
// 5.0 Longvarchar
NULL
NULL
},
},
{
{
// 24
Type
::
Undefined
,
// 5.0 Longvarbinary
Type
::
Undefined
,
// 5.0 Longvarbinary
NULL
NULL
},
},
{
{
// 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
}
}
};
};
...
@@ -411,14 +415,56 @@ NdbSqlUtil::cmpDouble(const void* info, const Uint32* p1, const Uint32* p2, Uint
...
@@ -411,14 +415,56 @@ NdbSqlUtil::cmpDouble(const void* info, const Uint32* p1, const Uint32* p2, Uint
}
}
int
int
NdbSqlUtil
::
cmp
Decimal
(
const
void
*
info
,
const
Uint32
*
p1
,
const
Uint32
*
p2
,
Uint32
full
,
Uint32
size
)
NdbSqlUtil
::
cmp
_olddecimal
(
const
uchar
*
s1
,
const
uchar
*
s2
,
unsigned
n
)
{
{
assert
(
full
>=
size
&&
size
>
0
);
int
sgn
=
+
1
;
// not used by MySQL or NDB
unsigned
i
=
0
;
assert
(
false
);
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
Uint32
*
p1
,
const
Uint32
*
p2
,
Uint32
full
,
Uint32
size
)
{
assert
(
full
>=
size
&&
size
>
0
);
if
(
full
==
size
)
{
union
{
const
Uint32
*
p
;
const
uchar
*
v
;
}
u1
,
u2
;
u1
.
p
=
p1
;
u2
.
p
=
p2
;
return
cmp_olddecimal
(
u1
.
v
,
u2
.
v
,
full
<<
2
);
}
return
CmpUnknown
;
}
int
NdbSqlUtil
::
cmpOlddecimalunsigned
(
const
void
*
info
,
const
Uint32
*
p1
,
const
Uint32
*
p2
,
Uint32
full
,
Uint32
size
)
{
assert
(
full
>=
size
&&
size
>
0
);
if
(
full
==
size
)
{
union
{
const
Uint32
*
p
;
const
uchar
*
v
;
}
u1
,
u2
;
u1
.
p
=
p1
;
u2
.
p
=
p2
;
return
cmp_olddecimal
(
u1
.
v
,
u2
.
v
,
full
<<
2
);
}
return
CmpUnknown
;
}
int
int
NdbSqlUtil
::
cmpChar
(
const
void
*
info
,
const
Uint32
*
p1
,
const
Uint32
*
p2
,
Uint32
full
,
Uint32
size
)
NdbSqlUtil
::
cmpChar
(
const
void
*
info
,
const
Uint32
*
p1
,
const
Uint32
*
p2
,
Uint32
full
,
Uint32
size
)
{
{
...
...
ndb/src/ndbapi/NdbDictionary.cpp
View file @
caa3b1c1
...
@@ -918,8 +918,11 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col)
...
@@ -918,8 +918,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
<<
")"
;
...
...
ndb/src/ndbapi/NdbDictionaryImpl.cpp
View file @
caa3b1c1
...
@@ -114,7 +114,8 @@ NdbColumnImpl::init(Type t)
...
@@ -114,7 +114,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
;
...
@@ -1176,7 +1177,8 @@ columnTypeMapping[] = {
...
@@ -1176,7 +1177,8 @@ columnTypeMapping[] = {
{
DictTabInfo
::
ExtBigunsigned
,
NdbDictionary
::
Column
::
Bigunsigned
},
{
DictTabInfo
::
ExtBigunsigned
,
NdbDictionary
::
Column
::
Bigunsigned
},
{
DictTabInfo
::
ExtFloat
,
NdbDictionary
::
Column
::
Float
},
{
DictTabInfo
::
ExtFloat
,
NdbDictionary
::
Column
::
Float
},
{
DictTabInfo
::
ExtDouble
,
NdbDictionary
::
Column
::
Double
},
{
DictTabInfo
::
ExtDouble
,
NdbDictionary
::
Column
::
Double
},
{
DictTabInfo
::
ExtDecimal
,
NdbDictionary
::
Column
::
Decimal
},
{
DictTabInfo
::
ExtOlddecimal
,
NdbDictionary
::
Column
::
Olddecimal
},
{
DictTabInfo
::
ExtOlddecimalunsigned
,
NdbDictionary
::
Column
::
Olddecimalunsigned
},
{
DictTabInfo
::
ExtChar
,
NdbDictionary
::
Column
::
Char
},
{
DictTabInfo
::
ExtChar
,
NdbDictionary
::
Column
::
Char
},
{
DictTabInfo
::
ExtVarchar
,
NdbDictionary
::
Column
::
Varchar
},
{
DictTabInfo
::
ExtVarchar
,
NdbDictionary
::
Column
::
Varchar
},
{
DictTabInfo
::
ExtBinary
,
NdbDictionary
::
Column
::
Binary
},
{
DictTabInfo
::
ExtBinary
,
NdbDictionary
::
Column
::
Binary
},
...
...
ndb/src/ndbapi/NdbRecAttr.cpp
View file @
caa3b1c1
...
@@ -156,7 +156,8 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
...
@@ -156,7 +156,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
<<
"["
;
...
@@ -208,6 +209,18 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
...
@@ -208,6 +209,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
:
{
{
...
...
ndb/test/include/NdbSchemaOp.hpp
View file @
caa3b1c1
...
@@ -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
:
...
...
ndb/tools/restore/consumer.cpp
View file @
caa3b1c1
...
@@ -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
::
D
ecimal
:
case
NdbDictionary
:
:
Column
::
Oldd
ecimal
:
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
;
...
...
sql/ha_ndbcluster.cc
View file @
caa3b1c1
...
@@ -2276,10 +2276,14 @@ void ha_ndbcluster::print_results()
...
@@ -2276,10 +2276,14 @@ void ha_ndbcluster::print_results()
fprintf
(
DBUG_FILE
,
"Double
\t
%f"
,
value
);
fprintf
(
DBUG_FILE
,
"Double
\t
%f"
,
value
);
break
;
break
;
}
}
case
NdbDictionary
:
:
Column
::
D
ecimal
:
{
case
NdbDictionary
:
:
Column
::
Oldd
ecimal
:
{
char
*
value
=
field
->
ptr
;
char
*
value
=
field
->
ptr
;
fprintf
(
DBUG_FILE
,
"Olddecimal
\t
'%-*s'"
,
field
->
pack_length
(),
value
);
fprintf
(
DBUG_FILE
,
"Decimal
\t
'%-*s'"
,
field
->
pack_length
(),
value
);
break
;
}
case
NdbDictionary
:
:
Column
::
Olddecimalunsigned
:
{
char
*
value
=
field
->
ptr
;
fprintf
(
DBUG_FILE
,
"Olddecimalunsigned
\t
'%-*s'"
,
field
->
pack_length
(),
value
);
break
;
break
;
}
}
case
NdbDictionary
:
:
Column
::
Char
:
{
case
NdbDictionary
:
:
Column
::
Char
:
{
...
@@ -3312,10 +3316,6 @@ static int create_ndb_column(NDBCOL &col,
...
@@ -3312,10 +3316,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
);
...
@@ -3359,6 +3359,26 @@ static int create_ndb_column(NDBCOL &col,
...
@@ -3359,6 +3359,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
);
...
...
sql/sql_delete.cc
View file @
caa3b1c1
...
@@ -117,6 +117,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
...
@@ -117,6 +117,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
bzero
((
char
*
)
&
tables
,
sizeof
(
tables
));
bzero
((
char
*
)
&
tables
,
sizeof
(
tables
));
tables
.
table
=
table
;
tables
.
table
=
table
;
tables
.
alias
=
table_list
->
alias
;
table
->
sort
.
io_cache
=
(
IO_CACHE
*
)
my_malloc
(
sizeof
(
IO_CACHE
),
table
->
sort
.
io_cache
=
(
IO_CACHE
*
)
my_malloc
(
sizeof
(
IO_CACHE
),
MYF
(
MY_FAE
|
MY_ZEROFILL
));
MYF
(
MY_FAE
|
MY_ZEROFILL
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment