summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-08-19 12:25:00 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-08-19 12:25:00 +0300
commitf3fcf5f45c9c09242bfb8762a88c26238458e4c2 (patch)
tree914f1a5d9bd38b9f9d09d0c39306c80c00e21842 /sql/field.h
parent475f69b98587c2a0842e3fcbfe515e4362ded973 (diff)
parent17980e35fafdf0b05c89c11ecafbea96e1cfc5e5 (diff)
downloadmariadb-git-f3fcf5f45c9c09242bfb8762a88c26238458e4c2.tar.gz
Merge 10.5 to 10.6
Diffstat (limited to 'sql/field.h')
-rw-r--r--sql/field.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/sql/field.h b/sql/field.h
index 4b64742b7b3..94a45d23802 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -4561,7 +4561,13 @@ public:
uchar *new_ptr, uint32 length,
uchar *new_null_ptr, uint new_null_bit) override;
void sql_type(String &str) const override;
- inline bool copy()
+ /**
+ Copy blob buffer into internal storage "value" and update record pointer.
+
+ @retval true Memory allocation error
+ @retval false Success
+ */
+ bool copy()
{
uchar *tmp= get_ptr();
if (value.copy((char*) tmp, get_length(), charset()))
@@ -4573,6 +4579,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()
{