Below is the list of changes that have just been committed into a local
5.0 repository of pem. When pem does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2087 06/02/28 18:46:28 pem@stripped +3 -0
Fixed BUG#17476: Stored procedure not returning data when it is called first
time per connection
Used cast without deferring argument (for SP var) in date_format item.
sql/item_timefunc.cc
1.103 06/02/28 18:46:24 pem@stripped +7 -3
Don't cast argument in Item_func_date_format::fix_length_and_dec() without
first deferring a (possible) local SP variable.
mysql-test/t/sp.test
1.178 06/02/28 18:46:24 pem@stripped +25 -0
New test case (BUG#17476)
mysql-test/r/sp.result
1.189 06/02/28 18:46:24 pem@stripped +19 -0
Updated results for new test (BUG#17476).
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: pem
# Host: pem.mysql.com
# Root: /extern/mysql/5.0/bug17476/mysql-5.0-runtime
--- 1.102/sql/item_timefunc.cc 2006-02-02 21:35:16 +01:00
+++ 1.103/sql/item_timefunc.cc 2006-02-28 18:46:24 +01:00
@@ -1605,9 +1605,12 @@
void Item_func_date_format::fix_length_and_dec()
{
+ /* Must use this_item() in case it's a local SP variable */
+ Item *arg1= args[1]->this_item();
+
decimals=0;
collation.set(&my_charset_bin);
- if (args[1]->type() == STRING_ITEM)
+ if (arg1->type() == STRING_ITEM)
{ // Optimize the normal case
fixed_length=1;
@@ -1615,13 +1618,13 @@
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(((Item_string*) arg1)->const_string());
}
else
{
fixed_length=0;
/* The result is a binary string (no reason to use collation->mbmaxlen */
- max_length=min(args[1]->max_length,MAX_BLOB_WIDTH) * 10;
+ max_length=min(arg1->max_length,MAX_BLOB_WIDTH) * 10;
set_if_smaller(max_length,MAX_BLOB_WIDTH);
}
maybe_null=1; // If wrong date
@@ -1631,6 +1634,7 @@
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())
--- 1.188/mysql-test/r/sp.result 2006-02-24 17:34:08 +01:00
+++ 1.189/mysql-test/r/sp.result 2006-02-28 18:46:24 +01:00
@@ -4768,4 +4768,23 @@
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;
--- 1.177/mysql-test/t/sp.test 2006-02-24 17:34:08 +01:00
+++ 1.178/mysql-test/t/sp.test 2006-02-28 18:46:24 +01:00
@@ -5616,6 +5616,31 @@
#
+# 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
#
#--disable_warnings
| Thread |
|---|
| • bk commit into 5.0 tree (pem:1.2087) BUG#17476 | pem | 28 Feb |