Commit b4c59060 authored by unknown's avatar unknown

Merge bk-internal:/home/bk/mysql-5.0

into  neptunus.(none):/home/msvensson/mysql/mysql-5.0

parents 9f055bf8 ffd4bf58
...@@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc) ...@@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line! # The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb # remember to also change ndb version below and update version.c in ndb
AM_INIT_AUTOMAKE(mysql, 5.0.19) AM_INIT_AUTOMAKE(mysql, 5.0.20)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10
...@@ -19,7 +19,7 @@ SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0 ...@@ -19,7 +19,7 @@ SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
# ndb version # ndb version
NDB_VERSION_MAJOR=5 NDB_VERSION_MAJOR=5
NDB_VERSION_MINOR=0 NDB_VERSION_MINOR=0
NDB_VERSION_BUILD=19 NDB_VERSION_BUILD=20
NDB_VERSION_STATUS="" NDB_VERSION_STATUS=""
# Set all version vars based on $VERSION. How do we do this more elegant ? # Set all version vars based on $VERSION. How do we do this more elegant ?
......
...@@ -4768,4 +4768,23 @@ Handler ...@@ -4768,4 +4768,23 @@ Handler
Inner Inner
drop procedure bug15011| drop procedure bug15011|
drop table t3| 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; drop table t1,t2;
...@@ -5615,6 +5615,31 @@ drop procedure bug15011| ...@@ -5615,6 +5615,31 @@ drop procedure bug15011|
drop table t3| 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 # BUG#NNNN: New bug synopsis
# #
......
...@@ -1585,7 +1585,6 @@ public: ...@@ -1585,7 +1585,6 @@ public:
str_value.length(), collation.collation); str_value.length(), collation.collation);
} }
Item *safe_charset_converter(CHARSET_INFO *tocs); 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); } inline void append(char *str, uint length) { str_value.append(str, length); }
void print(String *str); void print(String *str);
// to prevent drop fixed flag (no need parent cleanup call) // to prevent drop fixed flag (no need parent cleanup call)
......
...@@ -1605,9 +1605,15 @@ longlong Item_func_sec_to_time::val_int() ...@@ -1605,9 +1605,15 @@ longlong Item_func_sec_to_time::val_int()
void Item_func_date_format::fix_length_and_dec() 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; decimals=0;
collation.set(&my_charset_bin); collation.set(&my_charset_bin);
if (args[1]->type() == STRING_ITEM) if (arg1->type() == STRING_ITEM)
{ // Optimize the normal case { // Optimize the normal case
fixed_length=1; fixed_length=1;
...@@ -1615,13 +1621,13 @@ void Item_func_date_format::fix_length_and_dec() ...@@ -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 The result is a binary string (no reason to use collation->mbmaxlen
This is becasue make_date_time() only returns binary strings 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 else
{ {
fixed_length=0; fixed_length=0;
/* The result is a binary string (no reason to use collation->mbmaxlen */ /* 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); set_if_smaller(max_length,MAX_BLOB_WIDTH);
} }
maybe_null=1; // If wrong date maybe_null=1; // If wrong date
...@@ -1631,6 +1637,7 @@ void Item_func_date_format::fix_length_and_dec() ...@@ -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 bool Item_func_date_format::eq(const Item *item, bool binary_cmp) const
{ {
Item_func_date_format *item_func; Item_func_date_format *item_func;
if (item->type() != FUNC_ITEM) if (item->type() != FUNC_ITEM)
return 0; return 0;
if (func_name() != ((Item_func*) item)->func_name()) if (func_name() != ((Item_func*) item)->func_name())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment