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
30d81b75
Commit
30d81b75
authored
Jun 07, 2005
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug#5373: handler READ NEXT w/o HANDLER READ [FIRST]
check table->file->inited to catch incorrect calling sequence.
parent
6a534902
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
15 deletions
+53
-15
mysql-test/r/innodb_handler.result
mysql-test/r/innodb_handler.result
+16
-0
mysql-test/t/innodb_handler.test
mysql-test/t/innodb_handler.test
+10
-0
sql/sql_handler.cc
sql/sql_handler.cc
+27
-15
No files found.
mysql-test/r/innodb_handler.result
View file @
30d81b75
...
...
@@ -132,6 +132,22 @@ a b
handler t2 read last;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
handler t2 close;
handler t1 open;
handler t1 read a next;
a b
14 aaa
handler t1 read a next;
a b
15 bbb
handler t1 close;
handler t1 open;
handler t1 read a prev;
a b
22 iii
handler t1 read a prev;
a b
21 hhh
handler t1 close;
handler t1 open as t2;
handler t2 read first;
a b
...
...
mysql-test/t/innodb_handler.test
View file @
30d81b75
...
...
@@ -69,6 +69,16 @@ handler t2 read next;
handler
t2
read
last
;
handler
t2
close
;
handler
t1
open
;
handler
t1
read
a
next
;
# this used to crash as a bug#5373
handler
t1
read
a
next
;
handler
t1
close
;
handler
t1
open
;
handler
t1
read
a
prev
;
# this used to crash as a bug#5373
handler
t1
read
a
prev
;
handler
t1
close
;
handler
t1
open
as
t2
;
handler
t2
read
first
;
alter
table
t1
engine
=
innodb
;
...
...
sql/sql_handler.cc
View file @
30d81b75
...
...
@@ -433,8 +433,6 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
cond
->
fix_fields
(
thd
,
tables
,
&
cond
))
||
cond
->
check_cols
(
1
)))
goto
err0
;
table
->
file
->
init_table_handle_for_HANDLER
();
// Only InnoDB requires it
if
(
keyname
)
{
if
((
keyno
=
find_type
(
keyname
,
&
table
->
keynames
,
1
+
2
)
-
1
)
<
0
)
...
...
@@ -443,8 +441,6 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
keyname
,
tables
->
alias
);
goto
err0
;
}
table
->
file
->
ha_index_or_rnd_end
();
table
->
file
->
ha_index_init
(
keyno
);
}
if
(
insert_fields
(
thd
,
tables
,
tables
->
db
,
tables
->
alias
,
&
it
))
...
...
@@ -471,9 +467,22 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
for
(
num_rows
=
0
;
num_rows
<
select_limit
;
)
{
switch
(
mode
)
{
case
RNEXT
:
if
(
table
->
file
->
inited
!=
handler
::
NONE
)
{
err
=
keyname
?
table
->
file
->
index_next
(
table
->
record
[
0
])
:
table
->
file
->
rnd_next
(
table
->
record
[
0
]);
break
;
}
/* else fall through */
case
RFIRST
:
if
(
keyname
)
{
table
->
file
->
ha_index_or_rnd_end
();
table
->
file
->
ha_index_init
(
keyno
);
err
=
table
->
file
->
index_first
(
table
->
record
[
0
]);
}
else
{
table
->
file
->
ha_index_or_rnd_end
();
...
...
@@ -482,20 +491,21 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
}
mode
=
RNEXT
;
break
;
case
RPREV
:
DBUG_ASSERT
(
keyname
!=
0
);
if
(
table
->
file
->
inited
!=
handler
::
NONE
)
{
err
=
table
->
file
->
index_prev
(
table
->
record
[
0
]);
break
;
}
/* else fall through */
case
RLAST
:
DBUG_ASSERT
(
keyname
!=
0
);
table
->
file
->
ha_index_or_rnd_end
();
table
->
file
->
ha_index_init
(
keyno
);
err
=
table
->
file
->
index_last
(
table
->
record
[
0
]);
mode
=
RPREV
;
break
;
case
RNEXT
:
err
=
keyname
?
table
->
file
->
index_next
(
table
->
record
[
0
])
:
table
->
file
->
rnd_next
(
table
->
record
[
0
]);
break
;
case
RPREV
:
DBUG_ASSERT
(
keyname
!=
0
);
err
=
table
->
file
->
index_prev
(
table
->
record
[
0
]);
break
;
case
RNEXT_SAME
:
/* Continue scan on "(keypart1,keypart2,...)=(c1, c2, ...) */
DBUG_ASSERT
(
keyname
!=
0
);
...
...
@@ -535,6 +545,8 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
goto
err
;
}
key_copy
(
key
,
table
,
keyno
,
key_len
);
table
->
file
->
ha_index_or_rnd_end
();
table
->
file
->
ha_index_init
(
keyno
);
err
=
table
->
file
->
index_read
(
table
->
record
[
0
],
key
,
key_len
,
ha_rkey_mode
);
mode
=
rkey_to_rnext
[(
int
)
ha_rkey_mode
];
...
...
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