summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <malff/marcsql@weblab.(none)>2007-03-01 19:20:47 -0700
committerunknown <malff/marcsql@weblab.(none)>2007-03-01 19:20:47 -0700
commit8c79100730702abc49102e43b71e8f50d5749b21 (patch)
treefb41290501675c692d9aba10ea4b0d9b579b017f /sql
parentea7180f5caad8200c7d20ebd1c2383bf1008d05f (diff)
downloadmariadb-git-8c79100730702abc49102e43b71e8f50d5749b21.tar.gz
Bug#26093 (SELECT BENCHMARK() for SELECT statements does not produce valid
results) Before this fix, the function BENCHMARK() would fail to evaluate expressions like "(select avg(a) from t1)" in debug builds (with an assert), or would report a time of zero in non debug builds. The root cause is that evaluation of DECIMAL_RESULT expressions was not supported in Item_func_benchmark::val_int(). This has been fixed by this change. mysql-test/r/func_misc.result: Added support for DECIMAL_RESULT in Item_func_benchmark::val_int() mysql-test/t/func_misc.test: Added support for DECIMAL_RESULT in Item_func_benchmark::val_int() sql/item_func.cc: Added support for DECIMAL_RESULT in Item_func_benchmark::val_int()
Diffstat (limited to 'sql')
-rw-r--r--sql/item_func.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 1ef77208469..1538d0ed390 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -3456,6 +3456,7 @@ longlong Item_func_benchmark::val_int()
DBUG_ASSERT(fixed == 1);
char buff[MAX_FIELD_WIDTH];
String tmp(buff,sizeof(buff), &my_charset_bin);
+ my_decimal tmp_decimal;
THD *thd=current_thd;
for (ulong loop=0 ; loop < loop_count && !thd->killed; loop++)
@@ -3470,6 +3471,9 @@ longlong Item_func_benchmark::val_int()
case STRING_RESULT:
(void) args[0]->val_str(&tmp);
break;
+ case DECIMAL_RESULT:
+ (void) args[0]->val_decimal(&tmp_decimal);
+ break;
case ROW_RESULT:
default:
// This case should never be chosen