summaryrefslogtreecommitdiff
path: root/sql/item_create.cc
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2010-07-02 16:38:04 -0300
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2010-07-02 16:38:04 -0300
commit5641fb64b4719774f6c4ba4c1ec85fa5312c5ecf (patch)
tree3c6e29d5a9d1f0a067dcdf4cca5b5747721aee89 /sql/item_create.cc
parentaa4357f3944032ab95137d52342bc7673159fc64 (diff)
parent0eb26fdfa83d2ddd5f3dc3f8cf6e372a55b4c270 (diff)
downloadmariadb-git-5641fb64b4719774f6c4ba4c1ec85fa5312c5ecf.tar.gz
Merge of mysql-5.1-bugteam into mysql-trunk-merge.
Diffstat (limited to 'sql/item_create.cc')
-rw-r--r--sql/item_create.cc26
1 files changed, 8 insertions, 18 deletions
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 5f30a10d1e0..672e59986d5 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -5131,8 +5131,6 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
CHARSET_INFO *cs)
{
Item *UNINIT_VAR(res);
- ulong len;
- uint dec;
switch (cast_type) {
case ITEM_CAST_BINARY:
@@ -5155,11 +5153,10 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
break;
case ITEM_CAST_DECIMAL:
{
- if (c_len == NULL)
- {
- len= 0;
- }
- else
+ ulong len= 0;
+ uint dec= 0;
+
+ if (c_len)
{
ulong decoded_size;
errno= 0;
@@ -5173,11 +5170,7 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
len= decoded_size;
}
- if (c_dec == NULL)
- {
- dec= 0;
- }
- else
+ if (c_dec)
{
ulong decoded_size;
errno= 0;
@@ -5213,12 +5206,9 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
}
case ITEM_CAST_CHAR:
{
+ int len= -1;
CHARSET_INFO *real_cs= (cs ? cs : thd->variables.collation_connection);
- if (c_len == NULL)
- {
- len= LL(-1);
- }
- else
+ if (c_len)
{
ulong decoded_size;
errno= 0;
@@ -5228,7 +5218,7 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
my_error(ER_TOO_BIG_DISPLAYWIDTH, MYF(0), "cast as char", MAX_FIELD_BLOBLENGTH);
return NULL;
}
- len= decoded_size;
+ len= (int) decoded_size;
}
res= new (thd->mem_root) Item_char_typecast(a, len, real_cs);
break;