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
784b5d7b
Commit
784b5d7b
authored
Nov 23, 2007
by
gkodinov/kgeorge@magare.gmz
Browse files
Options
Browse Files
Download
Plain Diff
Merge magare.gmz:/home/kgeorge/mysql/work/mysql-5.0-opt
into magare.gmz:/home/kgeorge/mysql/work/merge-5.1-opt
parents
5f1966d1
3f163915
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
236 additions
and
37 deletions
+236
-37
mysql-test/r/gis.result
mysql-test/r/gis.result
+6
-0
mysql-test/r/outfile_loaddata.result
mysql-test/r/outfile_loaddata.result
+18
-0
mysql-test/r/type_bit.result
mysql-test/r/type_bit.result
+10
-0
mysql-test/r/type_blob.result
mysql-test/r/type_blob.result
+14
-0
mysql-test/t/gis.test
mysql-test/t/gis.test
+9
-0
mysql-test/t/outfile_loaddata.test
mysql-test/t/outfile_loaddata.test
+24
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+94
-0
mysql-test/t/type_bit.test
mysql-test/t/type_bit.test
+15
-0
mysql-test/t/type_blob.test
mysql-test/t/type_blob.test
+11
-0
sql/item_subselect.cc
sql/item_subselect.cc
+3
-1
sql/key.cc
sql/key.cc
+0
-13
sql/opt_range.cc
sql/opt_range.cc
+6
-0
sql/sql_class.cc
sql/sql_class.cc
+10
-7
sql/sql_class.h
sql/sql_class.h
+2
-2
sql/sql_insert.cc
sql/sql_insert.cc
+5
-13
sql/sql_select.cc
sql/sql_select.cc
+5
-0
sql/sql_string.cc
sql/sql_string.cc
+4
-1
No files found.
mysql-test/r/gis.result
View file @
784b5d7b
...
@@ -958,6 +958,12 @@ COUNT(*)
...
@@ -958,6 +958,12 @@ COUNT(*)
2
2
DROP TABLE t1, t2;
DROP TABLE t1, t2;
End of 5.0 tests
End of 5.0 tests
create table `t1` (`col002` point)engine=myisam;
insert into t1 values (),(),();
select min(`col002`) from t1 union select `col002` from t1;
min(`col002`)
NULL
drop table t1;
End of 5.0 tests
End of 5.0 tests
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
create view v1 as select * from t1;
create view v1 as select * from t1;
...
...
mysql-test/r/outfile_loaddata.result
View file @
784b5d7b
...
@@ -82,4 +82,22 @@ c1 c2
...
@@ -82,4 +82,22 @@ c1 c2
-r- =raker=
-r- =raker=
DROP TABLE t2;
DROP TABLE t2;
DROP TABLE t1;
DROP TABLE t1;
#
# Bug#32533: SELECT INTO OUTFILE never escapes multibyte character
#
CREATE TABLE t1 (c1 VARCHAR(256));
INSERT INTO t1 VALUES (0xC3);
SELECT HEX(c1) FROM t1;
HEX(c1)
C3
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug32533.txt' FIELDS ENCLOSED BY 0xC3 FROM t1;
TRUNCATE t1;
SELECT HEX(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug32533.txt'));
HEX(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug32533.txt'))
C35CC3C30A
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug32533.txt' INTO TABLE t1 FIELDS ENCLOSED BY 0xC3;
SELECT HEX(c1) FROM t1;
HEX(c1)
C3
DROP TABLE t1;
# End of 5.0 tests.
# End of 5.0 tests.
mysql-test/r/type_bit.result
View file @
784b5d7b
...
@@ -672,6 +672,16 @@ COUNT(DISTINCT b,c)
...
@@ -672,6 +672,16 @@ COUNT(DISTINCT b,c)
2
2
2
2
DROP TABLE t2;
DROP TABLE t2;
CREATE TABLE t1(a BIT(13), KEY(a));
INSERT INTO t1(a) VALUES
(65535),(65525),(65535),(65535),(65535),(65535),(65535),(65535),(65535),(65535);
EXPLAIN SELECT 1 FROM t1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL a 3 NULL 6 Using index for group-by
SELECT 1 FROM t1 GROUP BY a;
1
1
DROP TABLE t1;
End of 5.0 tests
End of 5.0 tests
create table t1(a bit(7));
create table t1(a bit(7));
insert into t1 values(0x40);
insert into t1 values(0x40);
...
...
mysql-test/r/type_blob.result
View file @
784b5d7b
...
@@ -807,4 +807,18 @@ set @@sql_mode='TRADITIONAL';
...
@@ -807,4 +807,18 @@ set @@sql_mode='TRADITIONAL';
create table t1 (a text default '');
create table t1 (a text default '');
ERROR 42000: BLOB/TEXT column 'a' can't have a default value
ERROR 42000: BLOB/TEXT column 'a' can't have a default value
set @@sql_mode='';
set @@sql_mode='';
CREATE TABLE t (c TEXT CHARSET ASCII);
INSERT INTO t (c) VALUES (REPEAT('1',65537));
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
INSERT INTO t (c) VALUES (REPEAT('2',65536));
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
INSERT INTO t (c) VALUES (REPEAT('3',65535));
SELECT LENGTH(c), CHAR_LENGTH(c) FROM t;
LENGTH(c) CHAR_LENGTH(c)
65535 65535
65535 65535
65535 65535
DROP TABLE t;
End of 5.0 tests
End of 5.0 tests
mysql-test/t/gis.test
View file @
784b5d7b
...
@@ -632,6 +632,15 @@ SELECT 1;
...
@@ -632,6 +632,15 @@ SELECT 1;
--
source
include
/
gis_keys
.
inc
--
source
include
/
gis_keys
.
inc
#
# Bug #31155 gis types in union'd select cause crash
#
create
table
`t1`
(
`col002`
point
)
engine
=
myisam
;
insert
into
t1
values
(),(),();
select
min
(
`col002`
)
from
t1
union
select
`col002`
from
t1
;
drop
table
t1
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
...
...
mysql-test/t/outfile_loaddata.test
View file @
784b5d7b
...
@@ -86,4 +86,28 @@ DROP TABLE t2;
...
@@ -86,4 +86,28 @@ DROP TABLE t2;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug#32533: SELECT INTO OUTFILE never escapes multibyte character
--
echo
#
CREATE
TABLE
t1
(
c1
VARCHAR
(
256
));
INSERT
INTO
t1
VALUES
(
0xC3
);
SELECT
HEX
(
c1
)
FROM
t1
;
--
let
$file
=
$MYSQLTEST_VARDIR
/
tmp
/
bug32533
.
txt
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
SELECT
*
INTO
OUTFILE
'$file'
FIELDS
ENCLOSED
BY
0xC3
FROM
t1
TRUNCATE
t1
;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
SELECT
HEX
(
LOAD_FILE
(
'$file'
))
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
eval
LOAD
DATA
INFILE
'$file'
INTO
TABLE
t1
FIELDS
ENCLOSED
BY
0xC3
SELECT
HEX
(
c1
)
FROM
t1
;
--
remove_file
$file
DROP
TABLE
t1
;
--
echo
# End of 5.0 tests.
--
echo
# End of 5.0 tests.
mysql-test/t/subselect.test
View file @
784b5d7b
...
@@ -2987,6 +2987,100 @@ SELECT (SELECT SUM(t1.a) FROM t2 WHERE a!=0) FROM t1;
...
@@ -2987,6 +2987,100 @@ SELECT (SELECT SUM(t1.a) FROM t2 WHERE a!=0) FROM t1;
SELECT
(
SELECT
SUM
(
t1
.
a
)
FROM
t2
WHERE
a
=
1
)
FROM
t1
;
SELECT
(
SELECT
SUM
(
t1
.
a
)
FROM
t2
WHERE
a
=
1
)
FROM
t1
;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
# Bug31048: Many nested subqueries may cause server crash.
#
create
table
t1
(
a
int
,
b
int
,
key
(
a
),
key
(
b
));
insert
into
t1
(
a
,
b
)
values
(
1
,
2
),(
2
,
1
),(
2
,
3
),(
3
,
4
),(
5
,
4
),(
5
,
5
),
(
6
,
7
),(
7
,
4
),(
5
,
3
);
# test for the stack overflow bug
select
sum
(
a
),
a
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
a
;
--
replace_regex
/
overrun
.*
$
/
overrun
detected
/
--
error
1436
select
sum
(
a
),
a
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
a
;
# test for the memory consumption & subquery slowness bug
explain
select
sum
(
a
),
a
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
a
;
--
replace_regex
/
overrun
.*
$
/
overrun
detected
/
--
error
1436
explain
select
sum
(
a
),
a
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
where
a
>
(
select
sum
(
a
)
from
t1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
b
limit
1
)
group
by
a
;
drop
table
t1
;
#
#
# Bug #31884: Assertion + crash in subquery in the SELECT clause.
# Bug #31884: Assertion + crash in subquery in the SELECT clause.
#
#
...
...
mysql-test/t/type_bit.test
View file @
784b5d7b
...
@@ -318,6 +318,21 @@ INSERT INTO t2 VALUES (3, 2, 'two'), (2, 3, 'three'), (2, 0, 'zero'),
...
@@ -318,6 +318,21 @@ INSERT INTO t2 VALUES (3, 2, 'two'), (2, 3, 'three'), (2, 0, 'zero'),
SELECT
COUNT
(
DISTINCT
b
,
c
)
FROM
t2
GROUP
BY
a
;
SELECT
COUNT
(
DISTINCT
b
,
c
)
FROM
t2
GROUP
BY
a
;
DROP
TABLE
t2
;
DROP
TABLE
t2
;
#
# BUG#32556 assert in "using index for group-by" : is_last_prefix <= 0,
# file .\opt_range.cc
CREATE
TABLE
t1
(
a
BIT
(
13
),
KEY
(
a
));
--
disable_warnings
INSERT
INTO
t1
(
a
)
VALUES
(
65535
),(
65525
),(
65535
),(
65535
),(
65535
),(
65535
),(
65535
),(
65535
),(
65535
),(
65535
);
--
enable_warnings
EXPLAIN
SELECT
1
FROM
t1
GROUP
BY
a
;
SELECT
1
FROM
t1
GROUP
BY
a
;
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
#
#
...
...
mysql-test/t/type_blob.test
View file @
784b5d7b
...
@@ -436,4 +436,15 @@ set @@sql_mode='TRADITIONAL';
...
@@ -436,4 +436,15 @@ set @@sql_mode='TRADITIONAL';
create
table
t1
(
a
text
default
''
);
create
table
t1
(
a
text
default
''
);
set
@@
sql_mode
=
''
;
set
@@
sql_mode
=
''
;
#
# Bug #32282: TEXT silently truncates when value is exactly 65536 bytes
#
CREATE
TABLE
t
(
c
TEXT
CHARSET
ASCII
);
INSERT
INTO
t
(
c
)
VALUES
(
REPEAT
(
'1'
,
65537
));
INSERT
INTO
t
(
c
)
VALUES
(
REPEAT
(
'2'
,
65536
));
INSERT
INTO
t
(
c
)
VALUES
(
REPEAT
(
'3'
,
65535
));
SELECT
LENGTH
(
c
),
CHAR_LENGTH
(
c
)
FROM
t
;
DROP
TABLE
t
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
sql/item_subselect.cc
View file @
784b5d7b
...
@@ -1843,7 +1843,9 @@ int subselect_single_select_engine::exec()
...
@@ -1843,7 +1843,9 @@ int subselect_single_select_engine::exec()
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
}
}
if
(
select_lex
->
uncacheable
&&
executed
)
if
(
select_lex
->
uncacheable
&&
select_lex
->
uncacheable
!=
UNCACHEABLE_EXPLAIN
&&
executed
)
{
{
if
(
join
->
reinit
())
if
(
join
->
reinit
())
{
{
...
...
sql/key.cc
View file @
784b5d7b
...
@@ -127,19 +127,6 @@ void key_copy(uchar *to_key, uchar *from_record, KEY *key_info,
...
@@ -127,19 +127,6 @@ void key_copy(uchar *to_key, uchar *from_record, KEY *key_info,
key_part
->
null_bit
);
key_part
->
null_bit
);
key_length
--
;
key_length
--
;
}
}
if
(
key_part
->
type
==
HA_KEYTYPE_BIT
)
{
Field_bit
*
field
=
(
Field_bit
*
)
(
key_part
->
field
);
if
(
field
->
bit_len
)
{
uchar
bits
=
get_rec_bits
(
from_record
+
key_part
->
null_offset
+
(
key_part
->
null_bit
==
128
),
field
->
bit_ofs
,
field
->
bit_len
);
*
to_key
++=
bits
;
key_length
--
;
}
}
if
(
key_part
->
key_part_flag
&
HA_BLOB_PART
||
if
(
key_part
->
key_part_flag
&
HA_BLOB_PART
||
key_part
->
key_part_flag
&
HA_VAR_LENGTH_PART
)
key_part
->
key_part_flag
&
HA_VAR_LENGTH_PART
)
{
{
...
...
sql/opt_range.cc
View file @
784b5d7b
...
@@ -2161,12 +2161,18 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
...
@@ -2161,12 +2161,18 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
keys_to_use
.
intersect
(
head
->
keys_in_use_for_query
);
keys_to_use
.
intersect
(
head
->
keys_in_use_for_query
);
if
(
!
keys_to_use
.
is_clear_all
())
if
(
!
keys_to_use
.
is_clear_all
())
{
{
#ifndef EMBEDDED_LIBRARY // Avoid compiler warning
char
buff
[
STACK_BUFF_ALLOC
];
#endif
MEM_ROOT
alloc
;
MEM_ROOT
alloc
;
SEL_TREE
*
tree
=
NULL
;
SEL_TREE
*
tree
=
NULL
;
KEY_PART
*
key_parts
;
KEY_PART
*
key_parts
;
KEY
*
key_info
;
KEY
*
key_info
;
PARAM
param
;
PARAM
param
;
if
(
check_stack_overrun
(
thd
,
2
*
STACK_MIN_SIZE
,
buff
))
DBUG_RETURN
(
0
);
// Fatal error flag is set
/* set up parameter that is passed to all functions */
/* set up parameter that is passed to all functions */
param
.
thd
=
thd
;
param
.
thd
=
thd
;
param
.
baseflag
=
head
->
file
->
ha_table_flags
();
param
.
baseflag
=
head
->
file
->
ha_table_flags
();
...
...
sql/sql_class.cc
View file @
784b5d7b
...
@@ -1579,16 +1579,18 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
...
@@ -1579,16 +1579,18 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
}
}
}
}
field_term_length
=
exchange
->
field_term
->
length
();
field_term_length
=
exchange
->
field_term
->
length
();
field_term_char
=
field_term_length
?
(
*
exchange
->
field_term
)[
0
]
:
INT_MAX
;
field_term_char
=
field_term_length
?
(
int
)
(
uchar
)
(
*
exchange
->
field_term
)[
0
]
:
INT_MAX
;
if
(
!
exchange
->
line_term
->
length
())
if
(
!
exchange
->
line_term
->
length
())
exchange
->
line_term
=
exchange
->
field_term
;
// Use this if it exists
exchange
->
line_term
=
exchange
->
field_term
;
// Use this if it exists
field_sep_char
=
(
exchange
->
enclosed
->
length
()
?
(
*
exchange
->
enclosed
)[
0
]
:
field_sep_char
=
(
exchange
->
enclosed
->
length
()
?
field_term_char
);
(
int
)
(
uchar
)
(
*
exchange
->
enclosed
)[
0
]
:
field_term_char
);
escape_char
=
(
exchange
->
escaped
->
length
()
?
(
*
exchange
->
escaped
)[
0
]
:
-
1
);
escape_char
=
(
exchange
->
escaped
->
length
()
?
(
int
)
(
uchar
)
(
*
exchange
->
escaped
)[
0
]
:
-
1
);
is_ambiguous_field_sep
=
test
(
strchr
(
ESCAPE_CHARS
,
field_sep_char
));
is_ambiguous_field_sep
=
test
(
strchr
(
ESCAPE_CHARS
,
field_sep_char
));
is_unsafe_field_sep
=
test
(
strchr
(
NUMERIC_CHARS
,
field_sep_char
));
is_unsafe_field_sep
=
test
(
strchr
(
NUMERIC_CHARS
,
field_sep_char
));
line_sep_char
=
(
exchange
->
line_term
->
length
()
?
line_sep_char
=
(
exchange
->
line_term
->
length
()
?
(
*
exchange
->
line_term
)[
0
]
:
INT_MAX
);
(
int
)
(
uchar
)
(
*
exchange
->
line_term
)[
0
]
:
INT_MAX
);
if
(
!
field_term_length
)
if
(
!
field_term_length
)
exchange
->
opt_enclosed
=
0
;
exchange
->
opt_enclosed
=
0
;
if
(
!
exchange
->
enclosed
->
length
())
if
(
!
exchange
->
enclosed
->
length
())
...
@@ -1745,10 +1747,11 @@ bool select_export::send_data(List<Item> &items)
...
@@ -1745,10 +1747,11 @@ bool select_export::send_data(List<Item> &items)
Don't escape field_term_char by doubling - doubling is only
Don't escape field_term_char by doubling - doubling is only
valid for ENCLOSED BY characters:
valid for ENCLOSED BY characters:
*/
*/
(
enclosed
||
!
is_ambiguous_field_term
||
*
pos
!=
field_term_char
))
(
enclosed
||
!
is_ambiguous_field_term
||
(
int
)
(
uchar
)
*
pos
!=
field_term_char
))
{
{
char
tmp_buff
[
2
];
char
tmp_buff
[
2
];
tmp_buff
[
0
]
=
((
int
)
*
pos
==
field_sep_char
&&
tmp_buff
[
0
]
=
((
int
)
(
uchar
)
*
pos
==
field_sep_char
&&
is_ambiguous_field_sep
)
?
is_ambiguous_field_sep
)
?
field_sep_char
:
escape_char
;
field_sep_char
:
escape_char
;
tmp_buff
[
1
]
=
*
pos
?
*
pos
:
'0'
;
tmp_buff
[
1
]
=
*
pos
?
*
pos
:
'0'
;
...
...
sql/sql_class.h
View file @
784b5d7b
...
@@ -2157,14 +2157,13 @@ class select_insert :public select_result_interceptor {
...
@@ -2157,14 +2157,13 @@ class select_insert :public select_result_interceptor {
ulonglong
autoinc_value_of_last_inserted_row
;
// autogenerated or not
ulonglong
autoinc_value_of_last_inserted_row
;
// autogenerated or not
COPY_INFO
info
;
COPY_INFO
info
;
bool
insert_into_view
;
bool
insert_into_view
;
bool
is_bulk_insert_mode
;
select_insert
(
TABLE_LIST
*
table_list_par
,
select_insert
(
TABLE_LIST
*
table_list_par
,
TABLE
*
table_par
,
List
<
Item
>
*
fields_par
,
TABLE
*
table_par
,
List
<
Item
>
*
fields_par
,
List
<
Item
>
*
update_fields
,
List
<
Item
>
*
update_values
,
List
<
Item
>
*
update_fields
,
List
<
Item
>
*
update_values
,
enum_duplicates
duplic
,
bool
ignore
);
enum_duplicates
duplic
,
bool
ignore
);
~
select_insert
();
~
select_insert
();
int
prepare
(
List
<
Item
>
&
list
,
SELECT_LEX_UNIT
*
u
);
int
prepare
(
List
<
Item
>
&
list
,
SELECT_LEX_UNIT
*
u
);
int
prepare2
(
void
);
virtual
int
prepare2
(
void
);
bool
send_data
(
List
<
Item
>
&
items
);
bool
send_data
(
List
<
Item
>
&
items
);
virtual
void
store_values
(
List
<
Item
>
&
values
);
virtual
void
store_values
(
List
<
Item
>
&
values
);
virtual
bool
can_rollback_data
()
{
return
0
;
}
virtual
bool
can_rollback_data
()
{
return
0
;
}
...
@@ -2212,6 +2211,7 @@ public:
...
@@ -2212,6 +2211,7 @@ public:
// Needed for access from local class MY_HOOKS in prepare(), since thd is proteted.
// Needed for access from local class MY_HOOKS in prepare(), since thd is proteted.
const
THD
*
get_thd
(
void
)
{
return
thd
;
}
const
THD
*
get_thd
(
void
)
{
return
thd
;
}
const
HA_CREATE_INFO
*
get_create_info
()
{
return
create_info
;
};
const
HA_CREATE_INFO
*
get_create_info
()
{
return
create_info
;
};
int
prepare2
(
void
)
{
return
0
;
}
};
};
#include <myisam.h>
#include <myisam.h>
...
...
sql/sql_insert.cc
View file @
784b5d7b
...
@@ -2789,8 +2789,7 @@ select_insert::select_insert(TABLE_LIST *table_list_par, TABLE *table_par,
...
@@ -2789,8 +2789,7 @@ select_insert::select_insert(TABLE_LIST *table_list_par, TABLE *table_par,
bool
ignore_check_option_errors
)
bool
ignore_check_option_errors
)
:
table_list
(
table_list_par
),
table
(
table_par
),
fields
(
fields_par
),
:
table_list
(
table_list_par
),
table
(
table_par
),
fields
(
fields_par
),
autoinc_value_of_last_inserted_row
(
0
),
autoinc_value_of_last_inserted_row
(
0
),
insert_into_view
(
table_list_par
&&
table_list_par
->
view
!=
0
),
insert_into_view
(
table_list_par
&&
table_list_par
->
view
!=
0
)
is_bulk_insert_mode
(
FALSE
)
{
{
bzero
((
char
*
)
&
info
,
sizeof
(
info
));
bzero
((
char
*
)
&
info
,
sizeof
(
info
));
info
.
handle_duplicates
=
duplic
;
info
.
handle_duplicates
=
duplic
;
...
@@ -2903,14 +2902,14 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
...
@@ -2903,14 +2902,14 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
Is table which we are changing used somewhere in other parts of
Is table which we are changing used somewhere in other parts of
query
query
*/
*/
if
(
!
(
lex
->
current_select
->
options
&
OPTION_BUFFER_RESULT
)
&&
if
(
unique_table
(
thd
,
table_list
,
table_list
->
next_global
,
0
))
unique_table
(
thd
,
table_list
,
table_list
->
next_global
,
0
))
{
{
/* Using same table for INSERT and SELECT */
/* Using same table for INSERT and SELECT */
lex
->
current_select
->
options
|=
OPTION_BUFFER_RESULT
;
lex
->
current_select
->
options
|=
OPTION_BUFFER_RESULT
;
lex
->
current_select
->
join
->
select_options
|=
OPTION_BUFFER_RESULT
;
lex
->
current_select
->
join
->
select_options
|=
OPTION_BUFFER_RESULT
;
}
}
else
if
(
!
thd
->
prelocked_mode
)
else
if
(
!
(
lex
->
current_select
->
options
&
OPTION_BUFFER_RESULT
)
&&
!
thd
->
prelocked_mode
)
{
{
/*
/*
We must not yet prepare the result table if it is the same as one of the
We must not yet prepare the result table if it is the same as one of the
...
@@ -2976,11 +2975,8 @@ int select_insert::prepare2(void)
...
@@ -2976,11 +2975,8 @@ int select_insert::prepare2(void)
{
{
DBUG_ENTER
(
"select_insert::prepare2"
);
DBUG_ENTER
(
"select_insert::prepare2"
);
if
(
thd
->
lex
->
current_select
->
options
&
OPTION_BUFFER_RESULT
&&
if
(
thd
->
lex
->
current_select
->
options
&
OPTION_BUFFER_RESULT
&&
!
thd
->
prelocked_mode
&&
!
is_bulk_insert_mode
)
!
thd
->
prelocked_mode
)
{
table
->
file
->
ha_start_bulk_insert
((
ha_rows
)
0
);
table
->
file
->
ha_start_bulk_insert
((
ha_rows
)
0
);
is_bulk_insert_mode
=
TRUE
;
}
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
...
@@ -3099,7 +3095,6 @@ bool select_insert::send_eof()
...
@@ -3099,7 +3095,6 @@ bool select_insert::send_eof()
trans_table
,
table
->
file
->
table_type
()));
trans_table
,
table
->
file
->
table_type
()));
error
=
(
!
thd
->
prelocked_mode
)
?
table
->
file
->
ha_end_bulk_insert
()
:
0
;
error
=
(
!
thd
->
prelocked_mode
)
?
table
->
file
->
ha_end_bulk_insert
()
:
0
;
is_bulk_insert_mode
=
FALSE
;
table
->
file
->
extra
(
HA_EXTRA_NO_IGNORE_DUP_KEY
);
table
->
file
->
extra
(
HA_EXTRA_NO_IGNORE_DUP_KEY
);
table
->
file
->
extra
(
HA_EXTRA_WRITE_CANNOT_REPLACE
);
table
->
file
->
extra
(
HA_EXTRA_WRITE_CANNOT_REPLACE
);
...
@@ -3550,10 +3545,7 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
...
@@ -3550,10 +3545,7 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
if
(
info
.
handle_duplicates
==
DUP_UPDATE
)
if
(
info
.
handle_duplicates
==
DUP_UPDATE
)
table
->
file
->
extra
(
HA_EXTRA_INSERT_WITH_UPDATE
);
table
->
file
->
extra
(
HA_EXTRA_INSERT_WITH_UPDATE
);
if
(
!
thd
->
prelocked_mode
)
if
(
!
thd
->
prelocked_mode
)
{
table
->
file
->
ha_start_bulk_insert
((
ha_rows
)
0
);
table
->
file
->
ha_start_bulk_insert
((
ha_rows
)
0
);
is_bulk_insert_mode
=
TRUE
;
}
thd
->
abort_on_warning
=
(
!
info
.
ignore
&&
thd
->
abort_on_warning
=
(
!
info
.
ignore
&&
(
thd
->
variables
.
sql_mode
&
(
thd
->
variables
.
sql_mode
&
(
MODE_STRICT_TRANS_TABLES
|
(
MODE_STRICT_TRANS_TABLES
|
...
...
sql/sql_select.cc
View file @
784b5d7b
...
@@ -2366,6 +2366,11 @@ static ha_rows get_quick_record_count(THD *thd, SQL_SELECT *select,
...
@@ -2366,6 +2366,11 @@ static ha_rows get_quick_record_count(THD *thd, SQL_SELECT *select,
{
{
int
error
;
int
error
;
DBUG_ENTER
(
"get_quick_record_count"
);
DBUG_ENTER
(
"get_quick_record_count"
);
#ifndef EMBEDDED_LIBRARY // Avoid compiler warning
char
buff
[
STACK_BUFF_ALLOC
];
#endif
if
(
check_stack_overrun
(
thd
,
STACK_MIN_SIZE
,
buff
))
DBUG_RETURN
(
0
);
// Fatal error flag is set
if
(
select
)
if
(
select
)
{
{
select
->
head
=
table
;
select
->
head
=
table
;
...
...
sql/sql_string.cc
View file @
784b5d7b
...
@@ -846,7 +846,7 @@ outp:
...
@@ -846,7 +846,7 @@ outp:
with optional left padding (for binary -> UCS2 conversion)
with optional left padding (for binary -> UCS2 conversion)
SYNOPSIS
SYNOPSIS
well_formed_copy_nhars()
well_formed_copy_n
c
hars()
to Store result here
to Store result here
to_length Maxinum length of "to" string
to_length Maxinum length of "to" string
to_cs Character set of "to" string
to_cs Character set of "to" string
...
@@ -983,8 +983,11 @@ outp:
...
@@ -983,8 +983,11 @@ outp:
goto
outp
;
goto
outp
;
}
}
else
else
{
from
=
from_prev
;
break
;
break
;
}
}
}
*
from_end_pos
=
from
;
*
from_end_pos
=
from
;
res
=
to
-
to_start
;
res
=
to
-
to_start
;
}
}
...
...
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