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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
969b8ca5
Commit
969b8ca5
authored
Jan 12, 2005
by
paul@kite-hub.kitebird.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge paul@bk-internal.mysql.com:/home/bk/mysql-5.0
into kite-hub.kitebird.com:/src/extern/MySQL/bk/mysql-5.0
parents
231632e3
6bca7cb8
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
174 additions
and
36 deletions
+174
-36
innobase/include/row0mysql.h
innobase/include/row0mysql.h
+1
-7
innobase/row/row0sel.c
innobase/row/row0sel.c
+10
-8
libmysql/libmysql.def
libmysql/libmysql.def
+1
-0
libmysqld/libmysqld.def
libmysqld/libmysqld.def
+1
-0
mysql-test/r/index_merge_innodb.result
mysql-test/r/index_merge_innodb.result
+68
-0
mysql-test/t/analyse.test
mysql-test/t/analyse.test
+5
-0
mysql-test/t/index_merge_innodb.test
mysql-test/t/index_merge_innodb.test
+68
-0
sql/ha_innodb.cc
sql/ha_innodb.cc
+1
-7
sql/opt_range.cc
sql/opt_range.cc
+6
-4
sql/sql_analyse.cc
sql/sql_analyse.cc
+7
-8
sql/sql_parse.cc
sql/sql_parse.cc
+1
-1
sql/sql_prepare.cc
sql/sql_prepare.cc
+5
-1
No files found.
innobase/include/row0mysql.h
View file @
969b8ca5
...
...
@@ -531,10 +531,7 @@ struct row_prebuilt_struct {
format */
ulint
hint_need_to_fetch_extra_cols
;
/* normally this is set to 0; if this
is set to ROW_RETRIEVE_PRIMARY_KEY
(that value is obsolete starting from
5.0.2, because we always fetch the
primary key cols),
is set to ROW_RETRIEVE_PRIMARY_KEY,
then we should at least retrieve all
columns in the primary key; if this
is set to ROW_RETRIEVE_ALL_COLS, then
...
...
@@ -607,9 +604,6 @@ struct row_prebuilt_struct {
/* Values for hint_need_to_fetch_extra_cols */
#define ROW_RETRIEVE_PRIMARY_KEY 1
/* value 1 is obsolete starting from
5.0.2, because we always fetch the
primary key cols */
#define ROW_RETRIEVE_ALL_COLS 2
...
...
innobase/row/row0sel.c
View file @
969b8ca5
...
...
@@ -2331,11 +2331,6 @@ row_sel_store_mysql_rec(
prebuilt
->
blob_heap
=
NULL
;
}
/* MySQL assumes that all columns have the SQL NULL bit set unless it
is a nullable column with a non-NULL value */
memset
(
mysql_rec
,
0xFF
,
prebuilt
->
null_bitmap_len
);
for
(
i
=
0
;
i
<
prebuilt
->
n_template
;
i
++
)
{
templ
=
prebuilt
->
mysql_template
+
i
;
...
...
@@ -2431,6 +2426,8 @@ row_sel_store_mysql_rec(
bug number 154 in the MySQL bug database: GROUP BY
and DISTINCT could treat NULL values inequal. */
mysql_rec
[
templ
->
mysql_null_byte_offset
]
|=
(
byte
)
(
templ
->
mysql_null_bit_mask
);
if
(
templ
->
type
==
DATA_VARCHAR
||
templ
->
type
==
DATA_CHAR
||
templ
->
type
==
DATA_BINARY
...
...
@@ -2749,10 +2746,15 @@ row_sel_pop_cached_row_for_mysql(
buf
+
templ
->
mysql_col_offset
,
cached_rec
+
templ
->
mysql_col_offset
,
templ
->
mysql_col_len
);
/* Copy NULL bit of the current field from cached_rec
to buf */
if
(
templ
->
mysql_null_bit_mask
)
buf
[
templ
->
mysql_null_byte_offset
]
&=
cached_rec
[
templ
->
mysql_null_byte_offset
];
{
buf
[
templ
->
mysql_null_byte_offset
]
^=
(
buf
[
templ
->
mysql_null_byte_offset
]
^
cached_rec
[
templ
->
mysql_null_byte_offset
])
&
(
byte
)
templ
->
mysql_null_bit_mask
;
}
}
}
else
...
...
libmysql/libmysql.def
View file @
969b8ca5
...
...
@@ -146,3 +146,4 @@ EXPORTS
mysql_rpl_query_type
mysql_slave_query
mysql_embedded
get_defaults_files
libmysqld/libmysqld.def
View file @
969b8ca5
...
...
@@ -157,3 +157,4 @@ EXPORTS
mysql_stmt_attr_get
mysql_stmt_attr_set
mysql_stmt_field_count
get_defaults_files
mysql-test/r/index_merge_innodb.result
View file @
969b8ca5
...
...
@@ -53,3 +53,71 @@ key1 key2 str1 zeroval str2 str3
1 199 aaa 0 bbb 199-0_A
0 200 aaa 0 bbb 200-0_a
drop table t1;
create table t1 (
pk integer not null auto_increment primary key,
key1 integer,
key2 integer not null,
filler char (200),
index (key1),
index (key2)
) engine=innodb;
show warnings;
Level Code Message
explain select pk from t1 where key1 = 1 and key2 = 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge key1,key2 key1,key2 5,4 NULL 1 Using intersect(key1,key2); Using where; Using index
select pk from t1 where key2 = 1 and key1 = 1;
pk
26
select pk from t1 ignore index(key1,key2) where key2 = 1 and key1 = 1;
pk
26
drop table t1;
create table t1 (
pk int primary key auto_increment,
key1a int,
key2a int,
key1b int,
key2b int,
dummy1 int,
dummy2 int,
dummy3 int,
dummy4 int,
key3a int,
key3b int,
filler1 char (200),
index i1(key1a, key1b),
index i2(key2a, key2b),
index i3(key3a, key3b)
) engine=innodb;
create table t2 (a int);
insert into t2 values (0),(1),(2),(3),(4),(NULL);
insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
select A.a, B.a, C.a, D.a, C.a, D.a from t2 A,t2 B,t2 C, t2 D;
insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
select key1a, key1b, key2a, key2b, key3a, key3b from t1;
insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
select key1a, key1b, key2a, key2b, key3a, key3b from t1;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
select count(*) from t1;
count(*)
5184
explain select count(*) from t1 where
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge i1,i2 i1,i2 10,10 NULL 3 Using intersect(i1,i2); Using where; Using index
select count(*) from t1 where
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
count(*)
4
explain select count(*) from t1 where
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge i1,i3 i1,i3 10,10 NULL 3 Using intersect(i1,i3); Using where; Using index
select count(*) from t1 where
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
count(*)
4
drop table t1,t2;
mysql-test/t/analyse.test
View file @
969b8ca5
...
...
@@ -38,6 +38,11 @@ select * from t2;
insert
into
t2
select
*
from
t1
procedure
analyse
();
select
*
from
t2
;
drop
table
t1
,
t2
;
#
# Bug#2813 - analyse does not quote string values in enums from string
#
create
table
t1
(
v
varchar
(
128
));
insert
into
t1
values
(
'abc'
),(
'abc\'def\\hij\"klm\0opq'
),(
'\''
),(
'\"'
),(
'\\'
),(
'a\0'
),(
'b\''
),(
'c\"'
),(
'd\\'
),(
'\'b'
),(
'\"c'
),(
'\\d'
),(
'a\0\0\0b'
),(
'a\'\'\'\'b'
),(
'a\"\"\"\"b'
),(
'a\\\\\\\\b'
),(
'\'\0\\\"'
),(
'\'\''
),(
'\"\"'
),(
'\\\\'
),(
'The\ZEnd'
);
select
*
from
t1
procedure
analyse
();
...
...
mysql-test/t/index_merge_innodb.test
View file @
969b8ca5
...
...
@@ -51,4 +51,72 @@ select * from t1 where key1 < 5 or key2 > 197;
explain
select
*
from
t1
where
key1
<
3
or
key2
>
195
;
select
*
from
t1
where
key1
<
3
or
key2
>
195
;
# Test for BUG#5401
drop
table
t1
;
create
table
t1
(
pk
integer
not
null
auto_increment
primary
key
,
key1
integer
,
key2
integer
not
null
,
filler
char
(
200
),
index
(
key1
),
index
(
key2
)
)
engine
=
innodb
;
show
warnings
;
--
disable_query_log
let
$
1
=
30
;
while
(
$
1
)
{
eval
insert
into
t1
(
key1
,
key2
,
filler
)
values
(
$
1
/
4
,
$
1
/
8
,
'filler-data'
);
dec
$
1
;
}
--
enable_query_log
explain
select
pk
from
t1
where
key1
=
1
and
key2
=
1
;
select
pk
from
t1
where
key2
=
1
and
key1
=
1
;
select
pk
from
t1
ignore
index
(
key1
,
key2
)
where
key2
=
1
and
key1
=
1
;
# More tests for BUG#5401.
drop
table
t1
;
create
table
t1
(
pk
int
primary
key
auto_increment
,
key1a
int
,
key2a
int
,
key1b
int
,
key2b
int
,
dummy1
int
,
dummy2
int
,
dummy3
int
,
dummy4
int
,
key3a
int
,
key3b
int
,
filler1
char
(
200
),
index
i1
(
key1a
,
key1b
),
index
i2
(
key2a
,
key2b
),
index
i3
(
key3a
,
key3b
)
)
engine
=
innodb
;
create
table
t2
(
a
int
);
insert
into
t2
values
(
0
),(
1
),(
2
),(
3
),(
4
),(
NULL
);
insert
into
t1
(
key1a
,
key1b
,
key2a
,
key2b
,
key3a
,
key3b
)
select
A
.
a
,
B
.
a
,
C
.
a
,
D
.
a
,
C
.
a
,
D
.
a
from
t2
A
,
t2
B
,
t2
C
,
t2
D
;
insert
into
t1
(
key1a
,
key1b
,
key2a
,
key2b
,
key3a
,
key3b
)
select
key1a
,
key1b
,
key2a
,
key2b
,
key3a
,
key3b
from
t1
;
insert
into
t1
(
key1a
,
key1b
,
key2a
,
key2b
,
key3a
,
key3b
)
select
key1a
,
key1b
,
key2a
,
key2b
,
key3a
,
key3b
from
t1
;
analyze
table
t1
;
select
count
(
*
)
from
t1
;
explain
select
count
(
*
)
from
t1
where
key1a
=
2
and
key1b
is
null
and
key2a
=
2
and
key2b
is
null
;
select
count
(
*
)
from
t1
where
key1a
=
2
and
key1b
is
null
and
key2a
=
2
and
key2b
is
null
;
explain
select
count
(
*
)
from
t1
where
key1a
=
2
and
key1b
is
null
and
key3a
=
2
and
key3b
is
null
;
select
count
(
*
)
from
t1
where
key1a
=
2
and
key1b
is
null
and
key3a
=
2
and
key3b
is
null
;
drop
table
t1
,
t2
;
sql/ha_innodb.cc
View file @
969b8ca5
...
...
@@ -2302,13 +2302,7 @@ build_template(
ulint
n_fields
;
ulint
n_requested_fields
=
0
;
ibool
fetch_all_in_key
=
FALSE
;
ibool
fetch_primary_key_cols
=
TRUE
;
/* The ROR code in
opt_range.cc assumes that the
primary key cols are always
retrieved. Starting from
MySQL-5.0.2, let us always
fetch them, even though it
wastes some CPU. */
ibool
fetch_primary_key_cols
=
FALSE
;
ulint
i
;
if
(
prebuilt
->
select_lock_type
==
LOCK_X
)
{
...
...
sql/opt_range.cc
View file @
969b8ca5
...
...
@@ -912,7 +912,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
{
DBUG_PRINT
(
"info"
,
(
"Reusing handler %p"
,
file
));
if
(
file
->
extra
(
HA_EXTRA_KEYREAD
)
||
file
->
extra
(
HA_EXTRA_RETRIEVE_
ALL_COLS
)
|
file
->
extra
(
HA_EXTRA_RETRIEVE_
PRIMARY_KEY
)
|
|
init
()
||
reset
())
{
DBUG_RETURN
(
1
);
...
...
@@ -937,7 +937,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
}
if
(
file
->
extra
(
HA_EXTRA_KEYREAD
)
||
file
->
extra
(
HA_EXTRA_RETRIEVE_
ALL_COLS
)
||
file
->
extra
(
HA_EXTRA_RETRIEVE_
PRIMARY_KEY
)
||
init
()
||
reset
())
{
file
->
close
();
...
...
@@ -5621,7 +5621,8 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
DBUG_ENTER
(
"QUICK_INDEX_MERGE_SELECT::prepare_unique"
);
/* We're going to just read rowids. */
head
->
file
->
extra
(
HA_EXTRA_KEYREAD
);
if
(
head
->
file
->
extra
(
HA_EXTRA_KEYREAD
))
DBUG_RETURN
(
1
);
/*
Make innodb retrieve all PK member fields, so
...
...
@@ -5630,7 +5631,8 @@ int QUICK_INDEX_MERGE_SELECT::read_keys_and_merge()
(This also creates a deficiency - it is possible that we will retrieve
parts of key that are not used by current query at all.)
*/
head
->
file
->
extra
(
HA_EXTRA_RETRIEVE_ALL_COLS
);
if
(
head
->
file
->
extra
(
HA_EXTRA_RETRIEVE_PRIMARY_KEY
))
DBUG_RETURN
(
1
);
cur_quick_it
.
rewind
();
cur_quick
=
cur_quick_it
++
;
...
...
sql/sql_analyse.cc
View file @
969b8ca5
...
...
@@ -1029,20 +1029,19 @@ uint check_ulonglong(const char *str, uint length)
}
/* check_ulonlong */
/*
FUNCTION: append_escaped()
Quote special characters in a string.
SYNOPSIS
append_escaped(to_str, from_str)
to_str (in) A pointer to a String.
from_str (to) A pointer to an allocated string
DESCRIPTION
append_escaped() takes a String type variable, where it appends
escaped the second argument. Only characters that require escaping
will be escaped.
ARGUMENTS
A pointer to a String variable, where results will be appended
A pointer to a String variable, which is appended to the result
String, escaping those characters that require it.
RETURN VALUES
0 Success
1 Out of memory
...
...
sql/sql_parse.cc
View file @
969b8ca5
...
...
@@ -77,7 +77,7 @@ const char *command_name[]={
"Drop DB"
,
"Refresh"
,
"Shutdown"
,
"Statistics"
,
"Processlist"
,
"Connect"
,
"Kill"
,
"Debug"
,
"Ping"
,
"Time"
,
"Delayed insert"
,
"Change user"
,
"Binlog Dump"
,
"Table Dump"
,
"Connect Out"
,
"Register Slave"
,
"Prepare"
,
"
Prepare
Execute"
,
"Long Data"
,
"Close stmt"
,
"Prepare"
,
"Execute"
,
"Long Data"
,
"Close stmt"
,
"Reset stmt"
,
"Set option"
,
"Fetch"
,
"Error"
// Last command number
};
...
...
sql/sql_prepare.cc
View file @
969b8ca5
...
...
@@ -1740,7 +1740,7 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
DBUG_RETURN
(
TRUE
);
}
mysql_log
.
write
(
thd
,
COM_PREPARE
,
"
%s"
,
packet
);
mysql_log
.
write
(
thd
,
COM_PREPARE
,
"
[%lu] %s"
,
stmt
->
id
,
packet
);
thd
->
current_arena
=
stmt
;
mysql_init_query
(
thd
,
(
uchar
*
)
thd
->
query
,
thd
->
query_length
);
...
...
@@ -1990,6 +1990,10 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
goto
err
;
}
mysql_log
.
write
(
thd
,
COM_EXECUTE
,
"[%lu] %s"
,
stmt
->
id
,
expanded_query
.
length
()
?
expanded_query
.
c_ptr
()
:
stmt
->
query
);
thd
->
protocol
=
&
thd
->
protocol_prep
;
// Switch to binary protocol
if
(
!
(
specialflag
&
SPECIAL_NO_PRIOR
))
my_pthread_setprio
(
pthread_self
(),
QUERY_PRIOR
);
...
...
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