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
4fd6de8b
Commit
4fd6de8b
authored
Sep 24, 2007
by
evgen@sunlight.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge sunlight.local:/local_work/27216-bug-5.0-opt-mysql
into sunlight.local:/local_work/merge-5.1-opt-mysql
parents
fae74579
7ed30b97
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
188 additions
and
12 deletions
+188
-12
libmysql/libmysql.c
libmysql/libmysql.c
+2
-0
mysql-test/r/date_formats.result
mysql-test/r/date_formats.result
+1
-1
mysql-test/r/insert_select.result
mysql-test/r/insert_select.result
+12
-0
mysql-test/r/type_datetime.result
mysql-test/r/type_datetime.result
+61
-0
mysql-test/t/insert_select.test
mysql-test/t/insert_select.test
+12
-0
mysql-test/t/type_datetime.test
mysql-test/t/type_datetime.test
+37
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+35
-4
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+6
-1
sql/item_func.cc
sql/item_func.cc
+1
-0
sql/item_func.h
sql/item_func.h
+3
-1
sql/item_timefunc.cc
sql/item_timefunc.cc
+1
-1
sql/mysql_priv.h
sql/mysql_priv.h
+1
-0
sql/protocol.cc
sql/protocol.cc
+1
-0
sql/sql_class.h
sql/sql_class.h
+1
-1
sql/sql_insert.cc
sql/sql_insert.cc
+14
-3
No files found.
libmysql/libmysql.c
View file @
4fd6de8b
...
@@ -4352,6 +4352,7 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
...
@@ -4352,6 +4352,7 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
case
MYSQL_TYPE_STRING
:
case
MYSQL_TYPE_STRING
:
case
MYSQL_TYPE_DECIMAL
:
case
MYSQL_TYPE_DECIMAL
:
case
MYSQL_TYPE_NEWDECIMAL
:
case
MYSQL_TYPE_NEWDECIMAL
:
case
MYSQL_TYPE_NEWDATE
:
DBUG_ASSERT
(
param
->
buffer_length
!=
0
);
DBUG_ASSERT
(
param
->
buffer_length
!=
0
);
param
->
fetch_result
=
fetch_result_str
;
param
->
fetch_result
=
fetch_result_str
;
break
;
break
;
...
@@ -4424,6 +4425,7 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
...
@@ -4424,6 +4425,7 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
case
MYSQL_TYPE_VAR_STRING
:
case
MYSQL_TYPE_VAR_STRING
:
case
MYSQL_TYPE_STRING
:
case
MYSQL_TYPE_STRING
:
case
MYSQL_TYPE_BIT
:
case
MYSQL_TYPE_BIT
:
case
MYSQL_TYPE_NEWDATE
:
param
->
skip_result
=
skip_result_string
;
param
->
skip_result
=
skip_result_string
;
break
;
break
;
default:
default:
...
...
mysql-test/r/date_formats.result
View file @
4fd6de8b
...
@@ -478,7 +478,7 @@ str_to_date(a,b)
...
@@ -478,7 +478,7 @@ str_to_date(a,b)
create table t2 select str_to_date(a,b) from t1;
create table t2 select str_to_date(a,b) from t1;
describe t2;
describe t2;
Field Type Null Key Default Extra
Field Type Null Key Default Extra
str_to_date(a,b)
binary(29)
YES NULL
str_to_date(a,b)
datetime
YES NULL
select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S") as f2,
str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S") as f2,
str_to_date("2003-01-02", "%Y-%m-%d") as f3,
str_to_date("2003-01-02", "%Y-%m-%d") as f3,
...
...
mysql-test/r/insert_select.result
View file @
4fd6de8b
...
@@ -816,3 +816,15 @@ id prev_id join_id
...
@@ -816,3 +816,15 @@ id prev_id join_id
3 2 0
3 2 0
4 3 0
4 3 0
DROP TABLE t1,t2;
DROP TABLE t1,t2;
#
# Bug#30384: Having SQL_BUFFER_RESULT option in the
# CREATE .. KEY(..) .. SELECT led to creating corrupted index.
#
create table t1(f1 int);
insert into t1 values(1),(2),(3);
create table t2 (key(f1)) engine=myisam select sql_buffer_result f1 from t1;
check table t2 extended;
Table Op Msg_type Msg_text
test.t2 check status OK
drop table t1,t2;
##################################################################
mysql-test/r/type_datetime.result
View file @
4fd6de8b
...
@@ -427,6 +427,67 @@ f1
...
@@ -427,6 +427,67 @@ f1
Warnings:
Warnings:
Warning 1292 Incorrect datetime value: '2007010100000' for column 'f1' at row 1
Warning 1292 Incorrect datetime value: '2007010100000' for column 'f1' at row 1
drop table t1;
drop table t1;
#
# Bug#27216: functions with parameters of different date types may
# return wrong type of the result.
#
create table t1 (f1 date, f2 datetime, f3 varchar(20));
create table t2 as select coalesce(f1,f1) as f4 from t1;
desc t2;
Field Type Null Key Default Extra
f4 date YES NULL
create table t3 as select coalesce(f1,f2) as f4 from t1;
desc t3;
Field Type Null Key Default Extra
f4 datetime YES NULL
create table t4 as select coalesce(f2,f2) as f4 from t1;
desc t4;
Field Type Null Key Default Extra
f4 datetime YES NULL
create table t5 as select coalesce(f1,f3) as f4 from t1;
desc t5;
Field Type Null Key Default Extra
f4 varbinary(20) YES NULL
create table t6 as select coalesce(f2,f3) as f4 from t1;
desc t6;
Field Type Null Key Default Extra
f4 varbinary(20) YES NULL
create table t7 as select coalesce(makedate(1997,1),f2) as f4 from t1;
desc t7;
Field Type Null Key Default Extra
f4 datetime YES NULL
create table t8 as select coalesce(cast('01-01-01' as datetime),f2) as f4
from t1;
desc t8;
Field Type Null Key Default Extra
f4 datetime YES NULL
create table t9 as select case when 1 then cast('01-01-01' as date)
when 0 then cast('01-01-01' as date) end as f4 from t1;
desc t9;
Field Type Null Key Default Extra
f4 date YES NULL
create table t10 as select case when 1 then cast('01-01-01' as datetime)
when 0 then cast('01-01-01' as datetime) end as f4 from t1;
desc t10;
Field Type Null Key Default Extra
f4 datetime YES NULL
create table t11 as select if(1, cast('01-01-01' as datetime),
cast('01-01-01' as date)) as f4 from t1;
desc t11;
Field Type Null Key Default Extra
f4 datetime YES NULL
create table t12 as select least(cast('01-01-01' as datetime),
cast('01-01-01' as date)) as f4 from t1;
desc t12;
Field Type Null Key Default Extra
f4 datetime YES NULL
create table t13 as select ifnull(cast('01-01-01' as datetime),
cast('01-01-01' as date)) as f4 from t1;
desc t13;
Field Type Null Key Default Extra
f4 datetime YES NULL
drop tables t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13;
###################################################################
set @org_mode=@@sql_mode;
set @org_mode=@@sql_mode;
create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
Warnings:
Warnings:
...
...
mysql-test/t/insert_select.test
View file @
4fd6de8b
...
@@ -372,3 +372,15 @@ INSERT INTO t1 (prev_id) SELECT id
...
@@ -372,3 +372,15 @@ INSERT INTO t1 (prev_id) SELECT id
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# Bug#30384: Having SQL_BUFFER_RESULT option in the
--
echo
# CREATE .. KEY(..) .. SELECT led to creating corrupted index.
--
echo
#
create
table
t1
(
f1
int
);
insert
into
t1
values
(
1
),(
2
),(
3
);
create
table
t2
(
key
(
f1
))
engine
=
myisam
select
sql_buffer_result
f1
from
t1
;
check
table
t2
extended
;
drop
table
t1
,
t2
;
--
echo
##################################################################
mysql-test/t/type_datetime.test
View file @
4fd6de8b
...
@@ -283,6 +283,43 @@ select * from t1 where f1 between 2002010 and 20070101000000;
...
@@ -283,6 +283,43 @@ select * from t1 where f1 between 2002010 and 20070101000000;
select
*
from
t1
where
f1
between
20020101
and
2007010100000
;
select
*
from
t1
where
f1
between
20020101
and
2007010100000
;
drop
table
t1
;
drop
table
t1
;
--
echo
#
--
echo
# Bug#27216: functions with parameters of different date types may
--
echo
# return wrong type of the result.
--
echo
#
create
table
t1
(
f1
date
,
f2
datetime
,
f3
varchar
(
20
));
create
table
t2
as
select
coalesce
(
f1
,
f1
)
as
f4
from
t1
;
desc
t2
;
create
table
t3
as
select
coalesce
(
f1
,
f2
)
as
f4
from
t1
;
desc
t3
;
create
table
t4
as
select
coalesce
(
f2
,
f2
)
as
f4
from
t1
;
desc
t4
;
create
table
t5
as
select
coalesce
(
f1
,
f3
)
as
f4
from
t1
;
desc
t5
;
create
table
t6
as
select
coalesce
(
f2
,
f3
)
as
f4
from
t1
;
desc
t6
;
create
table
t7
as
select
coalesce
(
makedate
(
1997
,
1
),
f2
)
as
f4
from
t1
;
desc
t7
;
create
table
t8
as
select
coalesce
(
cast
(
'01-01-01'
as
datetime
),
f2
)
as
f4
from
t1
;
desc
t8
;
create
table
t9
as
select
case
when
1
then
cast
(
'01-01-01'
as
date
)
when
0
then
cast
(
'01-01-01'
as
date
)
end
as
f4
from
t1
;
desc
t9
;
create
table
t10
as
select
case
when
1
then
cast
(
'01-01-01'
as
datetime
)
when
0
then
cast
(
'01-01-01'
as
datetime
)
end
as
f4
from
t1
;
desc
t10
;
create
table
t11
as
select
if
(
1
,
cast
(
'01-01-01'
as
datetime
),
cast
(
'01-01-01'
as
date
))
as
f4
from
t1
;
desc
t11
;
create
table
t12
as
select
least
(
cast
(
'01-01-01'
as
datetime
),
cast
(
'01-01-01'
as
date
))
as
f4
from
t1
;
desc
t12
;
create
table
t13
as
select
ifnull
(
cast
(
'01-01-01'
as
datetime
),
cast
(
'01-01-01'
as
date
))
as
f4
from
t1
;
desc
t13
;
drop
tables
t1
,
t2
,
t3
,
t4
,
t5
,
t6
,
t7
,
t8
,
t9
,
t10
,
t11
,
t12
,
t13
;
--
echo
###################################################################
#
#
# Test of storing datetime into date fields
# Test of storing datetime into date fields
#
#
...
...
sql/item_cmpfunc.cc
View file @
4fd6de8b
...
@@ -146,6 +146,35 @@ static int agg_cmp_type(Item_result *type, Item **items, uint nitems)
...
@@ -146,6 +146,35 @@ static int agg_cmp_type(Item_result *type, Item **items, uint nitems)
}
}
/**
@brief Aggregates field types from the array of items.
@param[in] items array of items to aggregate the type from
@paran[in] nitems number of items in the array
@details This function aggregates field types from the array of items.
Found type is supposed to be used later as the result field type
of a multi-argument function.
Aggregation itself is performed by the Field::field_type_merge()
function.
@note The term "aggregation" is used here in the sense of inferring the
result type of a function from its argument types.
@return aggregated field type.
*/
enum_field_types
agg_field_type
(
Item
**
items
,
uint
nitems
)
{
uint
i
;
if
(
!
nitems
||
items
[
0
]
->
result_type
()
==
ROW_RESULT
)
return
(
enum_field_types
)
-
1
;
enum_field_types
res
=
items
[
0
]
->
field_type
();
for
(
i
=
1
;
i
<
nitems
;
i
++
)
res
=
Field
::
field_type_merge
(
res
,
items
[
i
]
->
field_type
());
return
res
;
}
/*
/*
Collects different types for comparison of first item with each other items
Collects different types for comparison of first item with each other items
...
@@ -2065,9 +2094,7 @@ Item_func_ifnull::fix_length_and_dec()
...
@@ -2065,9 +2094,7 @@ Item_func_ifnull::fix_length_and_dec()
default:
default:
DBUG_ASSERT
(
0
);
DBUG_ASSERT
(
0
);
}
}
cached_field_type
=
args
[
0
]
->
field_type
();
cached_field_type
=
agg_field_type
(
args
,
2
);
if
(
cached_field_type
!=
args
[
1
]
->
field_type
())
cached_field_type
=
Item_func
::
field_type
();
}
}
...
@@ -2215,11 +2242,13 @@ Item_func_if::fix_length_and_dec()
...
@@ -2215,11 +2242,13 @@ Item_func_if::fix_length_and_dec()
{
{
cached_result_type
=
arg2_type
;
cached_result_type
=
arg2_type
;
collation
.
set
(
args
[
2
]
->
collation
.
collation
);
collation
.
set
(
args
[
2
]
->
collation
.
collation
);
cached_field_type
=
args
[
2
]
->
field_type
();
}
}
else
if
(
null2
)
else
if
(
null2
)
{
{
cached_result_type
=
arg1_type
;
cached_result_type
=
arg1_type
;
collation
.
set
(
args
[
1
]
->
collation
.
collation
);
collation
.
set
(
args
[
1
]
->
collation
.
collation
);
cached_field_type
=
args
[
1
]
->
field_type
();
}
}
else
else
{
{
...
@@ -2233,6 +2262,7 @@ Item_func_if::fix_length_and_dec()
...
@@ -2233,6 +2262,7 @@ Item_func_if::fix_length_and_dec()
{
{
collation
.
set
(
&
my_charset_bin
);
// Number
collation
.
set
(
&
my_charset_bin
);
// Number
}
}
cached_field_type
=
agg_field_type
(
args
+
1
,
2
);
}
}
if
((
cached_result_type
==
DECIMAL_RESULT
)
if
((
cached_result_type
==
DECIMAL_RESULT
)
...
@@ -2582,7 +2612,7 @@ void Item_func_case::fix_length_and_dec()
...
@@ -2582,7 +2612,7 @@ void Item_func_case::fix_length_and_dec()
agg_arg_charsets
(
collation
,
agg
,
nagg
,
MY_COLL_ALLOW_CONV
,
1
))
agg_arg_charsets
(
collation
,
agg
,
nagg
,
MY_COLL_ALLOW_CONV
,
1
))
return
;
return
;
cached_field_type
=
agg_field_type
(
agg
,
nagg
);
/*
/*
Aggregate first expression and all THEN expression types
Aggregate first expression and all THEN expression types
and collations when string comparison
and collations when string comparison
...
@@ -2751,6 +2781,7 @@ my_decimal *Item_func_coalesce::decimal_op(my_decimal *decimal_value)
...
@@ -2751,6 +2781,7 @@ my_decimal *Item_func_coalesce::decimal_op(my_decimal *decimal_value)
void
Item_func_coalesce
::
fix_length_and_dec
()
void
Item_func_coalesce
::
fix_length_and_dec
()
{
{
cached_field_type
=
agg_field_type
(
args
,
arg_count
);
agg_result_type
(
&
hybrid_type
,
args
,
arg_count
);
agg_result_type
(
&
hybrid_type
,
args
,
arg_count
);
switch
(
hybrid_type
)
{
switch
(
hybrid_type
)
{
case
STRING_RESULT
:
case
STRING_RESULT
:
...
...
sql/item_cmpfunc.h
View file @
4fd6de8b
...
@@ -640,6 +640,7 @@ class Item_func_interval :public Item_int_func
...
@@ -640,6 +640,7 @@ class Item_func_interval :public Item_int_func
class
Item_func_coalesce
:
public
Item_func_numhybrid
class
Item_func_coalesce
:
public
Item_func_numhybrid
{
{
protected:
protected:
enum_field_types
cached_field_type
;
Item_func_coalesce
(
Item
*
a
,
Item
*
b
)
:
Item_func_numhybrid
(
a
,
b
)
{}
Item_func_coalesce
(
Item
*
a
,
Item
*
b
)
:
Item_func_numhybrid
(
a
,
b
)
{}
public:
public:
Item_func_coalesce
(
List
<
Item
>
&
list
)
:
Item_func_numhybrid
(
list
)
{}
Item_func_coalesce
(
List
<
Item
>
&
list
)
:
Item_func_numhybrid
(
list
)
{}
...
@@ -652,13 +653,13 @@ class Item_func_coalesce :public Item_func_numhybrid
...
@@ -652,13 +653,13 @@ class Item_func_coalesce :public Item_func_numhybrid
enum
Item_result
result_type
()
const
{
return
hybrid_type
;
}
enum
Item_result
result_type
()
const
{
return
hybrid_type
;
}
const
char
*
func_name
()
const
{
return
"coalesce"
;
}
const
char
*
func_name
()
const
{
return
"coalesce"
;
}
table_map
not_null_tables
()
const
{
return
0
;
}
table_map
not_null_tables
()
const
{
return
0
;
}
enum_field_types
field_type
()
const
{
return
cached_field_type
;
}
};
};
class
Item_func_ifnull
:
public
Item_func_coalesce
class
Item_func_ifnull
:
public
Item_func_coalesce
{
{
protected:
protected:
enum_field_types
cached_field_type
;
bool
field_type_defined
;
bool
field_type_defined
;
public:
public:
Item_func_ifnull
(
Item
*
a
,
Item
*
b
)
:
Item_func_coalesce
(
a
,
b
)
{}
Item_func_ifnull
(
Item
*
a
,
Item
*
b
)
:
Item_func_coalesce
(
a
,
b
)
{}
...
@@ -677,6 +678,7 @@ class Item_func_ifnull :public Item_func_coalesce
...
@@ -677,6 +678,7 @@ class Item_func_ifnull :public Item_func_coalesce
class
Item_func_if
:
public
Item_func
class
Item_func_if
:
public
Item_func
{
{
enum
Item_result
cached_result_type
;
enum
Item_result
cached_result_type
;
enum_field_types
cached_field_type
;
public:
public:
Item_func_if
(
Item
*
a
,
Item
*
b
,
Item
*
c
)
Item_func_if
(
Item
*
a
,
Item
*
b
,
Item
*
c
)
:
Item_func
(
a
,
b
,
c
),
cached_result_type
(
INT_RESULT
)
:
Item_func
(
a
,
b
,
c
),
cached_result_type
(
INT_RESULT
)
...
@@ -686,6 +688,7 @@ class Item_func_if :public Item_func
...
@@ -686,6 +688,7 @@ class Item_func_if :public Item_func
String
*
val_str
(
String
*
str
);
String
*
val_str
(
String
*
str
);
my_decimal
*
val_decimal
(
my_decimal
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
enum
Item_result
result_type
()
const
{
return
cached_result_type
;
}
enum
Item_result
result_type
()
const
{
return
cached_result_type
;
}
enum_field_types
field_type
()
const
{
return
cached_field_type
;
}
bool
fix_fields
(
THD
*
,
Item
**
);
bool
fix_fields
(
THD
*
,
Item
**
);
void
fix_length_and_dec
();
void
fix_length_and_dec
();
uint
decimal_precision
()
const
;
uint
decimal_precision
()
const
;
...
@@ -713,6 +716,7 @@ class Item_func_nullif :public Item_bool_func2
...
@@ -713,6 +716,7 @@ class Item_func_nullif :public Item_bool_func2
bool
is_null
();
bool
is_null
();
};
};
/* Functions to handle the optimized IN */
/* Functions to handle the optimized IN */
...
@@ -1442,6 +1446,7 @@ class Item_cond :public Item_bool_func
...
@@ -1442,6 +1446,7 @@ class Item_cond :public Item_bool_func
Item
*
transform
(
Item_transformer
transformer
,
uchar
*
arg
);
Item
*
transform
(
Item_transformer
transformer
,
uchar
*
arg
);
void
traverse_cond
(
Cond_traverser
,
void
*
arg
,
traverse_order
order
);
void
traverse_cond
(
Cond_traverser
,
void
*
arg
,
traverse_order
order
);
void
neg_arguments
(
THD
*
thd
);
void
neg_arguments
(
THD
*
thd
);
enum_field_types
field_type
()
const
{
return
MYSQL_TYPE_LONGLONG
;
}
bool
subst_argument_checker
(
uchar
**
arg
)
{
return
TRUE
;
}
bool
subst_argument_checker
(
uchar
**
arg
)
{
return
TRUE
;
}
Item
*
compile
(
Item_analyzer
analyzer
,
uchar
**
arg_p
,
Item
*
compile
(
Item_analyzer
analyzer
,
uchar
**
arg_p
,
Item_transformer
transformer
,
uchar
*
arg_t
);
Item_transformer
transformer
,
uchar
*
arg_t
);
...
...
sql/item_func.cc
View file @
4fd6de8b
...
@@ -2238,6 +2238,7 @@ void Item_func_min_max::fix_length_and_dec()
...
@@ -2238,6 +2238,7 @@ void Item_func_min_max::fix_length_and_dec()
else
if
((
cmp_type
==
DECIMAL_RESULT
)
||
(
cmp_type
==
INT_RESULT
))
else
if
((
cmp_type
==
DECIMAL_RESULT
)
||
(
cmp_type
==
INT_RESULT
))
max_length
=
my_decimal_precision_to_length
(
max_int_part
+
decimals
,
decimals
,
max_length
=
my_decimal_precision_to_length
(
max_int_part
+
decimals
,
decimals
,
unsigned_flag
);
unsigned_flag
);
cached_field_type
=
agg_field_type
(
args
,
arg_count
);
}
}
...
...
sql/item_func.h
View file @
4fd6de8b
...
@@ -699,7 +699,8 @@ class Item_func_min_max :public Item_func
...
@@ -699,7 +699,8 @@ class Item_func_min_max :public Item_func
/* An item used for issuing warnings while string to DATETIME conversion. */
/* An item used for issuing warnings while string to DATETIME conversion. */
Item
*
datetime_item
;
Item
*
datetime_item
;
THD
*
thd
;
THD
*
thd
;
protected:
enum_field_types
cached_field_type
;
public:
public:
Item_func_min_max
(
List
<
Item
>
&
list
,
int
cmp_sign_arg
)
:
Item_func
(
list
),
Item_func_min_max
(
List
<
Item
>
&
list
,
int
cmp_sign_arg
)
:
Item_func
(
list
),
cmp_type
(
INT_RESULT
),
cmp_sign
(
cmp_sign_arg
),
compare_as_dates
(
FALSE
),
cmp_type
(
INT_RESULT
),
cmp_sign
(
cmp_sign_arg
),
compare_as_dates
(
FALSE
),
...
@@ -712,6 +713,7 @@ class Item_func_min_max :public Item_func
...
@@ -712,6 +713,7 @@ class Item_func_min_max :public Item_func
enum
Item_result
result_type
()
const
{
return
cmp_type
;
}
enum
Item_result
result_type
()
const
{
return
cmp_type
;
}
bool
result_as_longlong
()
{
return
compare_as_dates
;
};
bool
result_as_longlong
()
{
return
compare_as_dates
;
};
uint
cmp_datetimes
(
ulonglong
*
value
);
uint
cmp_datetimes
(
ulonglong
*
value
);
enum_field_types
field_type
()
const
{
return
cached_field_type
;
}
};
};
class
Item_func_min
:
public
Item_func_min_max
class
Item_func_min
:
public
Item_func_min_max
...
...
sql/item_timefunc.cc
View file @
4fd6de8b
...
@@ -3239,7 +3239,7 @@ void Item_func_str_to_date::fix_length_and_dec()
...
@@ -3239,7 +3239,7 @@ void Item_func_str_to_date::fix_length_and_dec()
String
format_str
(
format_buff
,
sizeof
(
format_buff
),
&
my_charset_bin
),
*
format
;
String
format_str
(
format_buff
,
sizeof
(
format_buff
),
&
my_charset_bin
),
*
format
;
maybe_null
=
1
;
maybe_null
=
1
;
decimals
=
0
;
decimals
=
0
;
cached_field_type
=
MYSQL_TYPE_
STRING
;
cached_field_type
=
MYSQL_TYPE_
DATETIME
;
max_length
=
MAX_DATETIME_FULL_WIDTH
*
MY_CHARSET_BIN_MB_MAXLEN
;
max_length
=
MAX_DATETIME_FULL_WIDTH
*
MY_CHARSET_BIN_MB_MAXLEN
;
cached_timestamp_type
=
MYSQL_TIMESTAMP_NONE
;
cached_timestamp_type
=
MYSQL_TIMESTAMP_NONE
;
format
=
args
[
1
]
->
val_str
(
&
format_str
);
format
=
args
[
1
]
->
val_str
(
&
format_str
);
...
...
sql/mysql_priv.h
View file @
4fd6de8b
...
@@ -1673,6 +1673,7 @@ void flush_thread_cache();
...
@@ -1673,6 +1673,7 @@ void flush_thread_cache();
/* item_func.cc */
/* item_func.cc */
extern
bool
check_reserved_words
(
LEX_STRING
*
name
);
extern
bool
check_reserved_words
(
LEX_STRING
*
name
);
extern
enum_field_types
agg_field_type
(
Item
**
items
,
uint
nitems
);
/* strfunc.cc */
/* strfunc.cc */
ulonglong
find_set
(
TYPELIB
*
lib
,
const
char
*
x
,
uint
length
,
CHARSET_INFO
*
cs
,
ulonglong
find_set
(
TYPELIB
*
lib
,
const
char
*
x
,
uint
length
,
CHARSET_INFO
*
cs
,
...
...
sql/protocol.cc
View file @
4fd6de8b
...
@@ -827,6 +827,7 @@ bool Protocol_text::store(const char *from, size_t length,
...
@@ -827,6 +827,7 @@ bool Protocol_text::store(const char *from, size_t length,
field_types
[
field_pos
]
==
MYSQL_TYPE_DECIMAL
||
field_types
[
field_pos
]
==
MYSQL_TYPE_DECIMAL
||
field_types
[
field_pos
]
==
MYSQL_TYPE_BIT
||
field_types
[
field_pos
]
==
MYSQL_TYPE_BIT
||
field_types
[
field_pos
]
==
MYSQL_TYPE_NEWDECIMAL
||
field_types
[
field_pos
]
==
MYSQL_TYPE_NEWDECIMAL
||
field_types
[
field_pos
]
==
MYSQL_TYPE_NEWDATE
||
(
field_types
[
field_pos
]
>=
MYSQL_TYPE_ENUM
&&
(
field_types
[
field_pos
]
>=
MYSQL_TYPE_ENUM
&&
field_types
[
field_pos
]
<=
MYSQL_TYPE_GEOMETRY
));
field_types
[
field_pos
]
<=
MYSQL_TYPE_GEOMETRY
));
field_pos
++
;
field_pos
++
;
...
...
sql/sql_class.h
View file @
4fd6de8b
...
@@ -2107,7 +2107,7 @@ class select_insert :public select_result_interceptor {
...
@@ -2107,7 +2107,7 @@ 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
,
...
...
sql/sql_insert.cc
View file @
4fd6de8b
...
@@ -2778,7 +2778,8 @@ select_insert::select_insert(TABLE_LIST *table_list_par, TABLE *table_par,
...
@@ -2778,7 +2778,8 @@ 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
;
...
@@ -2964,8 +2965,11 @@ int select_insert::prepare2(void)
...
@@ -2964,8 +2965,11 @@ 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
)
!
thd
->
prelocked_mode
&&
!
is_bulk_insert_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
);
}
}
...
@@ -3084,6 +3088,7 @@ bool select_insert::send_eof()
...
@@ -3084,6 +3088,7 @@ 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
);
...
@@ -3307,7 +3312,10 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
...
@@ -3307,7 +3312,10 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
Create_field
*
cr_field
;
Create_field
*
cr_field
;
Field
*
field
,
*
def_field
;
Field
*
field
,
*
def_field
;
if
(
item
->
type
()
==
Item
::
FUNC_ITEM
)
if
(
item
->
type
()
==
Item
::
FUNC_ITEM
)
if
(
item
->
result_type
()
!=
STRING_RESULT
)
field
=
item
->
tmp_table_field
(
&
tmp_table
);
field
=
item
->
tmp_table_field
(
&
tmp_table
);
else
field
=
item
->
tmp_table_field_from_field_type
(
&
tmp_table
);
else
else
field
=
create_tmp_field
(
thd
,
&
tmp_table
,
item
,
item
->
type
(),
field
=
create_tmp_field
(
thd
,
&
tmp_table
,
item
,
item
->
type
(),
(
Item
***
)
0
,
&
tmp_field
,
&
def_field
,
0
,
0
,
0
,
0
,
(
Item
***
)
0
,
&
tmp_field
,
&
def_field
,
0
,
0
,
0
,
0
,
...
@@ -3518,7 +3526,10 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
...
@@ -3518,7 +3526,10 @@ 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
|
...
...
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