summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2018-03-07 19:52:00 +0400
committerAlexander Barkov <bar@mariadb.org>2018-03-07 19:55:12 +0400
commit6ec3de5d2d62400593ee0583e554f1f26187cfcb (patch)
treefcd840ca5059f26dfae31fc4313b276ecd021d9a /sql/field.h
parent2ef2863c30ee72e33a03086163c542a58342850f (diff)
downloadmariadb-git-6ec3de5d2d62400593ee0583e554f1f26187cfcb.tar.gz
MDEV-15497 Wrong empty value in a GEOMETRY column on LOAD DATA
- Adding a new virtual method Field::load_data_set_no_data(). - Overriding Field_timestamp::load_data_set_no_data() and moving the TIMESTAMP specific code there. - Overriding Field_geom::load_data_set_no_data() and implementing GEOMETRY specific behavior, to prevent writing empty strings when the loaded file ends unexpectedly. This fixes the bug. - Adding a new test gis-loaddaata.test. - The test in loaddata.test for CHAR was added simply to record behavior. The CHAR data type did not change its behaviour (only GEOMRYRY did). - Additionally, moving duplicate code into a new method Field::load_data_set_value() and reusing it in three places.
Diffstat (limited to 'sql/field.h')
-rw-r--r--sql/field.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/field.h b/sql/field.h
index 7b473ba7094..370054c850f 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1161,6 +1161,9 @@ public:
{ return null_ptr != 0 || table->maybe_null; }
// Set to NULL on LOAD DATA or LOAD XML
virtual bool load_data_set_null(THD *thd);
+ // Reset when a LOAD DATA file ended unexpectedly
+ virtual bool load_data_set_no_data(THD *thd, bool fixed_format);
+ void load_data_set_value(const char *pos, uint length, CHARSET_INFO *cs);
/* @return true if this field is NULL-able (even if temporarily) */
inline bool real_maybe_null(void) const { return null_ptr != 0; }
@@ -2520,6 +2523,7 @@ public:
return get_equal_const_item_datetime(thd, ctx, const_item);
}
bool load_data_set_null(THD *thd);
+ bool load_data_set_no_data(THD *thd, bool fixed_format);
uint size_of() const { return sizeof(*this); }
};
@@ -3725,6 +3729,7 @@ public:
*/
int reset(void) { return Field_blob::reset() || !maybe_null(); }
bool load_data_set_null(THD *thd);
+ bool load_data_set_no_data(THD *thd, bool fixed_format);
geometry_type get_geometry_type() { return geom_type; };
static geometry_type geometry_type_merge(geometry_type, geometry_type);