summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-08-18 16:51:52 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-08-18 16:51:52 +0300
commitf84e28c119b495da77e197f7cd18af4048fc3126 (patch)
tree5957008a7725e23cc6331b1251ff5d3f6b725076 /sql/field.h
parentac2857a5fbf851d90171ac55f23385869ee6ba83 (diff)
parente4901d9523ab838ea13bb0278980f8707aa2c581 (diff)
downloadmariadb-git-f84e28c119b495da77e197f7cd18af4048fc3126.tar.gz
Merge 10.3 into 10.4
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()
{