Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
533506b4
Commit
533506b4
authored
May 10, 2017
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-12777 Change Lex_field_type_st::m_type from enum_field_types to Type_handler pointer
parent
19163841
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
159 additions
and
127 deletions
+159
-127
sql/field.cc
sql/field.cc
+1
-1
sql/sql_class.cc
sql/sql_class.cc
+11
-0
sql/sql_class.h
sql/sql_class.h
+1
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+61
-51
sql/sql_yacc_ora.yy
sql/sql_yacc_ora.yy
+74
-65
sql/structs.h
sql/structs.h
+11
-10
No files found.
sql/field.cc
View file @
533506b4
...
...
@@ -9787,7 +9787,7 @@ void Column_definition::set_attributes(const Lex_field_type_st &type,
DBUG_ASSERT
(
length
==
0
);
DBUG_ASSERT
(
decimals
==
0
);
set_handler
_by_real_type
(
type
.
field_type
());
set_handler
(
type
.
type_handler
());
charset
=
cs
;
if
(
type
.
length
())
...
...
sql/sql_class.cc
View file @
533506b4
...
...
@@ -1246,6 +1246,17 @@ extern "C" my_thread_id next_thread_id_noinline()
}
#endif
const
Type_handler
*
THD
::
type_handler_for_date
()
const
{
if
(
!
(
variables
.
sql_mode
&
MODE_ORACLE
))
return
&
type_handler_newdate
;
if
(
opt_mysql56_temporal_format
)
return
&
type_handler_datetime2
;
return
&
type_handler_datetime
;
}
/*
Init common variables that has to be reset on start and on change_user
*/
...
...
sql/sql_class.h
View file @
533506b4
...
...
@@ -3192,6 +3192,7 @@ class THD :public Statement,
{
return
!
MY_TEST
(
variables
.
sql_mode
&
MODE_NO_BACKSLASH_ESCAPES
);
}
const
Type_handler
*
type_handler_for_date
()
const
;
inline
my_time_t
query_start
()
{
query_start_used
=
1
;
return
start_time
;
}
inline
ulong
query_start_sec_part
()
{
query_start_sec_part_used
=
1
;
return
start_time_sec_part
;
}
...
...
sql/sql_yacc.yy
View file @
533506b4
...
...
@@ -782,6 +782,7 @@ Virtual_column_info *add_virtual_expression(THD *thd, Item *expr)
Create_field *create_field;
Spvar_definition *spvar_definition;
Row_definition_list *spvar_definition_list;
const Type_handler *type_handler;
CHARSET_INFO *charset;
Condition_information_item *cond_info_item;
DYNCALL_CREATE_DEF *dyncol_def;
...
...
@@ -836,7 +837,6 @@ Virtual_column_info *add_virtual_expression(THD *thd, Item *expr)
enum Item_udftype udf_type;
enum Key::Keytype key_type;
enum Statement_information_item::Name stmt_info_item_name;
enum enum_field_types field_type;
enum enum_filetype filetype;
enum enum_tx_isolation tx_isolation;
enum enum_var_type var_type;
...
...
@@ -1645,7 +1645,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <string>
text_string hex_or_bin_String opt_gconcat_separator
%type <
field_type
> int_type real_type
%type <
type_handler
> int_type real_type
%type <Lex_field_type> type_with_opt_collate field_type
field_type_numeric
...
...
@@ -6296,7 +6296,7 @@ field_type_numeric:
| real_type opt_precision field_options { $$.set($1, $2); }
| FLOAT_SYM float_options field_options
{
$$.set(
MYSQL_TYPE_FLOAT
, $2);
$$.set(
&type_handler_float
, $2);
if ($2.length() && !$2.dec())
{
int err;
...
...
@@ -6305,60 +6305,60 @@ field_type_numeric:
my_yyabort_error((ER_WRONG_FIELD_SPEC, MYF(0),
Lex->last_field->field_name.str));
if (tmp_length > PRECISION_FOR_FLOAT)
$$.set(
MYSQL_TYPE_DOUBLE
);
$$.set(
&type_handler_double
);
else
$$.set(
MYSQL_TYPE_FLOAT
);
$$.set(
&type_handler_float
);
}
}
| BIT_SYM opt_field_length_default_1
{
$$.set(
MYSQL_TYPE_BIT
, $2);
$$.set(
&type_handler_bit
, $2);
}
| BOOL_SYM
{
$$.set(
MYSQL_TYPE_TINY
, "1");
$$.set(
&type_handler_tiny
, "1");
}
| BOOLEAN_SYM
{
$$.set(
MYSQL_TYPE_TINY
, "1");
$$.set(
&type_handler_tiny
, "1");
}
| DECIMAL_SYM float_options field_options
{ $$.set(
MYSQL_TYPE_NEWDECIMAL
, $2);}
{ $$.set(
&type_handler_newdecimal
, $2);}
| NUMERIC_SYM float_options field_options
{ $$.set(
MYSQL_TYPE_NEWDECIMAL
, $2);}
{ $$.set(
&type_handler_newdecimal
, $2);}
| FIXED_SYM float_options field_options
{ $$.set(
MYSQL_TYPE_NEWDECIMAL
, $2);}
{ $$.set(
&type_handler_newdecimal
, $2);}
;
field_type_string:
char opt_field_length_default_1 opt_binary
{
$$.set(
MYSQL_TYPE_STRING
, $2);
$$.set(
&type_handler_string
, $2);
}
| nchar opt_field_length_default_1 opt_bin_mod
{
$$.set(
MYSQL_TYPE_STRING
, $2);
$$.set(
&type_handler_string
, $2);
bincmp_collation(national_charset_info, $3);
}
| BINARY opt_field_length_default_1
{
Lex->charset=&my_charset_bin;
$$.set(
MYSQL_TYPE_STRING
, $2);
$$.set(
&type_handler_string
, $2);
}
| varchar field_length opt_binary
{
$$.set(
MYSQL_TYPE_VARCHAR
, $2);
$$.set(
&type_handler_varchar
, $2);
}
| nvarchar field_length opt_bin_mod
{
$$.set(
MYSQL_TYPE_VARCHAR
, $2);
$$.set(
&type_handler_varchar
, $2);
bincmp_collation(national_charset_info, $3);
}
| VARBINARY field_length
{
Lex->charset=&my_charset_bin;
$$.set(
MYSQL_TYPE_VARCHAR
, $2);
$$.set(
&type_handler_varchar
, $2);
}
;
...
...
@@ -6379,18 +6379,23 @@ field_type_temporal:
buff, "YEAR(4)");
}
}
$$.set(
MYSQL_TYPE_YEAR
, $2);
$$.set(
&type_handler_year
, $2);
}
| DATE_SYM
{ $$.set(MYSQL_TYPE_DATE); }
| DATE_SYM { $$.set(thd->type_handler_for_date()); }
| TIME_SYM opt_field_length
{ $$.set(opt_mysql56_temporal_format ?
MYSQL_TYPE_TIME2 : MYSQL_TYPE_TIME, $2); }
{
$$.set(opt_mysql56_temporal_format ?
static_cast<const Type_handler*>(&type_handler_time2) :
static_cast<const Type_handler*>(&type_handler_time),
$2);
}
| TIMESTAMP opt_field_length
{
if (thd->variables.sql_mode & MODE_MAXDB)
$$.set(opt_mysql56_temporal_format ?
MYSQL_TYPE_DATETIME2 : MYSQL_TYPE_DATETIME, $2);
static_cast<const Type_handler*>(&type_handler_datetime2) :
static_cast<const Type_handler*>(&type_handler_datetime),
$2);
else
{
/*
...
...
@@ -6399,13 +6404,19 @@ field_type_temporal:
*/
if (!opt_explicit_defaults_for_timestamp)
Lex->last_field->flags|= NOT_NULL_FLAG;
$$.set(opt_mysql56_temporal_format ? MYSQL_TYPE_TIMESTAMP2
: MYSQL_TYPE_TIMESTAMP, $2);
$$.set(opt_mysql56_temporal_format ?
static_cast<const Type_handler*>(&type_handler_timestamp2):
static_cast<const Type_handler*>(&type_handler_timestamp),
$2);
}
}
| DATETIME opt_field_length
{ $$.set(opt_mysql56_temporal_format ?
MYSQL_TYPE_DATETIME2 : MYSQL_TYPE_DATETIME, $2); }
{
$$.set(opt_mysql56_temporal_format ?
static_cast<const Type_handler*>(&type_handler_datetime2) :
static_cast<const Type_handler*>(&type_handler_datetime),
$2);
}
;
...
...
@@ -6413,19 +6424,19 @@ field_type_lob:
TINYBLOB
{
Lex->charset=&my_charset_bin;
$$.set(
MYSQL_TYPE_TINY_BLOB
);
$$.set(
&type_handler_tiny_blob
);
}
| BLOB_SYM opt_field_length
{
Lex->charset=&my_charset_bin;
$$.set(
MYSQL_TYPE_BLOB
, $2);
$$.set(
&type_handler_blob
, $2);
}
| spatial_type float_options srid_option
{
#ifdef HAVE_SPATIAL
Lex->charset=&my_charset_bin;
Lex->last_field->geom_type= $1;
$$.set(
MYSQL_TYPE_GEOMETRY
, $2);
$$.set(
&type_handler_geometry
, $2);
#else
my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name,
sym_group_geom.needed_define));
...
...
@@ -6434,38 +6445,38 @@ field_type_lob:
| MEDIUMBLOB
{
Lex->charset=&my_charset_bin;
$$.set(
MYSQL_TYPE_MEDIUM_BLOB
);
$$.set(
&type_handler_medium_blob
);
}
| LONGBLOB
{
Lex->charset=&my_charset_bin;
$$.set(
MYSQL_TYPE_LONG_BLOB
);
$$.set(
&type_handler_long_blob
);
}
| LONG_SYM VARBINARY
{
Lex->charset=&my_charset_bin;
$$.set(
MYSQL_TYPE_MEDIUM_BLOB
);
$$.set(
&type_handler_medium_blob
);
}
| LONG_SYM varchar opt_binary
{ $$.set(
MYSQL_TYPE_MEDIUM_BLOB
); }
{ $$.set(
&type_handler_medium_blob
); }
| TINYTEXT opt_binary
{ $$.set(
MYSQL_TYPE_TINY_BLOB
); }
{ $$.set(
&type_handler_tiny_blob
); }
| TEXT_SYM opt_field_length opt_binary
{ $$.set(
MYSQL_TYPE_BLOB
, $2); }
{ $$.set(
&type_handler_blob
, $2); }
| MEDIUMTEXT opt_binary
{ $$.set(
MYSQL_TYPE_MEDIUM_BLOB
); }
{ $$.set(
&type_handler_medium_blob
); }
| LONGTEXT opt_binary
{ $$.set(
MYSQL_TYPE_LONG_BLOB
); }
{ $$.set(
&type_handler_long_blob
); }
| LONG_SYM opt_binary
{ $$.set(
MYSQL_TYPE_MEDIUM_BLOB
); }
{ $$.set(
&type_handler_medium_blob
); }
;
field_type_misc:
ENUM '(' string_list ')' opt_binary
{ $$.set(
MYSQL_TYPE_ENUM
); }
{ $$.set(
&type_handler_enum
); }
| SET '(' string_list ')' opt_binary
{ $$.set(
MYSQL_TYPE_SET
); }
{ $$.set(
&type_handler_set
); }
;
spatial_type:
...
...
@@ -6502,23 +6513,22 @@ nvarchar:
;
int_type:
INT_SYM { $$=
MYSQL_TYPE_LONG
; }
| TINYINT { $$=
MYSQL_TYPE_TINY
; }
| SMALLINT { $$=
MYSQL_TYPE_SHORT
; }
| MEDIUMINT { $$=
MYSQL_TYPE_INT
24; }
| BIGINT { $$=
MYSQL_TYPE_LONGLONG
; }
INT_SYM { $$=
&type_handler_long
; }
| TINYINT { $$=
&type_handler_tiny
; }
| SMALLINT { $$=
&type_handler_short
; }
| MEDIUMINT { $$=
&type_handler_int
24; }
| BIGINT { $$=
&type_handler_longlong
; }
;
real_type:
REAL
{
$$= thd->variables.sql_mode & MODE_REAL_AS_FLOAT ?
MYSQL_TYPE_FLOAT : MYSQL_TYPE_DOUBLE;
static_cast<const Type_handler *>(&type_handler_float) :
static_cast<const Type_handler *>(&type_handler_double);
}
| DOUBLE_SYM
{ $$=MYSQL_TYPE_DOUBLE; }
| DOUBLE_SYM PRECISION
{ $$=MYSQL_TYPE_DOUBLE; }
| DOUBLE_SYM { $$= &type_handler_double; }
| DOUBLE_SYM PRECISION { $$= &type_handler_double; }
;
srid_option:
...
...
sql/sql_yacc_ora.yy
View file @
533506b4
...
...
@@ -191,6 +191,7 @@ void ORAerror(THD *thd, const char *s)
Create_field *create_field;
Spvar_definition *spvar_definition;
Row_definition_list *spvar_definition_list;
const Type_handler *type_handler;
CHARSET_INFO *charset;
Condition_information_item *cond_info_item;
DYNCALL_CREATE_DEF *dyncol_def;
...
...
@@ -245,7 +246,6 @@ void ORAerror(THD *thd, const char *s)
enum Item_udftype udf_type;
enum Key::Keytype key_type;
enum Statement_information_item::Name stmt_info_item_name;
enum enum_field_types field_type;
enum enum_filetype filetype;
enum enum_tx_isolation tx_isolation;
enum enum_var_type var_type;
...
...
@@ -1059,7 +1059,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <string>
text_string hex_or_bin_String opt_gconcat_separator
%type <
field_type
> int_type real_type
%type <
type_handler
> int_type real_type
%type <Lex_field_type> type_with_opt_collate field_type
sp_param_type_with_opt_collate
...
...
@@ -6178,7 +6178,7 @@ field_type_numeric:
| real_type opt_precision field_options { $$.set($1, $2); }
| FLOAT_SYM float_options field_options
{
$$.set(
MYSQL_TYPE_FLOAT
, $2);
$$.set(
&type_handler_float
, $2);
if ($2.length() && !$2.dec())
{
int err;
...
...
@@ -6187,76 +6187,76 @@ field_type_numeric:
my_yyabort_error((ER_WRONG_FIELD_SPEC, MYF(0),
Lex->last_field->field_name.str));
if (tmp_length > PRECISION_FOR_FLOAT)
$$.set(
MYSQL_TYPE_DOUBLE
);
$$.set(
&type_handler_double
);
else
$$.set(
MYSQL_TYPE_FLOAT
);
$$.set(
&type_handler_float
);
}
}
| BIT_SYM opt_field_length_default_1
{
$$.set(
MYSQL_TYPE_BIT
, $2);
$$.set(
&type_handler_bit
, $2);
}
| BOOL_SYM
{
$$.set(
MYSQL_TYPE_TINY
, "1");
$$.set(
&type_handler_tiny
, "1");
}
| BOOLEAN_SYM
{
$$.set(
MYSQL_TYPE_TINY
, "1");
$$.set(
&type_handler_tiny
, "1");
}
| DECIMAL_SYM float_options field_options
{ $$.set(
MYSQL_TYPE_NEWDECIMAL
, $2);}
{ $$.set(
&type_handler_newdecimal
, $2);}
| NUMBER_SYM float_options field_options
{
if ($2.length() != 0)
$$.set(
MYSQL_TYPE_NEWDECIMAL
, $2);
$$.set(
&type_handler_newdecimal
, $2);
else
$$.set(
MYSQL_TYPE_DOUBLE
);
$$.set(
&type_handler_double
);
}
| NUMERIC_SYM float_options field_options
{ $$.set(
MYSQL_TYPE_NEWDECIMAL
, $2);}
{ $$.set(
&type_handler_newdecimal
, $2);}
| FIXED_SYM float_options field_options
{ $$.set(
MYSQL_TYPE_NEWDECIMAL
, $2);}
{ $$.set(
&type_handler_newdecimal
, $2);}
;
field_type_string:
char opt_field_length_default_1 opt_binary
{
$$.set(
MYSQL_TYPE_STRING
, $2);
$$.set(
&type_handler_string
, $2);
}
| nchar opt_field_length_default_1 opt_bin_mod
{
$$.set(
MYSQL_TYPE_STRING
, $2);
$$.set(
&type_handler_string
, $2);
bincmp_collation(national_charset_info, $3);
}
| BINARY opt_field_length_default_1
{
Lex->charset=&my_charset_bin;
$$.set(
MYSQL_TYPE_STRING
, $2);
$$.set(
&type_handler_string
, $2);
}
| varchar field_length opt_binary
{
$$.set(
MYSQL_TYPE_VARCHAR
, $2);
$$.set(
&type_handler_varchar
, $2);
}
| VARCHAR2 field_length opt_binary
{
$$.set(
MYSQL_TYPE_VARCHAR
, $2);
$$.set(
&type_handler_varchar
, $2);
}
| nvarchar field_length opt_bin_mod
{
$$.set(
MYSQL_TYPE_VARCHAR
, $2);
$$.set(
&type_handler_varchar
, $2);
bincmp_collation(national_charset_info, $3);
}
| VARBINARY field_length
{
Lex->charset=&my_charset_bin;
$$.set(
MYSQL_TYPE_VARCHAR
, $2);
$$.set(
&type_handler_varchar
, $2);
}
| RAW field_length
{
Lex->charset= &my_charset_bin;
$$.set(
MYSQL_TYPE_VARCHAR
, $2);
$$.set(
&type_handler_varchar
, $2);
}
;
...
...
@@ -6264,40 +6264,40 @@ field_type_string:
sp_param_field_type_string:
char opt_field_length_default_sp_param_char opt_binary
{
$$.set(
MYSQL_TYPE_VARCHAR
, $2);
$$.set(
&type_handler_varchar
, $2);
}
| nchar opt_field_length_default_sp_param_char opt_bin_mod
{
$$.set(
MYSQL_TYPE_VARCHAR
, $2);
$$.set(
&type_handler_varchar
, $2);
bincmp_collation(national_charset_info, $3);
}
| BINARY opt_field_length_default_sp_param_char
{
Lex->charset=&my_charset_bin;
$$.set(
MYSQL_TYPE_VARCHAR
, $2);
$$.set(
&type_handler_varchar
, $2);
}
| varchar opt_field_length_default_sp_param_varchar opt_binary
{
$$.set(
MYSQL_TYPE_VARCHAR
, $2);
$$.set(
&type_handler_varchar
, $2);
}
| VARCHAR2 opt_field_length_default_sp_param_varchar opt_binary
{
$$.set(
MYSQL_TYPE_VARCHAR
, $2);
$$.set(
&type_handler_varchar
, $2);
}
| nvarchar opt_field_length_default_sp_param_varchar opt_bin_mod
{
$$.set(
MYSQL_TYPE_VARCHAR
, $2);
$$.set(
&type_handler_varchar
, $2);
bincmp_collation(national_charset_info, $3);
}
| VARBINARY opt_field_length_default_sp_param_varchar
{
Lex->charset= &my_charset_bin;
$$.set(
MYSQL_TYPE_VARCHAR
, $2);
$$.set(
&type_handler_varchar
, $2);
}
| RAW opt_field_length_default_sp_param_varchar
{
Lex->charset= &my_charset_bin;
$$.set(
MYSQL_TYPE_VARCHAR
, $2);
$$.set(
&type_handler_varchar
, $2);
}
;
...
...
@@ -6319,19 +6319,23 @@ field_type_temporal:
buff, "YEAR(4)");
}
}
$$.set(
MYSQL_TYPE_YEAR
, $2);
$$.set(
&type_handler_year
, $2);
}
| DATE_SYM
{ $$.set(opt_mysql56_temporal_format ?
MYSQL_TYPE_DATETIME2 : MYSQL_TYPE_DATETIME, 0); }
| DATE_SYM { $$.set(thd->type_handler_for_date()); }
| TIME_SYM opt_field_length
{ $$.set(opt_mysql56_temporal_format ?
MYSQL_TYPE_TIME2 : MYSQL_TYPE_TIME, $2); }
{
$$.set(opt_mysql56_temporal_format ?
static_cast<const Type_handler*>(&type_handler_time2) :
static_cast<const Type_handler*>(&type_handler_time),
$2);
}
| TIMESTAMP opt_field_length
{
if (thd->variables.sql_mode & MODE_MAXDB)
$$.set(opt_mysql56_temporal_format ?
MYSQL_TYPE_DATETIME2 : MYSQL_TYPE_DATETIME, $2);
static_cast<const Type_handler*>(&type_handler_datetime2) :
static_cast<const Type_handler*>(&type_handler_datetime),
$2);
else
{
/*
...
...
@@ -6340,13 +6344,19 @@ field_type_temporal:
*/
if (!opt_explicit_defaults_for_timestamp)
Lex->last_field->flags|= NOT_NULL_FLAG;
$$.set(opt_mysql56_temporal_format ? MYSQL_TYPE_TIMESTAMP2
: MYSQL_TYPE_TIMESTAMP, $2);
$$.set(opt_mysql56_temporal_format ?
static_cast<const Type_handler*>(&type_handler_timestamp2):
static_cast<const Type_handler*>(&type_handler_timestamp),
$2);
}
}
| DATETIME opt_field_length
{ $$.set(opt_mysql56_temporal_format ?
MYSQL_TYPE_DATETIME2 : MYSQL_TYPE_DATETIME, $2); }
{
$$.set(opt_mysql56_temporal_format ?
static_cast<const Type_handler*>(&type_handler_datetime2) :
static_cast<const Type_handler*>(&type_handler_datetime),
$2);
}
;
...
...
@@ -6354,19 +6364,19 @@ field_type_lob:
TINYBLOB
{
Lex->charset=&my_charset_bin;
$$.set(
MYSQL_TYPE_TINY_BLOB
);
$$.set(
&type_handler_tiny_blob
);
}
| BLOB_SYM opt_field_length
{
Lex->charset=&my_charset_bin;
$$.set(
MYSQL_TYPE_LONG_BLOB
);
$$.set(
&type_handler_long_blob
);
}
| spatial_type float_options srid_option
{
#ifdef HAVE_SPATIAL
Lex->charset=&my_charset_bin;
Lex->last_field->geom_type= $1;
$$.set(
MYSQL_TYPE_GEOMETRY
, $2);
$$.set(
&type_handler_geometry
, $2);
#else
my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name,
sym_group_geom.needed_define));
...
...
@@ -6375,40 +6385,40 @@ field_type_lob:
| MEDIUMBLOB
{
Lex->charset=&my_charset_bin;
$$.set(
MYSQL_TYPE_MEDIUM_BLOB
);
$$.set(
&type_handler_medium_blob
);
}
| LONGBLOB
{
Lex->charset=&my_charset_bin;
$$.set(
MYSQL_TYPE_LONG_BLOB
);
$$.set(
&type_handler_long_blob
);
}
| LONG_SYM VARBINARY
{
Lex->charset=&my_charset_bin;
$$.set(
MYSQL_TYPE_MEDIUM_BLOB
);
$$.set(
&type_handler_medium_blob
);
}
| LONG_SYM varchar opt_binary
{ $$.set(
MYSQL_TYPE_MEDIUM_BLOB
); }
{ $$.set(
&type_handler_medium_blob
); }
| TINYTEXT opt_binary
{ $$.set(
MYSQL_TYPE_TINY_BLOB
); }
{ $$.set(
&type_handler_tiny_blob
); }
| TEXT_SYM opt_field_length opt_binary
{ $$.set(
MYSQL_TYPE_BLOB
, $2); }
{ $$.set(
&type_handler_blob
, $2); }
| MEDIUMTEXT opt_binary
{ $$.set(
MYSQL_TYPE_MEDIUM_BLOB
); }
{ $$.set(
&type_handler_medium_blob
); }
| LONGTEXT opt_binary
{ $$.set(
MYSQL_TYPE_LONG_BLOB
); }
{ $$.set(
&type_handler_long_blob
); }
| CLOB opt_binary
{ $$.set(
MYSQL_TYPE_LONG_BLOB
); }
{ $$.set(
&type_handler_long_blob
); }
| LONG_SYM opt_binary
{ $$.set(
MYSQL_TYPE_MEDIUM_BLOB
); }
{ $$.set(
&type_handler_medium_blob
); }
;
field_type_misc:
ENUM '(' string_list ')' opt_binary
{ $$.set(
MYSQL_TYPE_ENUM
); }
{ $$.set(
&type_handler_enum
); }
| SET '(' string_list ')' opt_binary
{ $$.set(
MYSQL_TYPE_SET
); }
{ $$.set(
&type_handler_set
); }
;
spatial_type:
...
...
@@ -6445,23 +6455,22 @@ nvarchar:
;
int_type:
INT_SYM { $$=
MYSQL_TYPE_LONG
; }
| TINYINT { $$=
MYSQL_TYPE_TINY
; }
| SMALLINT { $$=
MYSQL_TYPE_SHORT
; }
| MEDIUMINT { $$=
MYSQL_TYPE_INT
24; }
| BIGINT { $$=
MYSQL_TYPE_LONGLONG
; }
INT_SYM { $$=
&type_handler_long
; }
| TINYINT { $$=
&type_handler_tiny
; }
| SMALLINT { $$=
&type_handler_short
; }
| MEDIUMINT { $$=
&type_handler_int
24; }
| BIGINT { $$=
&type_handler_longlong
; }
;
real_type:
REAL
{
$$= thd->variables.sql_mode & MODE_REAL_AS_FLOAT ?
MYSQL_TYPE_FLOAT : MYSQL_TYPE_DOUBLE;
static_cast<const Type_handler *>(&type_handler_float) :
static_cast<const Type_handler *>(&type_handler_double);
}
| DOUBLE_SYM
{ $$=MYSQL_TYPE_DOUBLE; }
| DOUBLE_SYM PRECISION
{ $$=MYSQL_TYPE_DOUBLE; }
| DOUBLE_SYM { $$= &type_handler_double; }
| DOUBLE_SYM PRECISION { $$= &type_handler_double; }
;
srid_option:
...
...
sql/structs.h
View file @
533506b4
...
...
@@ -29,6 +29,7 @@
#include <mysql_com.h>
/* USERNAME_LENGTH */
struct
TABLE
;
class
Type_handler
;
class
Field
;
class
Index_statistics
;
...
...
@@ -581,27 +582,27 @@ struct Lex_length_and_dec_st
struct
Lex_field_type_st
:
public
Lex_length_and_dec_st
{
private:
enum_field_types
m_type
;
void
set
(
enum_field_types
type
,
const
char
*
length
,
const
char
*
dec
)
const
Type_handler
*
m_handler
;
void
set
(
const
Type_handler
*
handler
,
const
char
*
length
,
const
char
*
dec
)
{
m_
type
=
type
;
m_
handler
=
handler
;
Lex_length_and_dec_st
::
set
(
length
,
dec
);
}
public:
void
set
(
enum_field_types
type
,
Lex_length_and_dec_st
length_and_dec
)
void
set
(
const
Type_handler
*
handler
,
Lex_length_and_dec_st
length_and_dec
)
{
m_
type
=
type
;
m_
handler
=
handler
;
Lex_length_and_dec_st
::
operator
=
(
length_and_dec
);
}
void
set
(
enum_field_types
type
,
const
char
*
length
)
void
set
(
const
Type_handler
*
handler
,
const
char
*
length
)
{
set
(
type
,
length
,
0
);
set
(
handler
,
length
,
0
);
}
void
set
(
enum_field_types
type
)
void
set
(
const
Type_handler
*
handler
)
{
set
(
type
,
0
,
0
);
set
(
handler
,
0
,
0
);
}
enum_field_types
field_type
()
const
{
return
m_type
;
}
const
Type_handler
*
type_handler
()
const
{
return
m_handler
;
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment