diff options
author | unknown <igor@olga.mysql.com> | 2006-07-19 12:36:55 -0700 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2006-07-19 12:36:55 -0700 |
commit | 6ec7976df97d5c9ced3f2e50339c74f19cda32fd (patch) | |
tree | 377d5e5a5adcc610cd2b471ebc34228d471da602 /sql/item_strfunc.h | |
parent | 5a77e566abb4c486a296c1ad762ddfe740db695e (diff) | |
download | mariadb-git-6ec7976df97d5c9ced3f2e50339c74f19cda32fd.tar.gz |
Fixed bug #17526: incorrect print method
for class Item_func_trim.
For 4.1 it caused wrong output for EXPLAIN EXTENDED commands
if expressions with the TRIM function of two arguments were used.
For 5.0 it caused an error message when trying to select
from a view with the TRIM function of two arguments.
This unexpected error message was due to the fact that the
print method for the class Item_func_trim was inherited from
the class Item_func. Yet the TRIM function does not take a list
of its arguments. Rather it takes the arguments in the form:
[{BOTH | LEADING | TRAILING} [remstr] FROM] str) |
[remstr FROM] str
mysql-test/r/func_str.result:
Added a test case for bug #17526: uncorrect print method
for class Item_func_trim.
mysql-test/t/func_str.test:
Added a test case for bug #17526: incorrect print method
for class Item_func_trim.
sql/item_strfunc.cc:
Fixed bug #17526: incorrect print method
for class Item_func_trim.
Added an implementation for the virtual function print
in the class Item_func_trim.
The implementation takes into account the fact the TRIM
function takes the arguments in the following forms:
[{BOTH | LEADING | TRAILING} [remstr] FROM] str) |
[remstr FROM] str
sql/item_strfunc.h:
Fixed bug #17526: incorrect print method
for class Item_func_trim.
Added an implementation for the virtual function print
in the class Item_func_trim.
Declared a virtual method to return the mode of the TRIM
function: LEADING, TRAILING or BOTH.
Added implementations of this method for Item_func_trim and
its descendants Item_func_ltrim and Item_func_rtrim.
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r-- | sql/item_strfunc.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index f800c17182b..880a19242ca 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -218,6 +218,8 @@ public: String *val_str(String *); void fix_length_and_dec(); const char *func_name() const { return "trim"; } + void print(String *str); + virtual const char *mode_name() const { return "both"; } }; @@ -228,6 +230,7 @@ public: Item_func_ltrim(Item *a) :Item_func_trim(a) {} String *val_str(String *); const char *func_name() const { return "ltrim"; } + const char *mode_name() const { return "leading"; } }; @@ -238,6 +241,7 @@ public: Item_func_rtrim(Item *a) :Item_func_trim(a) {} String *val_str(String *); const char *func_name() const { return "rtrim"; } + const char *mode_name() const { return "trailing"; } }; |