summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc52
1 files changed, 41 insertions, 11 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 4a93464b2e8..1056a99a498 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -67,14 +67,19 @@ inline bool Field::marked_for_read() const
ptr < table->record[0] + table->s->reclength)));
}
+/*
+ The name of this function is a bit missleading as in 10.4 we don't
+ have to test anymore if the field is computed. Instead we mark
+ changed fields with DBUG_FIX_WRITE_SET() in table.cc
+*/
inline bool Field::marked_for_write_or_computed() const
{
- return is_stat_field || !table ||
- (!table->write_set ||
- bitmap_is_set(table->write_set, field_index) ||
- (!(ptr >= table->record[0] &&
- ptr < table->record[0] + table->s->reclength)));
+ return (is_stat_field || !table ||
+ (!table->write_set ||
+ bitmap_is_set(table->write_set, field_index) ||
+ (!(ptr >= table->record[0] &&
+ ptr < table->record[0] + table->s->reclength))));
}
@@ -1377,6 +1382,14 @@ error:
}
+bool Field::make_empty_rec_store_default_value(THD *thd, Item *item)
+{
+ DBUG_ASSERT(!(flags & BLOB_FLAG));
+ int res= item->save_in_field(this, true);
+ return res != 0 && res != 3;
+}
+
+
/**
Numeric fields base class constructor.
*/
@@ -2436,6 +2449,15 @@ void Field_null::sql_type(String &res) const
}
+uint Field_null::is_equal(Create_field *new_field)
+{
+ DBUG_ASSERT(!compression_method());
+ return new_field->type_handler() == type_handler() &&
+ new_field->charset == field_charset &&
+ new_field->length == max_display_length();
+}
+
+
/****************************************************************************
Field_row, e.g. for ROW-type SP variables
****************************************************************************/
@@ -7069,14 +7091,10 @@ int Field_str::store(double nr)
return store(buff, (uint)length, &my_charset_numeric);
}
-uint Field::is_equal(Create_field *new_field)
-{
- return new_field->type_handler() == type_handler();
-}
-
-uint Field_str::is_equal(Create_field *new_field)
+uint Field_string::is_equal(Create_field *new_field)
{
+ DBUG_ASSERT(!compression_method());
if (new_field->type_handler() != type_handler())
return IS_EQUAL_NO;
if (new_field->length < max_display_length())
@@ -8763,6 +8781,18 @@ void Field_blob::make_send_field(Send_field *field)
}
+bool Field_blob::make_empty_rec_store_default_value(THD *thd, Item *item)
+{
+ DBUG_ASSERT(flags & BLOB_FLAG);
+ int res= item->save_in_field(this, true);
+ DBUG_ASSERT(res != 3); // Field_blob never returns 3
+ if (res)
+ return true; // E.g. truncation happened
+ reset(); // Clear the pointer to a String, it should not be written to frm
+ return false;
+}
+
+
int Field_blob_compressed::store(const char *from, size_t length,
CHARSET_INFO *cs)
{