summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/item_func.cc7
-rw-r--r--sql/sql_show.cc4
2 files changed, 9 insertions, 2 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 9180cccabcf..b73436afbcf 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -601,7 +601,12 @@ double Item_func_round::val()
log_10[abs_dec] : pow(10.0,(double) abs_dec));
if (truncate)
- return dec < 0 ? floor(value/tmp)*tmp : floor(value*tmp)/tmp;
+ {
+ if (value >= 0)
+ return dec < 0 ? floor(value/tmp)*tmp : floor(value*tmp)/tmp;
+ else
+ return dec < 0 ? ceil(value/tmp)*tmp : ceil(value*tmp)/tmp;
+ }
return dec < 0 ? rint(value/tmp)*tmp : rint(value*tmp)/tmp;
}
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 8cfac1675b0..5db2df85fbf 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -431,6 +431,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
TABLE *table;
handler *file;
char tmp[MAX_FIELD_WIDTH];
+ Item *item;
DBUG_ENTER("mysqld_show_fields");
DBUG_PRINT("enter",("db: %s table: %s",table_list->db,
table_list->real_name));
@@ -449,7 +450,8 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
field_list.push_back(new Item_empty_string("Type",40));
field_list.push_back(new Item_empty_string("Null",1));
field_list.push_back(new Item_empty_string("Key",3));
- field_list.push_back(new Item_empty_string("Default",NAME_LEN));
+ field_list.push_back(item=new Item_empty_string("Default",NAME_LEN));
+ item->maybe_null=1;
field_list.push_back(new Item_empty_string("Extra",20));
if (verbose)
field_list.push_back(new Item_empty_string("Privileges",80));