summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2004-04-07 16:20:46 +0200
committerunknown <serg@serg.mylan>2004-04-07 16:20:46 +0200
commitb6f2a534fe9cfa4b67afa2ea8ad8c65f043d6302 (patch)
tree8e3d0724200afbcae1e7e7b321b2e166b4f4cd39 /sql/field.h
parent0948f9769b3e3da2e064e65015b86644af4acd78 (diff)
parent736853e501181c33e692653d00d7a84c6ff68f25 (diff)
downloadmariadb-git-b6f2a534fe9cfa4b67afa2ea8ad8c65f043d6302.tar.gz
merged
sql/field.cc: Auto merged sql/item.cc: Auto merged sql/protocol.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/table.cc: Auto merged
Diffstat (limited to 'sql/field.h')
-rw-r--r--sql/field.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/field.h b/sql/field.h
index 75bb96f2f6d..8ebc7412c35 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -98,6 +98,19 @@ public:
virtual void store_time(TIME *ltime,timestamp_type t_type);
virtual double val_real(void)=0;
virtual longlong val_int(void)=0;
+ inline 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(); }