From 01546ee403f1d2893bbc990bcc7d4b6f49fd6639 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 18 Nov 2016 15:40:45 +0400 Subject: MDEV-11245 Move prepare_create_field and sp_prepare_create_field() as methods to Column_definition Some upcoming tasks, e.g.: - MDEV-10577 sql_mode=ORACLE: %TYPE in variable declarations - MDEV-10914 ROW data type for stored routine variables will need to reuse the code implemented in prepare_create_field(), sp_prepare_create_field(), prepare_blob_field(). Before reusing this code, it's a good idea to move these global functions as methods to Column_definition. This patch: - actually moves prepare_create_field(), sp_prepare_create_field(), prepare_blob_field() as methods to Column_definition - makes sp_prepare_create_field() call prepare_create_field() at the end, to avoid duplicate code in MDEV-10577 and MDEV-10914. - changes the return data type for prepare_create_field() from int to bool, to make it consistent with all other functions returning "ok" or "error". - moves the implementation sp_head::fill_field_definition() from sp_head.cc to sp_head.h, as it now uses globally visible Column_definition methods, and is very simple, so inlining is now possible. - removes the unused "LEX*" argument from sp_head::fill_field_definition() --- sql/field.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sql/field.h') diff --git a/sql/field.h b/sql/field.h index b55cc9a0c58..36ac7f5f528 100644 --- a/sql/field.h +++ b/sql/field.h @@ -3872,6 +3872,13 @@ public: set_if_smaller(length, MAX_FIELD_WIDTH - 1); DBUG_RETURN(false); } + + bool prepare_blob_field(THD *thd); + + bool sp_prepare_create_field(THD *thd, MEM_ROOT *mem_root); + + bool prepare_create_field(uint *blob_columns, longlong table_flags); + bool check(THD *thd); bool stored_in_db() const { return !vcol_info || vcol_info->stored_in_db; } -- cgit v1.2.1