summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/field.h')
-rw-r--r--sql/field.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/sql/field.h b/sql/field.h
index 477c64727b3..5c2ba4c5c84 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -4030,6 +4030,12 @@ public:
uchar *new_ptr, uint32 length,
uchar *new_null_ptr, uint new_null_bit);
void sql_type(String &str) const;
+ /**
+ Copy blob buffer into internal storage "value" and update record pointer.
+
+ @retval true Memory allocation error
+ @retval false Success
+ */
inline bool copy()
{
uchar *tmp= get_ptr();
@@ -4042,6 +4048,33 @@ public:
memcpy(ptr+packlength, &tmp, sizeof(char*));
return 0;
}
+ void swap(String &inout, bool set_read_value)
+ {
+ if (set_read_value)
+ read_value.swap(inout);
+ else
+ value.swap(inout);
+ }
+ /**
+ Return pointer to blob cache or NULL if not cached.
+ */
+ String * cached(bool *set_read_value)
+ {
+ char *tmp= (char *) get_ptr();
+ if (!value.is_empty() && tmp == value.ptr())
+ {
+ *set_read_value= false;
+ return &value;
+ }
+
+ if (!read_value.is_empty() && tmp == read_value.ptr())
+ {
+ *set_read_value= true;
+ return &read_value;
+ }
+
+ return NULL;
+ }
/* store value for the duration of the current read record */
inline void swap_value_and_read_value()
{