mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
System Versioning pre0.12
Merge remote-tracking branch 'origin/archive/2017-10-17' into 10.3
This commit is contained in:
95
sql/field.h
95
sql/field.h
@ -673,6 +673,14 @@ public:
|
||||
static void operator delete(void *ptr, MEM_ROOT *mem_root)
|
||||
{ DBUG_ASSERT(0); }
|
||||
|
||||
/**
|
||||
Used by System Versioning.
|
||||
*/
|
||||
virtual void set_max()
|
||||
{ DBUG_ASSERT(0); }
|
||||
virtual bool is_max()
|
||||
{ DBUG_ASSERT(0); return false; }
|
||||
|
||||
uchar *ptr; // Position to field in record
|
||||
/**
|
||||
Byte where the @c NULL bit is stored inside a record. If this Field is a
|
||||
@ -1000,6 +1008,9 @@ public:
|
||||
}
|
||||
bool set_explicit_default(Item *value);
|
||||
|
||||
virtual my_time_t get_timestamp(const uchar *pos= NULL, ulong *sec_part= NULL) const
|
||||
{ DBUG_ASSERT(0); return 0; }
|
||||
|
||||
/**
|
||||
Evaluates the @c UPDATE default function, if one exists, and stores the
|
||||
result in the record buffer. If no such function exists for the column,
|
||||
@ -1439,6 +1450,16 @@ public:
|
||||
FIELD_FLAGS_COLUMN_FORMAT;
|
||||
}
|
||||
|
||||
bool vers_sys_field() const
|
||||
{
|
||||
return flags & (VERS_SYS_START_FLAG | VERS_SYS_END_FLAG);
|
||||
}
|
||||
|
||||
virtual bool vers_trx_id() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
Validate a non-null field value stored in the given record
|
||||
according to the current thread settings, e.g. sql_mode.
|
||||
@ -2146,6 +2167,57 @@ public:
|
||||
{
|
||||
return unpack_int64(to, from, from_end);
|
||||
}
|
||||
|
||||
void set_max();
|
||||
bool is_max();
|
||||
};
|
||||
|
||||
|
||||
class Field_vers_trx_id :public Field_longlong {
|
||||
MYSQL_TIME cache;
|
||||
ulonglong cached;
|
||||
public:
|
||||
Field_vers_trx_id(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
|
||||
uchar null_bit_arg, enum utype unireg_check_arg,
|
||||
const LEX_CSTRING *field_name_arg, bool zero_arg,
|
||||
bool unsigned_arg)
|
||||
: Field_longlong(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
|
||||
unireg_check_arg, field_name_arg, zero_arg,
|
||||
unsigned_arg),
|
||||
cached(0)
|
||||
{}
|
||||
enum_field_types real_type() const { return MYSQL_TYPE_LONGLONG; }
|
||||
enum_field_types type() const { return MYSQL_TYPE_LONGLONG;}
|
||||
uint size_of() const { return sizeof(*this); }
|
||||
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate, ulonglong trx_id);
|
||||
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
|
||||
{
|
||||
return get_date(ltime, fuzzydate, (ulonglong) val_int());
|
||||
}
|
||||
bool test_if_equality_guarantees_uniqueness(const Item *item) const;
|
||||
bool can_optimize_keypart_ref(const Item_bool_func *cond,
|
||||
const Item *item) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool can_optimize_group_min_max(const Item_bool_func *cond,
|
||||
const Item *const_item) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool can_optimize_range(const Item_bool_func *cond,
|
||||
const Item *item,
|
||||
bool is_eq_func) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/* cmp_type() cannot be TIME_RESULT, because we want to compare this field against
|
||||
integers. But in all other cases we treat it as TIME_RESULT! */
|
||||
bool vers_trx_id() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -2561,8 +2633,10 @@ public:
|
||||
{
|
||||
return memcmp(a_ptr, b_ptr, pack_length());
|
||||
}
|
||||
void set_max();
|
||||
bool is_max();
|
||||
void store_TIME(my_time_t timestamp, ulong sec_part);
|
||||
my_time_t get_timestamp(const uchar *pos, ulong *sec_part) const;
|
||||
my_time_t get_timestamp(const uchar *pos= NULL, ulong *sec_part= NULL) const;
|
||||
uint size_of() const { return sizeof(*this); }
|
||||
};
|
||||
|
||||
@ -3982,7 +4056,8 @@ Field *make_field(TABLE_SHARE *share, MEM_ROOT *mem_root,
|
||||
CHARSET_INFO *cs,
|
||||
Field::geometry_type geom_type, uint srid,
|
||||
Field::utype unireg_check,
|
||||
TYPELIB *interval, const LEX_CSTRING *field_name);
|
||||
TYPELIB *interval, const LEX_CSTRING *field_name,
|
||||
uint32 flags);
|
||||
|
||||
/*
|
||||
Create field class for CREATE TABLE
|
||||
@ -4036,6 +4111,12 @@ class Column_definition: public Sql_alloc,
|
||||
public:
|
||||
LEX_CSTRING field_name;
|
||||
LEX_CSTRING comment; // Comment for field
|
||||
enum enum_column_versioning
|
||||
{
|
||||
VERSIONING_NOT_SET,
|
||||
WITH_VERSIONING,
|
||||
WITHOUT_VERSIONING
|
||||
};
|
||||
Item *on_update; // ON UPDATE NOW()
|
||||
/*
|
||||
At various stages in execution this can be length of field in bytes or
|
||||
@ -4068,6 +4149,9 @@ public:
|
||||
*default_value, // Default value
|
||||
*check_constraint; // Check constraint
|
||||
|
||||
enum_column_versioning versioning;
|
||||
bool implicit_not_null;
|
||||
|
||||
Column_definition()
|
||||
:Type_handler_hybrid_field_type(&type_handler_null),
|
||||
compression_method_ptr(0),
|
||||
@ -4077,10 +4161,13 @@ public:
|
||||
interval(0), charset(&my_charset_bin),
|
||||
srid(0), geom_type(Field::GEOM_GEOMETRY),
|
||||
option_list(NULL), pack_flag(0),
|
||||
vcol_info(0), default_value(0), check_constraint(0)
|
||||
vcol_info(0), default_value(0), check_constraint(0),
|
||||
versioning(VERSIONING_NOT_SET),
|
||||
implicit_not_null(false)
|
||||
{
|
||||
interval_list.empty();
|
||||
}
|
||||
|
||||
Column_definition(THD *thd, Field *field, Field *orig_field);
|
||||
void set_attributes(const Lex_field_type_st &type, CHARSET_INFO *cs);
|
||||
void create_length_to_internal_length_null()
|
||||
@ -4207,7 +4294,7 @@ public:
|
||||
(uint32)length, null_pos, null_bit,
|
||||
pack_flag, type_handler(), charset,
|
||||
geom_type, srid, unireg_check, interval,
|
||||
field_name_arg);
|
||||
field_name_arg, flags);
|
||||
}
|
||||
Field *make_field(TABLE_SHARE *share, MEM_ROOT *mem_root,
|
||||
const LEX_CSTRING *field_name_arg) const
|
||||
|
Reference in New Issue
Block a user