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
61e33f60
Commit
61e33f60
authored
Nov 10, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/ram/work/mysql-5.0-maint
into mysql.com:/home/ram/work/b32137/b32137.5.0
parents
de1fecc3
1ae087c7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
22 deletions
+41
-22
mysql-test/r/ps.result
mysql-test/r/ps.result
+5
-0
mysql-test/t/ps.test
mysql-test/t/ps.test
+10
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+26
-22
No files found.
mysql-test/r/ps.result
View file @
61e33f60
...
@@ -1136,6 +1136,11 @@ a
...
@@ -1136,6 +1136,11 @@ a
13
13
DEALLOCATE PREPARE st1;
DEALLOCATE PREPARE st1;
DROP TABLE t1;
DROP TABLE t1;
create table t1 (a int, b tinyint);
prepare st1 from 'update t1 set b= (str_to_date(a, a))';
execute st1;
deallocate prepare st1;
drop table t1;
End of 4.1 tests.
End of 4.1 tests.
create table t1 (a varchar(20));
create table t1 (a varchar(20));
insert into t1 values ('foo');
insert into t1 values ('foo');
...
...
mysql-test/t/ps.test
View file @
61e33f60
...
@@ -1210,6 +1210,16 @@ EXECUTE st1;
...
@@ -1210,6 +1210,16 @@ EXECUTE st1;
DEALLOCATE
PREPARE
st1
;
DEALLOCATE
PREPARE
st1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
# Bug #32137: prepared statement crash with str_to_date in update clause
#
create
table
t1
(
a
int
,
b
tinyint
);
prepare
st1
from
'update t1 set b= (str_to_date(a, a))'
;
execute
st1
;
deallocate
prepare
st1
;
drop
table
t1
;
--
echo
End
of
4.1
tests
.
--
echo
End
of
4.1
tests
.
############################# 5.0 tests start ################################
############################# 5.0 tests start ################################
...
...
sql/item_timefunc.cc
View file @
61e33f60
...
@@ -3306,15 +3306,17 @@ Field *Item_func_str_to_date::tmp_table_field(TABLE *t_arg)
...
@@ -3306,15 +3306,17 @@ Field *Item_func_str_to_date::tmp_table_field(TABLE *t_arg)
void
Item_func_str_to_date
::
fix_length_and_dec
()
void
Item_func_str_to_date
::
fix_length_and_dec
()
{
{
char
format_buff
[
64
];
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_STRING
;
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
);
if
((
const_item
=
args
[
1
]
->
const_item
()))
if
(
!
args
[
1
]
->
null_value
&&
(
const_item
=
args
[
1
]
->
const_item
()))
{
char
format_buff
[
64
];
String
format_str
(
format_buff
,
sizeof
(
format_buff
),
&
my_charset_bin
);
String
*
format
=
args
[
1
]
->
val_str
(
&
format_str
);
if
(
!
args
[
1
]
->
null_value
)
{
{
cached_format_type
=
get_date_time_result_type
(
format
->
ptr
(),
cached_format_type
=
get_date_time_result_type
(
format
->
ptr
(),
format
->
length
());
format
->
length
());
...
@@ -3322,13 +3324,13 @@ void Item_func_str_to_date::fix_length_and_dec()
...
@@ -3322,13 +3324,13 @@ void Item_func_str_to_date::fix_length_and_dec()
case
DATE_ONLY
:
case
DATE_ONLY
:
cached_timestamp_type
=
MYSQL_TIMESTAMP_DATE
;
cached_timestamp_type
=
MYSQL_TIMESTAMP_DATE
;
cached_field_type
=
MYSQL_TYPE_DATE
;
cached_field_type
=
MYSQL_TYPE_DATE
;
max_length
=
MAX_DATE_WIDTH
*
MY_CHARSET_BIN_MB_MAXLEN
;
max_length
=
MAX_DATE_WIDTH
*
MY_CHARSET_BIN_MB_MAXLEN
;
break
;
break
;
case
TIME_ONLY
:
case
TIME_ONLY
:
case
TIME_MICROSECOND
:
case
TIME_MICROSECOND
:
cached_timestamp_type
=
MYSQL_TIMESTAMP_TIME
;
cached_timestamp_type
=
MYSQL_TIMESTAMP_TIME
;
cached_field_type
=
MYSQL_TYPE_TIME
;
cached_field_type
=
MYSQL_TYPE_TIME
;
max_length
=
MAX_TIME_WIDTH
*
MY_CHARSET_BIN_MB_MAXLEN
;
max_length
=
MAX_TIME_WIDTH
*
MY_CHARSET_BIN_MB_MAXLEN
;
break
;
break
;
default:
default:
cached_timestamp_type
=
MYSQL_TIMESTAMP_DATETIME
;
cached_timestamp_type
=
MYSQL_TIMESTAMP_DATETIME
;
...
@@ -3336,8 +3338,10 @@ void Item_func_str_to_date::fix_length_and_dec()
...
@@ -3336,8 +3338,10 @@ void Item_func_str_to_date::fix_length_and_dec()
break
;
break
;
}
}
}
}
}
}
}
bool
Item_func_str_to_date
::
get_date
(
MYSQL_TIME
*
ltime
,
uint
fuzzy_date
)
bool
Item_func_str_to_date
::
get_date
(
MYSQL_TIME
*
ltime
,
uint
fuzzy_date
)
{
{
DATE_TIME_FORMAT
date_time_format
;
DATE_TIME_FORMAT
date_time_format
;
...
...
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