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
51adbae2
Commit
51adbae2
authored
Jan 09, 2005
by
pekka@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
4f829039
fe906b47
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
398 additions
and
81 deletions
+398
-81
client/completion_hash.cc
client/completion_hash.cc
+2
-1
client/mysql.cc
client/mysql.cc
+6
-3
cmd-line-utils/libedit/makelist.sh
cmd-line-utils/libedit/makelist.sh
+1
-1
cmd-line-utils/libedit/parse.c
cmd-line-utils/libedit/parse.c
+2
-1
mysql-test/r/ndb_index_ordered.result
mysql-test/r/ndb_index_ordered.result
+110
-0
mysql-test/r/type_float.result
mysql-test/r/type_float.result
+36
-0
mysql-test/r/type_float.result.es
mysql-test/r/type_float.result.es
+38
-2
mysql-test/t/ndb_index_ordered.test
mysql-test/t/ndb_index_ordered.test
+64
-0
mysql-test/t/type_float.test
mysql-test/t/type_float.test
+10
-0
ndb/include/kernel/signaldata/DictTabInfo.hpp
ndb/include/kernel/signaldata/DictTabInfo.hpp
+9
-4
ndb/include/ndb_constants.h
ndb/include/ndb_constants.h
+4
-6
ndb/include/ndbapi/NdbDictionary.hpp
ndb/include/ndbapi/NdbDictionary.hpp
+3
-2
ndb/include/util/NdbSqlUtil.hpp
ndb/include/util/NdbSqlUtil.hpp
+6
-4
ndb/src/common/util/NdbSqlUtil.cpp
ndb/src/common/util/NdbSqlUtil.cpp
+69
-8
ndb/src/ndbapi/NdbDictionary.cpp
ndb/src/ndbapi/NdbDictionary.cpp
+5
-2
ndb/src/ndbapi/NdbDictionaryImpl.cpp
ndb/src/ndbapi/NdbDictionaryImpl.cpp
+7
-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
pstack/pstack.c
pstack/pstack.c
+1
-1
scripts/mysql_fix_privilege_tables.sql
scripts/mysql_fix_privilege_tables.sql
+3
-3
sql/field.cc
sql/field.cc
+2
-34
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+14
-6
No files found.
client/completion_hash.cc
View file @
51adbae2
...
...
@@ -79,7 +79,8 @@ int completion_hash_update(HashTable *ht, char *arKey, uint nKeyLength,
if
(
!
memcmp
(
p
->
arKey
,
arKey
,
nKeyLength
))
{
entry
*
n
;
n
=
(
entry
*
)
alloc_root
(
&
ht
->
mem_root
,
sizeof
(
entry
));
if
(
!
(
n
=
(
entry
*
)
alloc_root
(
&
ht
->
mem_root
,
sizeof
(
entry
))))
return
FAILURE
;
n
->
pNext
=
p
->
pData
;
n
->
str
=
str
;
p
->
pData
=
n
;
...
...
client/mysql.cc
View file @
51adbae2
...
...
@@ -1502,7 +1502,10 @@ You can turn off this feature to get a quicker startup with -A\n\n");
if
(
!
(
field_names
[
i
]
=
(
char
**
)
alloc_root
(
&
hash_mem_root
,
sizeof
(
char
*
)
*
(
num_fields
*
2
+
1
))))
{
mysql_free_result
(
fields
);
break
;
}
field_names
[
i
][
num_fields
*
2
]
=
'\0'
;
j
=
0
;
while
((
sql_field
=
mysql_fetch_field
(
fields
)))
...
...
@@ -2077,10 +2080,10 @@ print_table_data_html(MYSQL_RES *result)
}
while
((
cur
=
mysql_fetch_row
(
result
)))
{
ulong
*
lengths
=
mysql_fetch_lengths
(
result
);
(
void
)
tee_fputs
(
"<TR>"
,
PAGER
);
for
(
uint
i
=
0
;
i
<
mysql_num_fields
(
result
);
i
++
)
{
ulong
*
lengths
=
mysql_fetch_lengths
(
result
);
(
void
)
tee_fputs
(
"<TD>"
,
PAGER
);
safe_put_field
(
cur
[
i
],
lengths
[
i
]);
(
void
)
tee_fputs
(
"</TD>"
,
PAGER
);
...
...
@@ -2106,10 +2109,10 @@ print_table_data_xml(MYSQL_RES *result)
fields
=
mysql_fetch_fields
(
result
);
while
((
cur
=
mysql_fetch_row
(
result
)))
{
ulong
*
lengths
=
mysql_fetch_lengths
(
result
);
(
void
)
tee_fputs
(
"
\n
<row>
\n
"
,
PAGER
);
for
(
uint
i
=
0
;
i
<
mysql_num_fields
(
result
);
i
++
)
{
ulong
*
lengths
=
mysql_fetch_lengths
(
result
);
tee_fprintf
(
PAGER
,
"
\t
<%s>"
,
(
fields
[
i
].
name
?
(
fields
[
i
].
name
[
0
]
?
fields
[
i
].
name
:
" "
)
:
"NULL"
));
...
...
cmd-line-utils/libedit/makelist.sh
View file @
51adbae2
...
...
@@ -145,7 +145,7 @@ case $FLAG in
#
-fh
)
cat
$FILES
|
$AWK
'/el_action_t/ { print $3 }'
|
\
sort
|
tr
'[a-z]'
'[A-Z]'
|
$AWK
'
sort
|
tr
abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
$AWK
'
BEGIN {
printf("/* Automatically generated file, do not edit */\n");
printf("#ifndef _h_fcns_c\n#define _h_fcns_c\n");
...
...
cmd-line-utils/libedit/parse.c
View file @
51adbae2
...
...
@@ -87,7 +87,8 @@ parse_line(EditLine *el, const char *line)
int
argc
;
Tokenizer
*
tok
;
tok
=
tok_init
(
NULL
);
if
(
!
(
tok
=
tok_init
(
NULL
)))
return
-
1
;
tok_line
(
tok
,
line
,
&
argc
,
&
argv
);
argc
=
el_parse
(
el
,
argc
,
argv
);
tok_end
(
tok
);
...
...
mysql-test/r/ndb_index_ordered.result
View file @
51adbae2
...
...
@@ -419,3 +419,113 @@ SubscrID SbclID
3 NULL
drop table test1;
drop table test2;
create table t1 (
pk int primary key,
dt datetime not null,
da date not null,
ye year not null,
ti time not null,
ts timestamp not null,
index(dt),
index(da),
index(ye),
index(ti),
index(ts)
) engine=ndb;
insert into t1 (pk,dt,da,ye,ti) values
(1, '1901-05-05 23:00:59', '1901-05-05', '1901', '23:00:59'),
(2, '1912-09-05 13:00:59', '1912-09-05', '1912', '13:00:59'),
(3, '1945-12-31 00:00:00', '1945-12-31', '1945', '00:00:00'),
(4, '1955-12-31 00:00:00', '1955-12-31', '1955', '00:00:00'),
(5, '1963-06-06 06:06:06', '1963-06-06', '1963', '06:06:06'),
(6, '1993-06-06 06:06:06', '1993-06-06', '1993', '06:06:06'),
(7, '2001-01-01 10:11:10', '2001-01-01', '2001', '10:11:10'),
(8, '2001-01-01 10:11:11', '2001-01-01', '2001', '10:11:11'),
(9, '2005-01-31 23:59:59', '2005-01-31', '2005', '23:59:59');
select count(*)-9 from t1 use index (dt) where dt > '1900-01-01 00:00:00';
count(*)-9
0
select count(*)-6 from t1 use index (dt) where dt >= '1955-12-31 00:00:00';
count(*)-6
0
select count(*)-5 from t1 use index (dt) where dt > '1955-12-31 00:00:00';
count(*)-5
0
select count(*)-5 from t1 use index (dt) where dt < '1970-03-03 22:22:22';
count(*)-5
0
select count(*)-7 from t1 use index (dt) where dt < '2001-01-01 10:11:11';
count(*)-7
0
select count(*)-8 from t1 use index (dt) where dt <= '2001-01-01 10:11:11';
count(*)-8
0
select count(*)-9 from t1 use index (dt) where dt <= '2055-01-01 00:00:00';
count(*)-9
0
select count(*)-9 from t1 use index (da) where da > '1900-01-01';
count(*)-9
0
select count(*)-6 from t1 use index (da) where da >= '1955-12-31';
count(*)-6
0
select count(*)-5 from t1 use index (da) where da > '1955-12-31';
count(*)-5
0
select count(*)-5 from t1 use index (da) where da < '1970-03-03';
count(*)-5
0
select count(*)-6 from t1 use index (da) where da < '2001-01-01';
count(*)-6
0
select count(*)-8 from t1 use index (da) where da <= '2001-01-02';
count(*)-8
0
select count(*)-9 from t1 use index (da) where da <= '2055-01-01';
count(*)-9
0
select count(*)-9 from t1 use index (ye) where ye > '1900';
count(*)-9
0
select count(*)-6 from t1 use index (ye) where ye >= '1955';
count(*)-6
0
select count(*)-5 from t1 use index (ye) where ye > '1955';
count(*)-5
0
select count(*)-5 from t1 use index (ye) where ye < '1970';
count(*)-5
0
select count(*)-6 from t1 use index (ye) where ye < '2001';
count(*)-6
0
select count(*)-8 from t1 use index (ye) where ye <= '2001';
count(*)-8
0
select count(*)-9 from t1 use index (ye) where ye <= '2055';
count(*)-9
0
select count(*)-9 from t1 use index (ti) where ti >= '00:00:00';
count(*)-9
0
select count(*)-7 from t1 use index (ti) where ti > '00:00:00';
count(*)-7
0
select count(*)-7 from t1 use index (ti) where ti > '05:05:05';
count(*)-7
0
select count(*)-5 from t1 use index (ti) where ti > '06:06:06';
count(*)-5
0
select count(*)-5 from t1 use index (ti) where ti < '10:11:11';
count(*)-5
0
select count(*)-6 from t1 use index (ti) where ti <= '10:11:11';
count(*)-6
0
select count(*)-8 from t1 use index (ti) where ti < '23:59:59';
count(*)-8
0
select count(*)-9 from t1 use index (ti) where ti <= '23:59:59';
count(*)-9
0
mysql-test/r/type_float.result
View file @
51adbae2
...
...
@@ -143,3 +143,39 @@ drop table t1;
create table t1 (f float(54));
ERROR 42000: Incorrect column specifier for column 'f'
drop table if exists t1;
create table t1 (f float(4,3));
insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
Warnings:
Warning 1264 Out of range value adjusted for column 'f' at row 1
Warning 1264 Out of range value adjusted for column 'f' at row 2
Warning 1264 Out of range value adjusted for column 'f' at row 3
Warning 1264 Out of range value adjusted for column 'f' at row 4
Warning 1264 Out of range value adjusted for column 'f' at row 5
Warning 1264 Out of range value adjusted for column 'f' at row 6
select * from t1;
f
-9.999
-9.999
-9.999
9.999
9.999
9.999
drop table if exists t1;
create table t1 (f double(4,3));
insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
Warnings:
Warning 1264 Out of range value adjusted for column 'f' at row 1
Warning 1264 Out of range value adjusted for column 'f' at row 2
Warning 1264 Out of range value adjusted for column 'f' at row 3
Warning 1264 Out of range value adjusted for column 'f' at row 4
Warning 1264 Out of range value adjusted for column 'f' at row 5
Warning 1264 Out of range value adjusted for column 'f' at row 6
select * from t1;
f
-9.999
-9.999
-9.999
9.999
9.999
9.999
drop table if exists t1;
mysql-test/r/type_float.result.es
View file @
51adbae2
...
...
@@ -15,8 +15,8 @@ f1 float NULL YES NULL
f2 double NULL YES NULL
insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
Warnings:
Warning 1264
Data truncated; out of range
for column 'f1' at row 7
Warning 1264
Data truncated; out of range
for column 'f1' at row 8
Warning 1264
Out of range value adjusted
for column 'f1' at row 7
Warning 1264
Out of range value adjusted
for column 'f1' at row 8
insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
select * from t1;
f1 f2
...
...
@@ -143,3 +143,39 @@ drop table t1;
create table t1 (f float(54));
ERROR 42000: Incorrect column specifier for column 'f'
drop table if exists t1;
create table t1 (f float(4,3));
insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
Warnings:
Warning 1264 Out of range value adjusted for column 'f' at row 1
Warning 1264 Out of range value adjusted for column 'f' at row 2
Warning 1264 Out of range value adjusted for column 'f' at row 3
Warning 1264 Out of range value adjusted for column 'f' at row 4
Warning 1264 Out of range value adjusted for column 'f' at row 5
Warning 1264 Out of range value adjusted for column 'f' at row 6
select * from t1;
f
-9.999
-9.999
-9.999
9.999
9.999
9.999
drop table if exists t1;
create table t1 (f double(4,3));
insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
Warnings:
Warning 1264 Out of range value adjusted for column 'f' at row 1
Warning 1264 Out of range value adjusted for column 'f' at row 2
Warning 1264 Out of range value adjusted for column 'f' at row 3
Warning 1264 Out of range value adjusted for column 'f' at row 4
Warning 1264 Out of range value adjusted for column 'f' at row 5
Warning 1264 Out of range value adjusted for column 'f' at row 6
select * from t1;
f
-9.999
-9.999
-9.999
9.999
9.999
9.999
drop table if exists t1;
mysql-test/t/ndb_index_ordered.test
View file @
51adbae2
...
...
@@ -203,3 +203,67 @@ SELECT s.SubscrID,l.SbclID FROM test1 s left JOIN test2 l ON
l
.
SbcrID
=
s
.
SubscrID
WHERE
s
.
UsrID
=
224
order
by
1
,
2
;
drop
table
test1
;
drop
table
test2
;
# bug#7424 + bug#7725
create
table
t1
(
pk
int
primary
key
,
dt
datetime
not
null
,
da
date
not
null
,
ye
year
not
null
,
ti
time
not
null
,
ts
timestamp
not
null
,
index
(
dt
),
index
(
da
),
index
(
ye
),
index
(
ti
),
index
(
ts
)
)
engine
=
ndb
;
insert
into
t1
(
pk
,
dt
,
da
,
ye
,
ti
)
values
(
1
,
'1901-05-05 23:00:59'
,
'1901-05-05'
,
'1901'
,
'23:00:59'
),
(
2
,
'1912-09-05 13:00:59'
,
'1912-09-05'
,
'1912'
,
'13:00:59'
),
(
3
,
'1945-12-31 00:00:00'
,
'1945-12-31'
,
'1945'
,
'00:00:00'
),
(
4
,
'1955-12-31 00:00:00'
,
'1955-12-31'
,
'1955'
,
'00:00:00'
),
(
5
,
'1963-06-06 06:06:06'
,
'1963-06-06'
,
'1963'
,
'06:06:06'
),
(
6
,
'1993-06-06 06:06:06'
,
'1993-06-06'
,
'1993'
,
'06:06:06'
),
(
7
,
'2001-01-01 10:11:10'
,
'2001-01-01'
,
'2001'
,
'10:11:10'
),
(
8
,
'2001-01-01 10:11:11'
,
'2001-01-01'
,
'2001'
,
'10:11:11'
),
(
9
,
'2005-01-31 23:59:59'
,
'2005-01-31'
,
'2005'
,
'23:59:59'
);
# datetime
select
count
(
*
)
-
9
from
t1
use
index
(dt) where dt > '1900-01-01 00:00:00'
;
select
count
(
*
)
-
6
from
t1
use
index
(dt) where dt >= '1955-12-31 00:00:00'
;
select
count
(
*
)
-
5
from
t1
use
index
(dt) where dt > '1955-12-31 00:00:00'
;
select
count
(
*
)
-
5
from
t1
use
index
(dt) where dt < '1970-03-03 22:22:22'
;
select
count
(
*
)
-
7
from
t1
use
index
(dt) where dt < '2001-01-01 10:11:11'
;
select
count
(
*
)
-
8
from
t1
use
index
(dt) where dt <= '2001-01-01 10:11:11'
;
select
count
(
*
)
-
9
from
t1
use
index
(dt) where dt <= '2055-01-01 00:00:00'
;
# date
select
count
(
*
)
-
9
from
t1
use
index
(da) where da > '1900-01-01'
;
select
count
(
*
)
-
6
from
t1
use
index
(da) where da >= '1955-12-31'
;
select
count
(
*
)
-
5
from
t1
use
index
(da) where da > '1955-12-31'
;
select
count
(
*
)
-
5
from
t1
use
index
(da) where da < '1970-03-03'
;
select
count
(
*
)
-
6
from
t1
use
index
(da) where da < '2001-01-01'
;
select
count
(
*
)
-
8
from
t1
use
index
(da) where da <= '2001-01-02'
;
select
count
(
*
)
-
9
from
t1
use
index
(da) where da <= '2055-01-01'
;
# year
select
count
(
*
)
-
9
from
t1
use
index
(ye) where ye > '1900'
;
select
count
(
*
)
-
6
from
t1
use
index
(ye) where ye >= '1955'
;
select
count
(
*
)
-
5
from
t1
use
index
(ye) where ye > '1955'
;
select
count
(
*
)
-
5
from
t1
use
index
(ye) where ye < '1970'
;
select
count
(
*
)
-
6
from
t1
use
index
(ye) where ye < '2001'
;
select
count
(
*
)
-
8
from
t1
use
index
(ye) where ye <= '2001'
;
select
count
(
*
)
-
9
from
t1
use
index
(ye) where ye <= '2055'
;
# time
select
count
(
*
)
-
9
from
t1
use
index
(ti) where ti >= '00:00:00'
;
select
count
(
*
)
-
7
from
t1
use
index
(ti) where ti > '00:00:00'
;
select
count
(
*
)
-
7
from
t1
use
index
(ti) where ti > '05:05:05'
;
select
count
(
*
)
-
5
from
t1
use
index
(ti) where ti > '06:06:06'
;
select
count
(
*
)
-
5
from
t1
use
index
(ti) where ti < '10:11:11'
;
select
count
(
*
)
-
6
from
t1
use
index
(ti) where ti <= '10:11:11'
;
select
count
(
*
)
-
8
from
t1
use
index
(ti) where ti < '23:59:59'
;
select
count
(
*
)
-
9
from
t1
use
index
(ti) where ti <= '23:59:59'
;
mysql-test/t/type_float.test
View file @
51adbae2
...
...
@@ -93,3 +93,13 @@ create table t1 (f float(54)); # Should give an error
drop
table
if
exists
t1
;
--
enable_warnings
# Ensure that maximum values as the result of number of decimals
# being specified in table schema are enforced (Bug #7361)
create
table
t1
(
f
float
(
4
,
3
));
insert
into
t1
values
(
-
11.0
),(
-
11
),(
"-11"
),(
11.0
),(
11
),(
"11"
);
select
*
from
t1
;
drop
table
if
exists
t1
;
create
table
t1
(
f
double
(
4
,
3
));
insert
into
t1
values
(
-
11.0
),(
-
11
),(
"-11"
),(
11.0
),(
11
),(
"11"
);
select
*
from
t1
;
drop
table
if
exists
t1
;
ndb/include/kernel/signaldata/DictTabInfo.hpp
View file @
51adbae2
...
...
@@ -266,12 +266,13 @@ public:
ExtBinary
=
NdbSqlUtil
::
Type
::
Binary
,
ExtVarbinary
=
NdbSqlUtil
::
Type
::
Varbinary
,
ExtDatetime
=
NdbSqlUtil
::
Type
::
Datetime
,
Ext
Timespec
=
NdbSqlUtil
::
Type
::
Timespec
,
Ext
Date
=
NdbSqlUtil
::
Type
::
Date
,
ExtBlob
=
NdbSqlUtil
::
Type
::
Blob
,
ExtText
=
NdbSqlUtil
::
Type
::
Text
,
ExtBit
=
NdbSqlUtil
::
Type
::
Bit
,
ExtLongvarchar
=
NdbSqlUtil
::
Type
::
Longvarchar
,
ExtLongvarbinary
=
NdbSqlUtil
::
Type
::
Longvarbinary
ExtLongvarbinary
=
NdbSqlUtil
::
Type
::
Longvarbinary
,
ExtTime
=
NdbSqlUtil
::
Type
::
Time
};
// Attribute data interpretation
...
...
@@ -358,10 +359,10 @@ public:
AttributeSize
=
DictTabInfo
::
an8Bit
;
AttributeArraySize
=
8
*
AttributeExtLength
;
break
;
case
DictTabInfo
:
:
Ext
Timespec
:
case
DictTabInfo
:
:
Ext
Date
:
// to fix
AttributeSize
=
DictTabInfo
::
an8Bit
;
AttributeArraySize
=
12
*
AttributeExtLength
;
AttributeArraySize
=
3
*
AttributeExtLength
;
break
;
case
DictTabInfo
:
:
ExtBlob
:
case
DictTabInfo
:
:
ExtText
:
...
...
@@ -380,6 +381,10 @@ public:
AttributeSize
=
DictTabInfo
::
an8Bit
;
AttributeArraySize
=
AttributeExtLength
+
2
;
break
;
case
DictTabInfo
:
:
ExtTime
:
AttributeSize
=
DictTabInfo
::
an8Bit
;
AttributeArraySize
=
3
*
AttributeExtLength
;
break
;
default:
return
false
;
};
...
...
ndb/include/ndb_constants.h
View file @
51adbae2
...
...
@@ -53,17 +53,15 @@
#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_DATETIME 18
#define NDB_TYPE_
DATE 19
#define NDB_TYPE_BLOB 20
#define NDB_TYPE_TEXT 21
#define NDB_TYPE_BIT 22
#define NDB_TYPE_LONG_VARCHAR 23
#define NDB_TYPE_LONG_VARBINARY 24
#define NDB_TYPE_TIME 25
// add at next merge 4.1->5.0
// #define NDB_TYPE_TIME 25
#define NDB_TYPE_MAX 25
#define NDB_TYPE_MAX 26
#endif
ndb/include/ndbapi/NdbDictionary.hpp
View file @
51adbae2
...
...
@@ -190,12 +190,13 @@ public:
Binary
=
NDB_TYPE_BINARY
,
///< Len
Varbinary
=
NDB_TYPE_VARBINARY
,
///< Length bytes: 1, Max: 255
Datetime
=
NDB_TYPE_DATETIME
,
///< Precision down to 1 sec (sizeof(Datetime) == 8 bytes )
Timespec
=
NDB_TYPE_TIMESPEC
,
///< Precision down to 1 nsec(sizeof(Datetime) == 12
bytes )
Date
=
NDB_TYPE_DATE
,
///< Precision down to 1 day(sizeof(Date) == 4
bytes )
Blob
=
NDB_TYPE_BLOB
,
///< Binary large object (see NdbBlob)
Text
=
NDB_TYPE_TEXT
,
///< Text blob
Bit
=
NDB_TYPE_BIT
,
///< Bit, length specifies no of bits
Longvarchar
=
NDB_TYPE_LONG_VARCHAR
,
///< Length bytes: 2, little-endian
Longvarbinary
=
NDB_TYPE_LONG_VARBINARY
///< Length bytes: 2, little-endian
Longvarbinary
=
NDB_TYPE_LONG_VARBINARY
,
///< Length bytes: 2, little-endian
Time
=
NDB_TYPE_TIME
///< Time without date
};
/**
...
...
ndb/include/util/NdbSqlUtil.hpp
View file @
51adbae2
...
...
@@ -86,12 +86,13 @@ public:
Binary
=
NDB_TYPE_BINARY
,
Varbinary
=
NDB_TYPE_VARBINARY
,
Datetime
=
NDB_TYPE_DATETIME
,
Timespec
=
NDB_TYPE_TIMESPEC
,
Date
=
NDB_TYPE_DATE
,
Blob
=
NDB_TYPE_BLOB
,
Text
=
NDB_TYPE_TEXT
,
Bit
=
NDB_TYPE_BIT
,
Bit
=
NDB_TYPE_BIT
Longvarchar
=
NDB_TYPE_LONG_VARCHAR
,
Longvarbinary
=
NDB_TYPE_LONG_VARBINARY
Longvarbinary
=
NDB_TYPE_LONG_VARBINARY
,
Time
=
NDB_TYPE_TIME
};
Enum
m_typeId
;
// redundant
Cmp
*
m_cmp
;
// comparison method
...
...
@@ -153,12 +154,13 @@ private:
static
Cmp
cmpBinary
;
static
Cmp
cmpVarbinary
;
static
Cmp
cmpDatetime
;
static
Cmp
cmp
Timespec
;
static
Cmp
cmp
Date
;
static
Cmp
cmpBlob
;
static
Cmp
cmpText
;
static
Cmp
cmpBit
;
static
Cmp
cmpLongvarchar
;
static
Cmp
cmpLongvarbinary
;
static
Cmp
cmpTime
;
};
#endif
ndb/src/common/util/NdbSqlUtil.cpp
View file @
51adbae2
...
...
@@ -153,8 +153,8 @@ NdbSqlUtil::m_typeList[] = {
cmpDatetime
},
{
Type
::
Timespec
,
NULL
// cmpTimespec
Type
::
Date
,
cmpDate
},
{
Type
::
Blob
,
...
...
@@ -175,6 +175,10 @@ NdbSqlUtil::m_typeList[] = {
{
Type
::
Longvarbinary
,
cmpLongvarbinary
},
{
Type
::
Time
,
cmpTime
}
};
...
...
@@ -507,19 +511,57 @@ NdbSqlUtil::cmpVarbinary(const void* info, const void* p1, unsigned n1, const vo
return
CmpUnknown
;
}
// allowed but ordering is wrong before wl-1442 done
int
NdbSqlUtil
::
cmpDatetime
(
const
void
*
info
,
const
void
*
p1
,
unsigned
n1
,
const
void
*
p2
,
unsigned
n2
,
bool
full
)
{
return
cmpBinary
(
info
,
p1
,
n1
,
p2
,
n2
,
full
);
if
(
n2
>=
sizeof
(
Int64
))
{
Int64
v1
,
v2
;
memcpy
(
&
v1
,
p1
,
sizeof
(
Int64
));
memcpy
(
&
v2
,
p2
,
sizeof
(
Int64
));
if
(
v1
<
v2
)
return
-
1
;
if
(
v1
>
v2
)
return
+
1
;
return
0
;
}
assert
(
!
full
);
return
CmpUnknown
;
}
// not used by MySQL or NDB
int
NdbSqlUtil
::
cmp
Timespec
(
const
void
*
info
,
const
void
*
p1
,
unsigned
n1
,
const
void
*
p2
,
unsigned
n2
,
bool
full
)
NdbSqlUtil
::
cmp
Date
(
const
void
*
info
,
const
void
*
p1
,
unsigned
n1
,
const
void
*
p2
,
unsigned
n2
,
bool
full
)
{
assert
(
false
);
#ifdef ndb_date_is_4_byte_native_int
if
(
n2
>=
sizeof
(
Int32
))
{
Int32
v1
,
v2
;
memcpy
(
&
v1
,
p1
,
sizeof
(
Int32
));
memcpy
(
&
v2
,
p2
,
sizeof
(
Int32
));
if
(
v1
<
v2
)
return
-
1
;
if
(
v1
>
v2
)
return
+
1
;
return
0
;
}
assert
(
!
full
);
return
CmpUnknown
;
#else
if
(
n2
>=
4
)
{
// may access 4-th byte
const
uchar
*
v1
=
(
const
uchar
*
)
p1
;
const
uchar
*
v2
=
(
const
uchar
*
)
p2
;
// from Field_newdate::val_int
Uint64
j1
=
uint3korr
(
v1
);
Uint64
j2
=
uint3korr
(
v2
);
j1
=
(
j1
%
32L
)
+
(
j1
/
32L
%
16L
)
*
100L
+
(
j1
/
(
16L
*
32L
))
*
10000L
;
j2
=
(
j2
%
32L
)
+
(
j2
/
32L
%
16L
)
*
100L
+
(
j2
/
(
16L
*
32L
))
*
10000L
;
if
(
j1
<
j2
)
return
-
1
;
if
(
j1
>
j2
)
return
+
1
;
return
0
;
}
assert
(
!
full
);
return
CmpUnknown
;
#endif
}
// not supported
...
...
@@ -538,6 +580,25 @@ NdbSqlUtil::cmpText(const void* info, const void* p1, unsigned n1, const void* p
return
0
;
}
int
NdbSqlUtil
::
cmpTime
(
const
void
*
info
,
const
void
*
p1
,
unsigned
n1
,
const
void
*
p2
,
unsigned
n2
,
bool
full
)
{
if
(
n2
>=
4
)
{
// may access 4-th byte
const
uchar
*
v1
=
(
const
uchar
*
)
p1
;
const
uchar
*
v2
=
(
const
uchar
*
)
p2
;
// from Field_time::val_int
Int32
j1
=
sint3korr
(
v1
);
Int32
j2
=
sint3korr
(
v2
);
if
(
j1
<
j2
)
return
-
1
;
if
(
j1
>
j2
)
return
+
1
;
return
0
;
}
assert
(
!
full
);
return
CmpUnknown
;
}
// not yet
int
NdbSqlUtil
::
cmpBit
(
const
void
*
info
,
const
void
*
p1
,
unsigned
n1
,
const
void
*
p2
,
unsigned
n2
,
bool
full
)
...
...
ndb/src/ndbapi/NdbDictionary.cpp
View file @
51adbae2
...
...
@@ -956,8 +956,8 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col)
case
NdbDictionary
:
:
Column
::
Datetime
:
out
<<
"Datetime"
;
break
;
case
NdbDictionary
:
:
Column
::
Timespec
:
out
<<
"
Timespec
"
;
case
NdbDictionary
:
:
Column
::
Date
:
out
<<
"
Date
"
;
break
;
case
NdbDictionary
:
:
Column
::
Blob
:
out
<<
"Blob("
<<
col
.
getInlineSize
()
<<
","
<<
col
.
getPartSize
()
...
...
@@ -967,6 +967,9 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col)
out
<<
"Text("
<<
col
.
getInlineSize
()
<<
","
<<
col
.
getPartSize
()
<<
";"
<<
col
.
getStripeSize
()
<<
";"
<<
csname
<<
")"
;
break
;
case
NdbDictionary
:
:
Column
::
Time
:
out
<<
"Time"
;
break
;
case
NdbDictionary
:
:
Column
::
Undefined
:
out
<<
"Undefined"
;
break
;
...
...
ndb/src/ndbapi/NdbDictionaryImpl.cpp
View file @
51adbae2
...
...
@@ -125,7 +125,7 @@ NdbColumnImpl::init(Type t)
case
Binary
:
case
Varbinary
:
case
Datetime
:
case
Timespec
:
case
Date
:
m_precision
=
0
;
m_scale
=
0
;
m_length
=
1
;
...
...
@@ -143,6 +143,12 @@ NdbColumnImpl::init(Type t)
m_length
=
4
;
m_cs
=
default_cs
;
break
;
case
Time
:
m_precision
=
0
;
m_scale
=
0
;
m_length
=
1
;
m_cs
=
NULL
;
break
;
case
Bit
:
m_precision
=
0
;
m_scale
=
0
;
...
...
ndb/test/include/NdbSchemaOp.hpp
View file @
51adbae2
...
...
@@ -576,7 +576,8 @@ convertColumnTypeToAttrType(NdbDictionary::Column::Type _type)
case
NdbDictionary
:
:
Column
::
Varbinary
:
return
String
;
case
NdbDictionary
:
:
Column
::
Datetime
:
case
NdbDictionary
:
:
Column
::
Timespec
:
case
NdbDictionary
:
:
Column
::
Date
:
case
NdbDictionary
:
:
Column
::
Time
:
case
NdbDictionary
:
:
Column
::
Undefined
:
default:
return
NoAttrTypeDef
;
...
...
ndb/tools/restore/consumer.cpp
View file @
51adbae2
...
...
@@ -71,7 +71,10 @@ BackupConsumer::create_table_string(const TableS & table,
case
NdbDictionary
:
:
Column
::
Datetime
:
pos
+=
sprintf
(
buf
+
pos
,
"%s"
,
"datetime"
);
break
;
case
NdbDictionary
:
:
Column
::
Timespec
:
case
NdbDictionary
:
:
Column
::
Date
:
pos
+=
sprintf
(
buf
+
pos
,
"%s"
,
"date"
);
break
;
case
NdbDictionary
:
:
Column
::
Time
:
pos
+=
sprintf
(
buf
+
pos
,
"%s"
,
"time"
);
break
;
case
NdbDictionary
:
:
Column
::
Undefined
:
...
...
pstack/pstack.c
View file @
51adbae2
...
...
@@ -1663,7 +1663,7 @@ pr_tag_type (p, name, id, kind)
{
struct
pr_handle
*
info
=
(
struct
pr_handle
*
)
p
;
const
char
*
t
,
*
tag
;
char
idbuf
[
2
0
];
char
idbuf
[
3
0
];
switch
(
kind
)
{
...
...
scripts/mysql_fix_privilege_tables.sql
View file @
51adbae2
...
...
@@ -93,10 +93,10 @@ CREATE TABLE IF NOT EXISTS tables_priv (
CREATE
TABLE
IF
NOT
EXISTS
columns_priv
(
Host
char
(
60
)
DEFAULT
''
NOT
NULL
,
Db
char
(
6
0
)
DEFAULT
''
NOT
NULL
,
Db
char
(
6
4
)
DEFAULT
''
NOT
NULL
,
User
char
(
16
)
DEFAULT
''
NOT
NULL
,
Table_name
char
(
6
0
)
DEFAULT
''
NOT
NULL
,
Column_name
char
(
59
)
DEFAULT
''
NOT
NULL
,
Table_name
char
(
6
4
)
DEFAULT
''
NOT
NULL
,
Column_name
char
(
64
)
DEFAULT
''
NOT
NULL
,
Timestamp
timestamp
(
14
),
Column_priv
set
(
'Select'
,
'Insert'
,
'Update'
,
'References'
)
DEFAULT
''
NOT
NULL
,
PRIMARY
KEY
(
Host
,
Db
,
User
,
Table_name
,
Column_name
)
...
...
sql/field.cc
View file @
51adbae2
...
...
@@ -2440,23 +2440,7 @@ int Field_float::store(double nr)
int
Field_float
::
store
(
longlong
nr
)
{
int
error
=
0
;
float
j
=
(
float
)
nr
;
if
(
unsigned_flag
&&
j
<
0
)
{
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
,
1
);
j
=
0
;
error
=
1
;
}
#ifdef WORDS_BIGENDIAN
if
(
table
->
db_low_byte_first
)
{
float4store
(
ptr
,
j
);
}
else
#endif
memcpy_fixed
(
ptr
,(
byte
*
)
&
j
,
sizeof
(
j
));
return
error
;
return
store
((
double
)
nr
);
}
...
...
@@ -2738,23 +2722,7 @@ int Field_double::store(double nr)
int
Field_double
::
store
(
longlong
nr
)
{
double
j
=
(
double
)
nr
;
int
error
=
0
;
if
(
unsigned_flag
&&
j
<
0
)
{
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
,
1
);
error
=
1
;
j
=
0
;
}
#ifdef WORDS_BIGENDIAN
if
(
table
->
db_low_byte_first
)
{
float8store
(
ptr
,
j
);
}
else
#endif
doublestore
(
ptr
,
j
);
return
error
;
return
store
((
double
)
nr
);
}
...
...
sql/ha_ndbcluster.cc
View file @
51adbae2
...
...
@@ -2393,13 +2393,15 @@ void ha_ndbcluster::print_results()
break
;
}
case
NdbDictionary
:
:
Column
::
Datetime
:
{
// todo
my_snprintf
(
buf
,
sizeof
(
buf
),
"Datetime ?"
);
my_snprintf
(
buf
,
sizeof
(
buf
),
"Datetime ?"
);
// fix-me
break
;
}
case
NdbDictionary
:
:
Column
::
Timespec
:
{
// todo
my_snprintf
(
buf
,
sizeof
(
buf
),
"Timespec ?"
);
case
NdbDictionary
:
:
Column
::
Date
:
{
my_snprintf
(
buf
,
sizeof
(
buf
),
"Date ?"
);
// fix-me
break
;
}
case
NdbDictionary
:
:
Column
::
Time
:
{
my_snprintf
(
buf
,
sizeof
(
buf
),
"Time ?"
);
// fix-me
break
;
}
case
NdbDictionary
:
:
Column
::
Blob
:
{
...
...
@@ -3498,9 +3500,15 @@ static int create_ndb_column(NDBCOL &col,
col
.
setType
(
NDBCOL
::
Datetime
);
col
.
setLength
(
1
);
break
;
case
MYSQL_TYPE_DATE
:
case
MYSQL_TYPE_NEWDATE
:
col
.
setType
(
NDBCOL
::
Date
);
col
.
setLength
(
1
);
break
;
case
MYSQL_TYPE_TIME
:
col
.
setType
(
NDBCOL
::
Time
);
col
.
setLength
(
1
);
break
;
case
MYSQL_TYPE_DATE
:
// ?
case
MYSQL_TYPE_YEAR
:
col
.
setType
(
NDBCOL
::
Char
);
col
.
setLength
(
field
->
pack_length
());
...
...
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