Below is the list of changes that have just been committed into a local
5.1 repository of hf. When hf 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@stripped, 2007-05-11 18:14:04+05:00, holyfoot@hfmain.(none) +6 -0
Merge mysql.com:/home/hf/work/27921/my51-27921
into mysql.com:/home/hf/work/27957/my51-27957
MERGE: 1.2509.3.1
mysql-test/r/cast.result@stripped, 2007-05-11 18:14:00+05:00, holyfoot@hfmain.(none) +0 -0
Auto merged
MERGE: 1.50.1.1
sql/item_create.cc@stripped, 2007-05-11 18:14:00+05:00, holyfoot@hfmain.(none) +0 -0
Auto merged
MERGE: 1.76.1.1
sql/item_func.cc@stripped, 2007-05-11 18:14:00+05:00, holyfoot@hfmain.(none) +0 -0
Auto merged
MERGE: 1.380.4.1
sql/item_func.h@stripped, 2007-05-11 18:14:00+05:00, holyfoot@hfmain.(none) +0 -0
Auto merged
MERGE: 1.170.1.1
sql/my_decimal.h@stripped, 2007-05-11 18:14:00+05:00, holyfoot@hfmain.(none) +0 -0
Auto merged
MERGE: 1.15.1.1
sql/sql_yacc.yy@stripped, 2007-05-11 18:14:01+05:00, holyfoot@hfmain.(none) +0 -0
Auto merged
MERGE: 1.564.1.2
# 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: holyfoot
# Host: hfmain.(none)
# Root: /home/hf/work/27957/my51-27957/RESYNC
--- 1.77/sql/item_create.cc 2007-05-11 18:14:10 +05:00
+++ 1.78/sql/item_create.cc 2007-05-11 18:14:10 +05:00
@@ -3916,6 +3916,7 @@ Create_func_master_pos_wait Create_func_
Item*
Create_func_master_pos_wait::create_native(THD *thd, LEX_STRING name,
List<Item> *item_list)
+
{
Item *func= NULL;
int arg_count= 0;
@@ -3946,7 +3947,6 @@ Create_func_master_pos_wait::create_nati
my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
break;
}
- }
return func;
}
@@ -4970,11 +4970,15 @@ find_qualified_function_builder(THD *thd
return & Create_sp_func::s_singleton;
}
-Item*
-create_func_cast(THD *thd, Item *a, Cast_target cast_type, int len, int dec,
+
+Item *
+create_func_cast(Item *a, Cast_target cast_type,
+ const char *c_len, const char *c_dec,
CHARSET_INFO *cs)
{
Item *res;
+ ulong len;
+ uint dec;
LINT_INIT(res);
switch (cast_type) {
@@ -4998,18 +5002,21 @@ create_func_cast(THD *thd, Item *a, Cast
break;
case ITEM_CAST_DECIMAL:
{
- int tmp_len= (len>0) ? len : 10;
- if (tmp_len < dec)
+ len= c_len ? atoi(c_len) : 0;
+ dec= c_dec ? atoi(c_dec) : 0;
+ my_decimal_trim(&len, &dec);
+ if (len < dec)
{
my_error(ER_M_BIGGER_THAN_D, MYF(0), "");
return 0;
}
- res= new (thd->mem_root) Item_decimal_typecast(a, tmp_len, dec);
+ res= new (thd->mem_root) Item_decimal_typecast(a, len, dec);
break;
}
case ITEM_CAST_CHAR:
{
CHARSET_INFO *real_cs= (cs ? cs : thd->variables.collation_connection);
+ len= c_len ? atoi(c_len) : -1;
res= new (thd->mem_root) Item_char_typecast(a, len, real_cs);
break;
}
@@ -5022,4 +5029,3 @@ create_func_cast(THD *thd, Item *a, Cast
}
return res;
}
-
--- 1.387/sql/item_func.cc 2007-05-11 18:14:10 +05:00
+++ 1.388/sql/item_func.cc 2007-05-11 18:14:10 +05:00
@@ -1080,9 +1080,26 @@ err:
void Item_decimal_typecast::print(String *str)
{
+ char len_buf[20*3 + 1];
+ char *end;
+ CHARSET_INFO *cs= str->charset();
+
+ uint precision= my_decimal_length_to_precision(max_length, decimals,
+ unsigned_flag);
str->append(STRING_WITH_LEN("cast("));
args[0]->print(str);
- str->append(STRING_WITH_LEN(" as decimal)"));
+ str->append(STRING_WITH_LEN(" as decimal("));
+
+ end=int10_to_str(precision, len_buf,10);
+ str->append(len_buf, (uint32) (end - len_buf));
+
+ str->append(',');
+
+ end=int10_to_str(decimals, len_buf,10);
+ str->append(len_buf, (uint32) (end - len_buf));
+
+ str->append(')');
+ str->append(')');
}
--- 1.171/sql/item_func.h 2007-05-11 18:14:10 +05:00
+++ 1.172/sql/item_func.h 2007-05-11 18:14:10 +05:00
@@ -333,8 +333,8 @@ class Item_decimal_typecast :public Item
public:
Item_decimal_typecast(Item *a, int len, int dec) :Item_func(a)
{
- max_length= len + 2;
decimals= dec;
+ max_length= my_decimal_precision_to_length(len, dec, unsigned_flag);
}
String *val_str(String *str);
double val_real();
--- 1.566/sql/sql_yacc.yy 2007-05-11 18:14:10 +05:00
+++ 1.567/sql/sql_yacc.yy 2007-05-11 18:14:10 +05:00
@@ -6503,15 +6503,13 @@ simple_expr:
}
| BINARY simple_expr %prec NEG
{
- $$= create_func_cast(YYTHD, $2, ITEM_CAST_CHAR, -1, 0,
+ $$= create_func_cast(YYTHD, $2, ITEM_CAST_CHAR, NULL, NULL,
&my_charset_bin);
}
| CAST_SYM '(' expr AS cast_type ')'
{
LEX *lex= Lex;
- $$= create_func_cast(YYTHD, $3, $5,
- lex->length ? atoi(lex->length) : -1,
- lex->dec ? atoi(lex->dec) : 0,
+ $$= create_func_cast(YYTHD, $3, $5, lex->length, lex->dec,
lex->charset);
if (!$$)
MYSQL_YYABORT;
@@ -6520,10 +6518,8 @@ simple_expr:
{ $$= new (YYTHD->mem_root) Item_func_case(* $3, $2, $4 ); }
| CONVERT_SYM '(' expr ',' cast_type ')'
{
- $$= create_func_cast(YYTHD, $3, $5,
- Lex->length ? atoi(Lex->length) : -1,
- Lex->dec ? atoi(Lex->dec) : 0,
- Lex->charset);
+ $$= create_func_cast(YYTHD, $3, $5, Lex->length, Lex->dec,
+ Lex->charset);
if (!$$)
MYSQL_YYABORT;
}
| Thread |
|---|
| • bk commit into 5.1 tree (holyfoot:1.2517) | holyfoot | 11 May |