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
482058be
Commit
482058be
authored
May 18, 2004
by
sergefp@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix and test case for BUG#3649.
parent
7ff94b38
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
29 deletions
+63
-29
mysql-test/r/handler.result
mysql-test/r/handler.result
+12
-0
mysql-test/t/handler.test
mysql-test/t/handler.test
+12
-0
sql/sql_handler.cc
sql/sql_handler.cc
+39
-29
No files found.
mysql-test/r/handler.result
View file @
482058be
...
...
@@ -191,3 +191,15 @@ Ok
handler t close;
use test;
drop table t1;
create table t1 ( a int, b int, INDEX a (a) );
insert into t1 values (1,2), (2,1);
handler t1 open;
handler t1 read a=(1) where b=2;
a b
1 2
handler t1 read a=(1) where b=3;
a b
handler t1 read a=(1) where b=1;
a b
handler t1 close;
drop table t1;
mysql-test/t/handler.test
View file @
482058be
...
...
@@ -123,3 +123,15 @@ handler t close;
use
test
;
drop
table
t1
;
#
# BUG#3649
#
create
table
t1
(
a
int
,
b
int
,
INDEX
a
(
a
)
);
insert
into
t1
values
(
1
,
2
),
(
2
,
1
);
handler
t1
open
;
handler
t1
read
a
=
(
1
)
where
b
=
2
;
handler
t1
read
a
=
(
1
)
where
b
=
3
;
handler
t1
read
a
=
(
1
)
where
b
=
1
;
handler
t1
close
;
drop
table
t1
;
sql/sql_handler.cc
View file @
482058be
...
...
@@ -103,7 +103,7 @@ int mysql_ha_closeall(THD *thd, TABLE_LIST *tables)
}
static
enum
enum_ha_read_modes
rkey_to_rnext
[]
=
{
R
NEXT
,
RNEXT
,
RPREV
,
RNEXT
,
RPREV
,
RNEXT
,
RPREV
};
{
R
KEY
,
RNEXT
,
RPREV
,
RNEXT
,
RPREV
,
RNEXT
,
RPREV
};
int
mysql_ha_read
(
THD
*
thd
,
TABLE_LIST
*
tables
,
...
...
@@ -151,6 +151,10 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
HANDLER_TABLES_HACK
(
thd
);
MYSQL_LOCK
*
lock
=
mysql_lock_tables
(
thd
,
&
tables
->
table
,
1
);
HANDLER_TABLES_HACK
(
thd
);
byte
*
key
=
NULL
;
uint
key_len
;
LINT_INIT
(
key_len
);
/* protected by key key variable */
if
(
!
lock
)
goto
err0
;
// mysql_lock_tables() printed error message already
...
...
@@ -184,12 +188,17 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
err
=
table
->
file
->
index_prev
(
table
->
record
[
0
]);
break
;
case
RKEY
:
{
if
(
key
)
{
/* Continue scan on "(keypart1,keypart2,...)=(c1, c2, ...) */
err
=
table
->
file
->
index_next_same
(
table
->
record
[
0
],
key
,
key_len
);
}
else
{
DBUG_ASSERT
(
keyname
!=
0
);
KEY
*
keyinfo
=
table
->
key_info
+
keyno
;
KEY_PART_INFO
*
key_part
=
keyinfo
->
key_part
;
uint
key_len
;
byte
*
key
;
if
(
key_expr
->
elements
>
keyinfo
->
key_parts
)
{
my_printf_error
(
ER_TOO_MANY_KEY_PARTS
,
ER
(
ER_TOO_MANY_KEY_PARTS
),
...
...
@@ -219,6 +228,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
err
=
table
->
file
->
index_read
(
table
->
record
[
0
],
key
,
key_len
,
ha_rkey_mode
);
mode
=
rkey_to_rnext
[(
int
)
ha_rkey_mode
];
}
break
;
}
default:
...
...
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