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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
3e37933c
Commit
3e37933c
authored
Jan 08, 2005
by
pekka@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb - wl-1442 bug#7725 datetime ordering
parent
c2eb3bf9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
14 deletions
+39
-14
mysql-test/t/ndb_index_ordered.test
mysql-test/t/ndb_index_ordered.test
+29
-0
ndb/src/common/util/NdbSqlUtil.cpp
ndb/src/common/util/NdbSqlUtil.cpp
+10
-14
No files found.
mysql-test/t/ndb_index_ordered.test
View file @
3e37933c
...
...
@@ -172,3 +172,32 @@ 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
,
'1955-12-31 00:00:00'
,
'1955-12-31'
,
'1955'
,
'00:00:00'
),
(
3
,
'1999-06-06 06:06:06'
,
'1999-06-06'
,
'1999'
,
'06:06:06'
),
(
4
,
'2001-01-01 10:11:11'
,
'2001-01-01'
,
'2001'
,
'10:11:11'
),
(
5
,
'2005-01-31 23:59:59'
,
'2005-01-31'
,
'2005'
,
'23:59:59'
);
# datetime
select
count
(
*
)
from
t1
use
index
(dt) where dt > '1900-01-01 00:00:00'
;
select
count
(
*
)
from
t1
use
index
(dt) where dt > '1955-12-31 00:00:00'
;
select
count
(
*
)
from
t1
use
index
(dt) where dt < '2001-01-01 10:11:11'
;
select
count
(
*
)
from
t1
use
index
(dt) where dt < '2001-01-01 10:11:12'
;
ndb/src/common/util/NdbSqlUtil.cpp
View file @
3e37933c
...
...
@@ -469,21 +469,17 @@ int
NdbSqlUtil
::
cmpDatetime
(
const
void
*
info
,
const
Uint32
*
p1
,
const
Uint32
*
p2
,
Uint32
full
,
Uint32
size
)
{
assert
(
full
>=
size
&&
size
>
0
);
/*
* Datetime is CC YY MM DD hh mm ss \0
*
* Not used via MySQL.
*/
union
{
const
Uint32
*
p
;
const
unsigned
char
*
v
;
}
u1
,
u2
;
u1
.
p
=
p1
;
u2
.
p
=
p2
;
// no format check
int
k
=
memcmp
(
u1
.
v
,
u2
.
v
,
4
);
if
(
k
!=
0
)
return
k
<
0
?
-
1
:
+
1
;
if
(
size
>=
2
)
{
k
=
memcmp
(
u1
.
v
+
4
,
u2
.
v
+
4
,
4
);
return
k
<
0
?
-
1
:
k
>
0
?
+
1
:
0
;
union
{
Uint32
p
[
2
];
Int64
v
;
}
u1
,
u2
;
u1
.
p
[
0
]
=
p1
[
0
];
u1
.
p
[
1
]
=
p1
[
1
];
u2
.
p
[
0
]
=
p2
[
0
];
u2
.
p
[
1
]
=
p2
[
1
];
if
(
u1
.
v
<
u2
.
v
)
return
-
1
;
if
(
u1
.
v
>
u2
.
v
)
return
+
1
;
return
0
;
}
return
CmpUnknown
;
}
...
...
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