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
8e2ff7d1
Commit
8e2ff7d1
authored
May 19, 2004
by
sergefp@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/dbdata/psergey/mysql-4.0-root
parents
b6188818
8becc506
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
16 deletions
+48
-16
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_class.h
sql/sql_class.h
+1
-1
sql/sql_handler.cc
sql/sql_handler.cc
+23
-15
No files found.
mysql-test/r/handler.result
View file @
8e2ff7d1
...
@@ -191,3 +191,15 @@ Ok
...
@@ -191,3 +191,15 @@ Ok
handler t close;
handler t close;
use test;
use test;
drop table t1;
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 @
8e2ff7d1
...
@@ -123,3 +123,15 @@ handler t close;
...
@@ -123,3 +123,15 @@ handler t close;
use
test
;
use
test
;
drop
table
t1
;
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_class.h
View file @
8e2ff7d1
...
@@ -28,7 +28,7 @@ class Load_log_event;
...
@@ -28,7 +28,7 @@ class Load_log_event;
class
Slave_log_event
;
class
Slave_log_event
;
enum
enum_enable_or_disable
{
LEAVE_AS_IS
,
ENABLE
,
DISABLE
};
enum
enum_enable_or_disable
{
LEAVE_AS_IS
,
ENABLE
,
DISABLE
};
enum
enum_ha_read_modes
{
RFIRST
,
RNEXT
,
RPREV
,
RLAST
,
RKEY
};
enum
enum_ha_read_modes
{
RFIRST
,
RNEXT
,
RPREV
,
RLAST
,
RKEY
,
RNEXT_SAME
};
enum
enum_duplicates
{
DUP_ERROR
,
DUP_REPLACE
,
DUP_IGNORE
};
enum
enum_duplicates
{
DUP_ERROR
,
DUP_REPLACE
,
DUP_IGNORE
};
enum
enum_log_type
{
LOG_CLOSED
,
LOG_TO_BE_OPENED
,
LOG_NORMAL
,
LOG_NEW
,
LOG_BIN
};
enum
enum_log_type
{
LOG_CLOSED
,
LOG_TO_BE_OPENED
,
LOG_NORMAL
,
LOG_NEW
,
LOG_BIN
};
enum
enum_delay_key_write
{
DELAY_KEY_WRITE_NONE
,
DELAY_KEY_WRITE_ON
,
enum
enum_delay_key_write
{
DELAY_KEY_WRITE_NONE
,
DELAY_KEY_WRITE_ON
,
...
...
sql/sql_handler.cc
View file @
8e2ff7d1
...
@@ -103,7 +103,7 @@ int mysql_ha_closeall(THD *thd, TABLE_LIST *tables)
...
@@ -103,7 +103,7 @@ int mysql_ha_closeall(THD *thd, TABLE_LIST *tables)
}
}
static
enum
enum_ha_read_modes
rkey_to_rnext
[]
=
static
enum
enum_ha_read_modes
rkey_to_rnext
[]
=
{
RNEXT
,
RNEXT
,
RPREV
,
RNEXT
,
RPREV
,
RNEXT
,
RPREV
};
{
RNEXT
_SAME
,
RNEXT
,
RPREV
,
RNEXT
,
RPREV
,
RNEXT
,
RPREV
};
int
mysql_ha_read
(
THD
*
thd
,
TABLE_LIST
*
tables
,
int
mysql_ha_read
(
THD
*
thd
,
TABLE_LIST
*
tables
,
...
@@ -151,6 +151,11 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
...
@@ -151,6 +151,11 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
HANDLER_TABLES_HACK
(
thd
);
HANDLER_TABLES_HACK
(
thd
);
MYSQL_LOCK
*
lock
=
mysql_lock_tables
(
thd
,
&
tables
->
table
,
1
);
MYSQL_LOCK
*
lock
=
mysql_lock_tables
(
thd
,
&
tables
->
table
,
1
);
HANDLER_TABLES_HACK
(
thd
);
HANDLER_TABLES_HACK
(
thd
);
byte
*
key
;
uint
key_len
;
LINT_INIT
(
key
);
LINT_INIT
(
key_len
);
if
(
!
lock
)
if
(
!
lock
)
goto
err0
;
// mysql_lock_tables() printed error message already
goto
err0
;
// mysql_lock_tables() printed error message already
...
@@ -183,41 +188,44 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
...
@@ -183,41 +188,44 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
DBUG_ASSERT
(
keyname
!=
0
);
DBUG_ASSERT
(
keyname
!=
0
);
err
=
table
->
file
->
index_prev
(
table
->
record
[
0
]);
err
=
table
->
file
->
index_prev
(
table
->
record
[
0
]);
break
;
break
;
case
RNEXT_SAME
:
/* Continue scan on "(keypart1,keypart2,...)=(c1, c2, ...) */
DBUG_ASSERT
(
keyname
!=
0
);
err
=
table
->
file
->
index_next_same
(
table
->
record
[
0
],
key
,
key_len
);
break
;
case
RKEY
:
case
RKEY
:
{
{
DBUG_ASSERT
(
keyname
!=
0
);
DBUG_ASSERT
(
keyname
!=
0
);
KEY
*
keyinfo
=
table
->
key_info
+
keyno
;
KEY
*
keyinfo
=
table
->
key_info
+
keyno
;
KEY_PART_INFO
*
key_part
=
keyinfo
->
key_part
;
KEY_PART_INFO
*
key_part
=
keyinfo
->
key_part
;
uint
key_len
;
byte
*
key
;
if
(
key_expr
->
elements
>
keyinfo
->
key_parts
)
if
(
key_expr
->
elements
>
keyinfo
->
key_parts
)
{
{
my_printf_error
(
ER_TOO_MANY_KEY_PARTS
,
ER
(
ER_TOO_MANY_KEY_PARTS
),
my_printf_error
(
ER_TOO_MANY_KEY_PARTS
,
ER
(
ER_TOO_MANY_KEY_PARTS
),
MYF
(
0
),
keyinfo
->
key_parts
);
MYF
(
0
),
keyinfo
->
key_parts
);
goto
err
;
goto
err
;
}
}
List_iterator_fast
<
Item
>
it_ke
(
*
key_expr
);
List_iterator_fast
<
Item
>
it_ke
(
*
key_expr
);
Item
*
item
;
Item
*
item
;
for
(
key_len
=
0
;
(
item
=
it_ke
++
)
;
key_part
++
)
for
(
key_len
=
0
;
(
item
=
it_ke
++
)
;
key_part
++
)
{
{
if
(
item
->
fix_fields
(
thd
,
tables
))
if
(
item
->
fix_fields
(
thd
,
tables
))
goto
err
;
goto
err
;
if
(
item
->
used_tables
()
&
~
RAND_TABLE_BIT
)
if
(
item
->
used_tables
()
&
~
RAND_TABLE_BIT
)
{
{
my_error
(
ER_WRONG_ARGUMENTS
,
MYF
(
0
),
"HANDLER ... READ"
);
my_error
(
ER_WRONG_ARGUMENTS
,
MYF
(
0
),
"HANDLER ... READ"
);
goto
err
;
goto
err
;
}
}
item
->
save_in_field
(
key_part
->
field
,
1
);
item
->
save_in_field
(
key_part
->
field
,
1
);
key_len
+=
key_part
->
store_length
;
key_len
+=
key_part
->
store_length
;
}
}
if
(
!
(
key
=
(
byte
*
)
thd
->
calloc
(
ALIGN_SIZE
(
key_len
))))
if
(
!
(
key
=
(
byte
*
)
thd
->
calloc
(
ALIGN_SIZE
(
key_len
))))
{
{
send_error
(
&
thd
->
net
,
ER_OUTOFMEMORY
);
send_error
(
&
thd
->
net
,
ER_OUTOFMEMORY
);
goto
err
;
goto
err
;
}
}
key_copy
(
key
,
table
,
keyno
,
key_len
);
key_copy
(
key
,
table
,
keyno
,
key_len
);
err
=
table
->
file
->
index_read
(
table
->
record
[
0
],
err
=
table
->
file
->
index_read
(
table
->
record
[
0
],
key
,
key_len
,
ha_rkey_mode
);
key
,
key_len
,
ha_rkey_mode
);
mode
=
rkey_to_rnext
[(
int
)
ha_rkey_mode
];
mode
=
rkey_to_rnext
[(
int
)
ha_rkey_mode
];
break
;
break
;
}
}
...
...
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