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
fef5cf16
Commit
fef5cf16
authored
Mar 02, 2006
by
pem@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/extern/mysql/bk/mysql-5.0
into mysql.com:/extern/mysql/5.0/bug17476/mysql-5.0
parents
7410560b
d85e9295
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
4 deletions
+54
-4
mysql-test/r/sp.result
mysql-test/r/sp.result
+19
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+25
-0
sql/item.h
sql/item.h
+0
-1
sql/item_timefunc.cc
sql/item_timefunc.cc
+10
-3
No files found.
mysql-test/r/sp.result
View file @
fef5cf16
...
...
@@ -4768,4 +4768,23 @@ Handler
Inner
drop procedure bug15011|
drop table t3|
drop procedure if exists bug17476|
create table t3 ( d date )|
insert into t3 values
( '2005-01-01' ), ( '2005-01-02' ), ( '2005-01-03' ),
( '2005-01-04' ), ( '2005-02-01' ), ( '2005-02-02' )|
create procedure bug17476(pDateFormat varchar(10))
select date_format(t3.d, pDateFormat), count(*)
from t3
group by date_format(t3.d, pDateFormat)|
call bug17476('%Y-%m')|
date_format(t3.d, pDateFormat) count(*)
2005-01 4
2005-02 2
call bug17476('%Y-%m')|
date_format(t3.d, pDateFormat) count(*)
2005-01 4
2005-02 2
drop table t3|
drop procedure bug17476|
drop table t1,t2;
mysql-test/t/sp.test
View file @
fef5cf16
...
...
@@ -5615,6 +5615,31 @@ drop procedure bug15011|
drop
table
t3
|
#
# BUG#17476: Stored procedure not returning data when it is called first
# time per connection
#
--
disable_warnings
drop
procedure
if
exists
bug17476
|
--
enable_warnings
create
table
t3
(
d
date
)
|
insert
into
t3
values
(
'2005-01-01'
),
(
'2005-01-02'
),
(
'2005-01-03'
),
(
'2005-01-04'
),
(
'2005-02-01'
),
(
'2005-02-02'
)
|
create
procedure
bug17476
(
pDateFormat
varchar
(
10
))
select
date_format
(
t3
.
d
,
pDateFormat
),
count
(
*
)
from
t3
group
by
date_format
(
t3
.
d
,
pDateFormat
)
|
call
bug17476
(
'%Y-%m'
)
|
call
bug17476
(
'%Y-%m'
)
|
drop
table
t3
|
drop
procedure
bug17476
|
#
# BUG#NNNN: New bug synopsis
#
...
...
sql/item.h
View file @
fef5cf16
...
...
@@ -1585,7 +1585,6 @@ class Item_string :public Item
str_value
.
length
(),
collation
.
collation
);
}
Item
*
safe_charset_converter
(
CHARSET_INFO
*
tocs
);
String
*
const_string
()
{
return
&
str_value
;
}
inline
void
append
(
char
*
str
,
uint
length
)
{
str_value
.
append
(
str
,
length
);
}
void
print
(
String
*
str
);
// to prevent drop fixed flag (no need parent cleanup call)
...
...
sql/item_timefunc.cc
View file @
fef5cf16
...
...
@@ -1605,9 +1605,15 @@ longlong Item_func_sec_to_time::val_int()
void
Item_func_date_format
::
fix_length_and_dec
()
{
/*
Must use this_item() in case it's a local SP variable
(for ->max_length and ->str_value)
*/
Item
*
arg1
=
args
[
1
]
->
this_item
();
decimals
=
0
;
collation
.
set
(
&
my_charset_bin
);
if
(
arg
s
[
1
]
->
type
()
==
STRING_ITEM
)
if
(
arg
1
->
type
()
==
STRING_ITEM
)
{
// Optimize the normal case
fixed_length
=
1
;
...
...
@@ -1615,13 +1621,13 @@ void Item_func_date_format::fix_length_and_dec()
The result is a binary string (no reason to use collation->mbmaxlen
This is becasue make_date_time() only returns binary strings
*/
max_length
=
format_length
(
((
Item_string
*
)
args
[
1
])
->
const_string
()
);
max_length
=
format_length
(
&
arg1
->
str_value
);
}
else
{
fixed_length
=
0
;
/* The result is a binary string (no reason to use collation->mbmaxlen */
max_length
=
min
(
arg
s
[
1
]
->
max_length
,
MAX_BLOB_WIDTH
)
*
10
;
max_length
=
min
(
arg
1
->
max_length
,
MAX_BLOB_WIDTH
)
*
10
;
set_if_smaller
(
max_length
,
MAX_BLOB_WIDTH
);
}
maybe_null
=
1
;
// If wrong date
...
...
@@ -1631,6 +1637,7 @@ void Item_func_date_format::fix_length_and_dec()
bool
Item_func_date_format
::
eq
(
const
Item
*
item
,
bool
binary_cmp
)
const
{
Item_func_date_format
*
item_func
;
if
(
item
->
type
()
!=
FUNC_ITEM
)
return
0
;
if
(
func_name
()
!=
((
Item_func
*
)
item
)
->
func_name
())
...
...
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