diff options
Diffstat (limited to 'sql/field.h')
-rw-r--r-- | sql/field.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/field.h b/sql/field.h index 75bb96f2f6d..e6188d43f57 100644 --- a/sql/field.h +++ b/sql/field.h @@ -98,6 +98,18 @@ public: virtual void store_time(TIME *ltime,timestamp_type t_type); virtual double val_real(void)=0; virtual longlong val_int(void)=0; + String *val_str(String *str) { return val_str(str, str); } + /* val_str(buf1, buf2) gets two buffers and should use them as follows: + if it needs a temp buffer to convert result to string - use buf1 + example Field_tiny::val_str() + if the value exists as a string already - use buf2 + example Field_string::val_str() + consequently, buf2 may be created as 'String buf;' - no memory + will be allocated for it. buf1 will be allocated to hold a + value if it's too small. Using allocated buffer for buf2 may result in + an unnecessary free (and later, may be an alloc). + This trickery is used to decrease a number of malloc calls. + */ virtual String *val_str(String*,String *)=0; virtual Item_result result_type () const=0; virtual Item_result cmp_type () const { return result_type(); } |