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
3f73d25f
Commit
3f73d25f
authored
Oct 07, 2005
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1
parents
ae62a588
82855517
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
44 deletions
+49
-44
myisam/mi_rkey.c
myisam/mi_rkey.c
+2
-2
myisam/mi_search.c
myisam/mi_search.c
+25
-20
mysql-test/r/select.result
mysql-test/r/select.result
+7
-0
mysql-test/t/select.test
mysql-test/t/select.test
+4
-0
sql/item.cc
sql/item.cc
+11
-22
No files found.
myisam/mi_rkey.c
View file @
3f73d25f
...
@@ -31,8 +31,8 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
...
@@ -31,8 +31,8 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
HA_KEYSEG
*
last_used_keyseg
;
HA_KEYSEG
*
last_used_keyseg
;
uint
pack_key_length
,
use_key_length
,
nextflag
;
uint
pack_key_length
,
use_key_length
,
nextflag
;
DBUG_ENTER
(
"mi_rkey"
);
DBUG_ENTER
(
"mi_rkey"
);
DBUG_PRINT
(
"enter"
,
(
"base: %
p buf: %p
inx: %d search_flag: %d"
,
DBUG_PRINT
(
"enter"
,
(
"base: %
lx buf: %lx
inx: %d search_flag: %d"
,
info
,
buf
,
inx
,
search_flag
));
(
long
)
info
,
(
long
)
buf
,
inx
,
search_flag
));
if
((
inx
=
_mi_check_index
(
info
,
inx
))
<
0
)
if
((
inx
=
_mi_check_index
(
info
,
inx
))
<
0
)
DBUG_RETURN
(
my_errno
);
DBUG_RETURN
(
my_errno
);
...
...
myisam/mi_search.c
View file @
3f73d25f
...
@@ -257,15 +257,16 @@ int _mi_seq_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
...
@@ -257,15 +257,16 @@ int _mi_seq_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
if
(
length
==
0
||
page
>
end
)
if
(
length
==
0
||
page
>
end
)
{
{
my_errno
=
HA_ERR_CRASHED
;
my_errno
=
HA_ERR_CRASHED
;
DBUG_PRINT
(
"error"
,(
"Found wrong key: length: %u page: %
p end: %p
"
,
DBUG_PRINT
(
"error"
,(
"Found wrong key: length: %u page: %
lx end: %lx
"
,
length
,
page
,
end
));
length
,
(
long
)
page
,
(
long
)
end
));
DBUG_RETURN
(
MI_FOUND_WRONG_KEY
);
DBUG_RETURN
(
MI_FOUND_WRONG_KEY
);
}
}
if
((
flag
=
ha_key_cmp
(
keyinfo
->
seg
,
t_buff
,
key
,
key_len
,
comp_flag
,
if
((
flag
=
ha_key_cmp
(
keyinfo
->
seg
,
t_buff
,
key
,
key_len
,
comp_flag
,
&
not_used
))
>=
0
)
&
not_used
))
>=
0
)
break
;
break
;
#ifdef EXTRA_DEBUG
#ifdef EXTRA_DEBUG
DBUG_PRINT
(
"loop"
,(
"page: %p key: '%s' flag: %d"
,
page
,
t_buff
,
flag
));
DBUG_PRINT
(
"loop"
,(
"page: %lx key: '%s' flag: %d"
,
(
long
)
page
,
t_buff
,
flag
));
#endif
#endif
memcpy
(
buff
,
t_buff
,
length
);
memcpy
(
buff
,
t_buff
,
length
);
*
ret_pos
=
page
;
*
ret_pos
=
page
;
...
@@ -273,7 +274,7 @@ int _mi_seq_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
...
@@ -273,7 +274,7 @@ int _mi_seq_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
if
(
flag
==
0
)
if
(
flag
==
0
)
memcpy
(
buff
,
t_buff
,
length
);
/* Result is first key */
memcpy
(
buff
,
t_buff
,
length
);
/* Result is first key */
*
last_key
=
page
==
end
;
*
last_key
=
page
==
end
;
DBUG_PRINT
(
"exit"
,(
"flag: %d ret_pos: %
p"
,
flag
,
*
ret_pos
));
DBUG_PRINT
(
"exit"
,(
"flag: %d ret_pos: %
lx"
,
flag
,
(
long
)
*
ret_pos
));
DBUG_RETURN
(
flag
);
DBUG_RETURN
(
flag
);
}
/* _mi_seq_search */
}
/* _mi_seq_search */
...
@@ -412,8 +413,8 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
...
@@ -412,8 +413,8 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
if
(
page
>
end
)
if
(
page
>
end
)
{
{
my_errno
=
HA_ERR_CRASHED
;
my_errno
=
HA_ERR_CRASHED
;
DBUG_PRINT
(
"error"
,(
"Found wrong key: length: %u page: %
p end: %p
"
,
DBUG_PRINT
(
"error"
,(
"Found wrong key: length: %u page: %
lx end: %lx
"
,
length
,
page
,
end
));
length
,
(
long
)
page
,
(
long
)
end
));
DBUG_RETURN
(
MI_FOUND_WRONG_KEY
);
DBUG_RETURN
(
MI_FOUND_WRONG_KEY
);
}
}
...
@@ -546,7 +547,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
...
@@ -546,7 +547,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
*
last_key
=
page
==
end
;
*
last_key
=
page
==
end
;
DBUG_PRINT
(
"exit"
,(
"flag: %d ret_pos: %
p"
,
flag
,
*
ret_pos
));
DBUG_PRINT
(
"exit"
,(
"flag: %d ret_pos: %
lx"
,
flag
,
(
long
)
*
ret_pos
));
DBUG_RETURN
(
flag
);
DBUG_RETURN
(
flag
);
}
/* _mi_prefix_search */
}
/* _mi_prefix_search */
...
@@ -807,8 +808,8 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
...
@@ -807,8 +808,8 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
if
(
length
>
keyseg
->
length
)
if
(
length
>
keyseg
->
length
)
{
{
DBUG_PRINT
(
"error"
,
DBUG_PRINT
(
"error"
,
(
"Found too long null packed key: %u of %u at %
p
"
,
(
"Found too long null packed key: %u of %u at %
lx
"
,
length
,
keyseg
->
length
,
*
page_pos
));
length
,
keyseg
->
length
,
(
long
)
*
page_pos
));
DBUG_DUMP
(
"key"
,(
char
*
)
*
page_pos
,
16
);
DBUG_DUMP
(
"key"
,(
char
*
)
*
page_pos
,
16
);
my_errno
=
HA_ERR_CRASHED
;
my_errno
=
HA_ERR_CRASHED
;
return
0
;
return
0
;
...
@@ -863,8 +864,8 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
...
@@ -863,8 +864,8 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
}
}
if
(
length
>
(
uint
)
keyseg
->
length
)
if
(
length
>
(
uint
)
keyseg
->
length
)
{
{
DBUG_PRINT
(
"error"
,(
"Found too long packed key: %u of %u at %
p
"
,
DBUG_PRINT
(
"error"
,(
"Found too long packed key: %u of %u at %
lx
"
,
length
,
keyseg
->
length
,
*
page_pos
));
length
,
keyseg
->
length
,
(
long
)
*
page_pos
));
DBUG_DUMP
(
"key"
,(
char
*
)
*
page_pos
,
16
);
DBUG_DUMP
(
"key"
,(
char
*
)
*
page_pos
,
16
);
my_errno
=
HA_ERR_CRASHED
;
my_errno
=
HA_ERR_CRASHED
;
return
0
;
/* Error */
return
0
;
/* Error */
...
@@ -928,8 +929,8 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
...
@@ -928,8 +929,8 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
{
{
if
(
length
>
keyinfo
->
maxlength
)
if
(
length
>
keyinfo
->
maxlength
)
{
{
DBUG_PRINT
(
"error"
,(
"Found too long binary packed key: %u of %u at %
p
"
,
DBUG_PRINT
(
"error"
,(
"Found too long binary packed key: %u of %u at %
lx
"
,
length
,
keyinfo
->
maxlength
,
*
page_pos
));
length
,
keyinfo
->
maxlength
,
(
long
)
*
page_pos
));
DBUG_DUMP
(
"key"
,(
char
*
)
*
page_pos
,
16
);
DBUG_DUMP
(
"key"
,(
char
*
)
*
page_pos
,
16
);
my_errno
=
HA_ERR_CRASHED
;
my_errno
=
HA_ERR_CRASHED
;
DBUG_RETURN
(
0
);
/* Wrong key */
DBUG_RETURN
(
0
);
/* Wrong key */
...
@@ -975,8 +976,8 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
...
@@ -975,8 +976,8 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
length
-=
tmp
;
length
-=
tmp
;
from
=
page
;
from_end
=
page_end
;
from
=
page
;
from_end
=
page_end
;
}
}
DBUG_PRINT
(
"info"
,(
"key: %
p from: %p
length: %u"
,
DBUG_PRINT
(
"info"
,(
"key: %
lx from: %lx
length: %u"
,
key
,
from
,
length
));
(
long
)
key
,
(
long
)
from
,
length
));
memcpy_overlap
((
byte
*
)
key
,
(
byte
*
)
from
,
(
size_t
)
length
);
memcpy_overlap
((
byte
*
)
key
,
(
byte
*
)
from
,
(
size_t
)
length
);
key
+=
length
;
key
+=
length
;
from
+=
length
;
from
+=
length
;
...
@@ -1031,7 +1032,8 @@ uchar *_mi_get_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
...
@@ -1031,7 +1032,8 @@ uchar *_mi_get_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
}
}
}
}
}
}
DBUG_PRINT
(
"exit"
,(
"page: %p length: %u"
,
page
,
*
return_key_length
));
DBUG_PRINT
(
"exit"
,(
"page: %lx length: %u"
,
(
long
)
page
,
*
return_key_length
));
DBUG_RETURN
(
page
);
DBUG_RETURN
(
page
);
}
/* _mi_get_key */
}
/* _mi_get_key */
...
@@ -1082,7 +1084,7 @@ uchar *_mi_get_last_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
...
@@ -1082,7 +1084,7 @@ uchar *_mi_get_last_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
uint
nod_flag
;
uint
nod_flag
;
uchar
*
lastpos
;
uchar
*
lastpos
;
DBUG_ENTER
(
"_mi_get_last_key"
);
DBUG_ENTER
(
"_mi_get_last_key"
);
DBUG_PRINT
(
"enter"
,(
"page: %
p endpos: %p"
,
page
,
endpos
));
DBUG_PRINT
(
"enter"
,(
"page: %
lx endpos: %lx"
,
(
long
)
page
,
(
long
)
endpos
));
nod_flag
=
mi_test_if_nod
(
page
);
nod_flag
=
mi_test_if_nod
(
page
);
if
(
!
(
keyinfo
->
flag
&
(
HA_VAR_LENGTH_KEY
|
HA_BINARY_PACK_KEY
)))
if
(
!
(
keyinfo
->
flag
&
(
HA_VAR_LENGTH_KEY
|
HA_BINARY_PACK_KEY
)))
...
@@ -1102,13 +1104,15 @@ uchar *_mi_get_last_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
...
@@ -1102,13 +1104,15 @@ uchar *_mi_get_last_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
*
return_key_length
=
(
*
keyinfo
->
get_key
)(
keyinfo
,
nod_flag
,
&
page
,
lastkey
);
*
return_key_length
=
(
*
keyinfo
->
get_key
)(
keyinfo
,
nod_flag
,
&
page
,
lastkey
);
if
(
*
return_key_length
==
0
)
if
(
*
return_key_length
==
0
)
{
{
DBUG_PRINT
(
"error"
,(
"Couldn't find last key: page: %p"
,
page
));
DBUG_PRINT
(
"error"
,(
"Couldn't find last key: page: %lx"
,
(
long
)
page
));
my_errno
=
HA_ERR_CRASHED
;
my_errno
=
HA_ERR_CRASHED
;
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
}
}
}
}
DBUG_PRINT
(
"exit"
,(
"lastpos: %p length: %u"
,
lastpos
,
*
return_key_length
));
DBUG_PRINT
(
"exit"
,(
"lastpos: %lx length: %u"
,
(
long
)
lastpos
,
*
return_key_length
));
DBUG_RETURN
(
lastpos
);
DBUG_RETURN
(
lastpos
);
}
/* _mi_get_last_key */
}
/* _mi_get_last_key */
...
@@ -1644,7 +1648,8 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
...
@@ -1644,7 +1648,8 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
ref_length
=
0
;
ref_length
=
0
;
next_length_pack
=
0
;
next_length_pack
=
0
;
}
}
DBUG_PRINT
(
"test"
,(
"length: %d next_key: %p"
,
length
,
next_key
));
DBUG_PRINT
(
"test"
,(
"length: %d next_key: %lx"
,
length
,
(
long
)
next_key
));
{
{
uint
tmp_length
;
uint
tmp_length
;
...
...
mysql-test/r/select.result
View file @
3f73d25f
...
@@ -2625,4 +2625,11 @@ select f1 from t1,t2 where f1=f2 and (f1,NULL) = ((1,1));
...
@@ -2625,4 +2625,11 @@ select f1 from t1,t2 where f1=f2 and (f1,NULL) = ((1,1));
f1
f1
select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,NULL));
select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,NULL));
f1
f1
insert into t1 values(1,1),(2,null);
insert into t2 values(2);
select * from t1,t2 where f1=f3 and (f1,f2) = (2,null);
f1 f2 f3
select * from t1,t2 where f1=f3 and (f1,f2) <=> (2,null);
f1 f2 f3
2 NULL 2
drop table t1,t2;
drop table t1,t2;
mysql-test/t/select.test
View file @
3f73d25f
...
@@ -2172,6 +2172,10 @@ create table t2(f3 int);
...
@@ -2172,6 +2172,10 @@ create table t2(f3 int);
select
f1
from
t1
,
t2
where
f1
=
f2
and
(
f1
,
f2
)
=
((
1
,
1
));
select
f1
from
t1
,
t2
where
f1
=
f2
and
(
f1
,
f2
)
=
((
1
,
1
));
select
f1
from
t1
,
t2
where
f1
=
f2
and
(
f1
,
NULL
)
=
((
1
,
1
));
select
f1
from
t1
,
t2
where
f1
=
f2
and
(
f1
,
NULL
)
=
((
1
,
1
));
select
f1
from
t1
,
t2
where
f1
=
f2
and
(
f1
,
f2
)
=
((
1
,
NULL
));
select
f1
from
t1
,
t2
where
f1
=
f2
and
(
f1
,
f2
)
=
((
1
,
NULL
));
insert
into
t1
values
(
1
,
1
),(
2
,
null
);
insert
into
t2
values
(
2
);
select
*
from
t1
,
t2
where
f1
=
f3
and
(
f1
,
f2
)
=
(
2
,
null
);
select
*
from
t1
,
t2
where
f1
=
f3
and
(
f1
,
f2
)
<=>
(
2
,
null
);
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
# End of 4.1 tests
# End of 4.1 tests
sql/item.cc
View file @
3f73d25f
...
@@ -2872,32 +2872,21 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
...
@@ -2872,32 +2872,21 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
}
}
else
if
(
res_type
==
ROW_RESULT
)
else
if
(
res_type
==
ROW_RESULT
)
{
{
Item_row
*
item_row
=
(
Item_row
*
)
item
;
Item_row
*
comp_item_row
=
(
Item_row
*
)
comp_item
;
uint
col
;
new_item
=
0
;
new_item
=
0
;
/*
/*
If item and comp_item are both Item_rows and have same number of cols
If item and comp_item are both Item_rows and have same number of cols
then process items in Item_row one by one. If Item_row contain nulls
then process items in Item_row one by one.
substitute it by Item_null. Otherwise just return.
We can't ignore NULL values here as this item may be used with <=>, in
which case NULL's are significant.
*/
*/
if
(
item
->
result_type
()
==
comp_item
->
result_type
()
&&
DBUG_ASSERT
(
item
->
result_type
()
==
comp_item
->
result_type
());
((
Item_row
*
)
item
)
->
cols
()
==
((
Item_row
*
)
comp_item
)
->
cols
())
DBUG_ASSERT
(
item_row
->
cols
()
==
comp_item_row
->
cols
());
{
col
=
item_row
->
cols
();
Item_row
*
item_row
=
(
Item_row
*
)
item
,
*
comp_item_row
=
(
Item_row
*
)
comp_item
;
while
(
col
--
>
0
)
if
(
item_row
->
null_inside
())
resolve_const_item
(
thd
,
item_row
->
addr
(
col
),
comp_item_row
->
el
(
col
));
new_item
=
(
Item
*
)
new
Item_null
(
name
);
else
{
int
i
=
item_row
->
cols
()
-
1
;
for
(;
i
>=
0
;
i
--
)
{
if
(
item_row
->
maybe_null
&&
item_row
->
el
(
i
)
->
is_null
())
{
new_item
=
(
Item
*
)
new
Item_null
(
name
);
break
;
}
resolve_const_item
(
thd
,
item_row
->
addr
(
i
),
comp_item_row
->
el
(
i
));
}
}
}
}
}
else
else
{
// It must REAL_RESULT
{
// It must REAL_RESULT
...
...
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