diff options
author | Michael Widenius <monty@mariadb.org> | 2016-06-29 09:14:22 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-06-30 11:43:02 +0200 |
commit | db7edfed17efe6bc3684b0fbacc0b0249e4f0fa2 (patch) | |
tree | f1f484057487a73d32f379a5fdaacd53bfa27b5e /sql/item_strfunc.h | |
parent | 23d03a1b1e486da353f20964a1b91068bec209c0 (diff) | |
download | mariadb-git-db7edfed17efe6bc3684b0fbacc0b0249e4f0fa2.tar.gz |
MDEV-7563 Support CHECK constraint as in (or close to) SQL Standard
MDEV-10134 Add full support for DEFAULT
- Added support for using tables with MySQL 5.7 virtual fields,
including MySQL 5.7 syntax
- Better error messages also for old cases
- CREATE ... SELECT now also updates timestamp columns
- Blob can now have default values
- Added new system variable "check_constraint_checks", to turn of
CHECK constraint checking if needed.
- Removed some engine independent tests in suite vcol to only test myisam
- Moved some tests from 'include' to 't'. Should some day be done for all tests.
- FRM version increased to 11 if one uses virtual fields or constraints
- Changed to use a bitmap to check if a field has got a value, instead of
setting HAS_EXPLICIT_VALUE bit in field flags
- Expressions can now be up to 65K in total
- Ensure we are not refering to uninitialized fields when handling virtual fields or defaults
- Changed check_vcol_func_processor() to return a bitmap of used types
- Had to change some functions that calculated cached value in fix_fields to do
this in val() or getdate() instead.
- store_now_in_TIME() now takes a THD argument
- fill_record() now updates default values
- Add a lookahead for NOT NULL, to be able to handle DEFAULT 1+1 NOT NULL
- Automatically generate a name for constraints that doesn't have a name
- Added support for ALTER TABLE DROP CONSTRAINT
- Ensure that partition functions register virtual fields used. This fixes
some bugs when using virtual fields in a partitioning function
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r-- | sql/item_strfunc.h | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 72cdf06adde..3675707db41 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -517,9 +517,9 @@ public: String *val_str(String *); void fix_length_and_dec() { maybe_null=1; max_length = 13; } const char *func_name() const { return "encrypt"; } - bool check_vcol_func_processor(uchar *int_arg) + bool check_vcol_func_processor(uchar *arg) { - return trace_unsupported_by_check_vcol_func_processor(func_name()); + return FALSE; } }; @@ -572,10 +572,10 @@ public: call */ virtual const char *fully_qualified_func_name() const = 0; - bool check_vcol_func_processor(uchar *int_arg) + bool check_vcol_func_processor(uchar *arg) { - return trace_unsupported_by_check_vcol_func_processor( - fully_qualified_func_name()); + return mark_unsupported_function(fully_qualified_func_name(), arg, + VCOL_NON_DETERMINISTIC); } }; @@ -598,19 +598,14 @@ public: class Item_func_user :public Item_func_sysconst { protected: - bool init (const char *user, const char *host); + query_id_t last_query_id; + bool init(THD *thd, const char *user, const char *host); public: - Item_func_user(THD *thd): Item_func_sysconst(thd) - { - str_value.set("", 0, system_charset_info); - } - String *val_str(String *) - { - DBUG_ASSERT(fixed == 1); - return (null_value ? 0 : &str_value); - } - bool fix_fields(THD *thd, Item **ref); + Item_func_user(THD *thd): Item_func_sysconst(thd), last_query_id(0) + {} + + String *val_str(String *); void fix_length_and_dec() { max_length= (username_char_length + @@ -618,10 +613,6 @@ public: } const char *func_name() const { return "user"; } const char *fully_qualified_func_name() const { return "user()"; } - int save_in_field(Field *field, bool no_conversions) - { - return save_str_value_in_field(field, &str_value); - } }; @@ -632,9 +623,15 @@ class Item_func_current_user :public Item_func_user public: Item_func_current_user(THD *thd, Name_resolution_context *context_arg): Item_func_user(thd), context(context_arg) {} - bool fix_fields(THD *thd, Item **ref); + String *val_str(String *); const char *func_name() const { return "current_user"; } const char *fully_qualified_func_name() const { return "current_user()"; } + /* This is because of the stored Name_resolution_context */ + bool check_vcol_func_processor(uchar *arg) + { + return mark_unsupported_function(fully_qualified_func_name(), arg, + VCOL_IMPOSSIBLE); + } }; @@ -647,15 +644,20 @@ public: Item_func_sysconst(thd), context(context_arg) {} bool fix_fields(THD *thd, Item **ref); void fix_length_and_dec() - { max_length= username_char_length * SYSTEM_CHARSET_MBMAXLEN; } - int save_in_field(Field *field, bool no_conversions) - { return save_str_value_in_field(field, &str_value); } + { + max_length= username_char_length * SYSTEM_CHARSET_MBMAXLEN; + maybe_null=1; + } + bool init(THD *thd); + int save_in_field(Field *field, bool no_conversions); const char *func_name() const { return "current_role"; } const char *fully_qualified_func_name() const { return "current_role()"; } - String *val_str(String *) + String *val_str(String *); + /* This is because of the stored Name_resolution_context */ + bool check_vcol_func_processor(uchar *arg) { - DBUG_ASSERT(fixed == 1); - return (null_value ? 0 : &str_value); + return mark_unsupported_function(fully_qualified_func_name(), arg, + VCOL_IMPOSSIBLE); } }; @@ -916,9 +918,9 @@ public: maybe_null=1; max_length=MAX_BLOB_WIDTH; } - bool check_vcol_func_processor(uchar *int_arg) + bool check_vcol_func_processor(uchar *arg) { - return trace_unsupported_by_check_vcol_func_processor(func_name()); + return mark_unsupported_function(func_name(), arg, VCOL_IMPOSSIBLE); } }; @@ -1183,9 +1185,9 @@ public: } const char *func_name() const{ return "uuid"; } String *val_str(String *); - bool check_vcol_func_processor(uchar *int_arg) + bool check_vcol_func_processor(uchar *arg) { - return trace_unsupported_by_check_vcol_func_processor(func_name()); + return mark_unsupported_function(func_name(), arg, VCOL_NON_DETERMINISTIC); } }; |