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
f1b729d3
Commit
f1b729d3
authored
May 16, 2017
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-9188 Split Column_definition::check() into virtual methods in Type_handler
parent
705fc43e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
311 additions
and
213 deletions
+311
-213
sql/field.cc
sql/field.cc
+94
-207
sql/field.h
sql/field.h
+8
-0
sql/sp_head.h
sql/sp_head.h
+2
-1
sql/sql_type.cc
sql/sql_type.cc
+159
-0
sql/sql_type.h
sql/sql_type.h
+48
-5
No files found.
sql/field.cc
View file @
f1b729d3
...
...
@@ -9893,11 +9893,98 @@ bool check_expression(Virtual_column_info *vcol, LEX_CSTRING *name,
}
bool
Column_definition
::
check_length
(
uint
mysql_errno
,
uint
limit
)
const
{
if
(
length
<=
limit
)
return
false
;
my_error
(
mysql_errno
,
MYF
(
0
),
field_name
.
str
,
static_cast
<
ulong
>
(
limit
));
return
true
;
}
bool
Column_definition
::
fix_attributes_int
(
uint
default_length
)
{
if
(
length
)
return
check_length
(
ER_TOO_BIG_DISPLAYWIDTH
,
MAX_FIELD_CHARLENGTH
);
length
=
default_length
;
return
false
;
}
bool
Column_definition
::
fix_attributes_real
(
uint
default_length
)
{
/* change FLOAT(precision) to FLOAT or DOUBLE */
if
(
!
length
&&
!
decimals
)
{
length
=
default_length
;
decimals
=
NOT_FIXED_DEC
;
}
if
(
length
<
decimals
&&
decimals
!=
NOT_FIXED_DEC
)
{
my_error
(
ER_M_BIGGER_THAN_D
,
MYF
(
0
),
field_name
.
str
);
return
true
;
}
if
(
decimals
!=
NOT_FIXED_DEC
&&
decimals
>=
FLOATING_POINT_DECIMALS
)
{
my_error
(
ER_TOO_BIG_SCALE
,
MYF
(
0
),
static_cast
<
ulonglong
>
(
decimals
),
field_name
.
str
,
static_cast
<
uint
>
(
FLOATING_POINT_DECIMALS
-
1
));
return
true
;
}
return
check_length
(
ER_TOO_BIG_DISPLAYWIDTH
,
MAX_FIELD_CHARLENGTH
);
}
bool
Column_definition
::
fix_attributes_decimal
()
{
if
(
decimals
>=
NOT_FIXED_DEC
)
{
my_error
(
ER_TOO_BIG_SCALE
,
MYF
(
0
),
static_cast
<
ulonglong
>
(
decimals
),
field_name
.
str
,
static_cast
<
uint
>
(
NOT_FIXED_DEC
-
1
));
return
true
;
}
my_decimal_trim
(
&
length
,
&
decimals
);
if
(
length
>
DECIMAL_MAX_PRECISION
)
{
my_error
(
ER_TOO_BIG_PRECISION
,
MYF
(
0
),
length
,
field_name
.
str
,
DECIMAL_MAX_PRECISION
);
return
true
;
}
if
(
length
<
decimals
)
{
my_error
(
ER_M_BIGGER_THAN_D
,
MYF
(
0
),
field_name
.
str
);
return
true
;
}
length
=
my_decimal_precision_to_length
(
length
,
decimals
,
flags
&
UNSIGNED_FLAG
);
pack_length
=
my_decimal_get_binary_size
(
length
,
decimals
);
return
false
;
}
bool
Column_definition
::
fix_attributes_bit
()
{
if
(
!
length
)
length
=
1
;
pack_length
=
(
length
+
7
)
/
8
;
return
check_length
(
ER_TOO_BIG_DISPLAYWIDTH
,
MAX_BIT_FIELD_LENGTH
);
}
bool
Column_definition
::
fix_attributes_temporal_with_time
(
uint
int_part_length
)
{
if
(
length
>
MAX_DATETIME_PRECISION
)
{
my_error
(
ER_TOO_BIG_PRECISION
,
MYF
(
0
),
length
,
field_name
.
str
,
MAX_DATETIME_PRECISION
);
return
true
;
}
length
+=
int_part_length
+
(
length
?
1
:
0
);
return
false
;
}
bool
Column_definition
::
check
(
THD
*
thd
)
{
const
uint
conditional_type_modifiers
=
AUTO_INCREMENT_FLAG
;
uint
sign_len
,
allowed_type_modifier
=
0
;
ulong
max_field_charlength
=
MAX_FIELD_CHARLENGTH
;
DBUG_ENTER
(
"Column_definition::check"
);
/* Initialize data for a computed field */
...
...
@@ -9972,186 +10059,9 @@ bool Column_definition::check(THD *thd)
else
if
(
flags
&
AUTO_INCREMENT_FLAG
)
unireg_check
=
Field
::
NEXT_NUMBER
;
sign_len
=
flags
&
UNSIGNED_FLAG
?
0
:
1
;
if
(
type_handler
()
->
Column_definition_fix_attributes
(
this
))
DBUG_RETURN
(
true
);
switch
(
real_field_type
())
{
case
MYSQL_TYPE_TINY
:
if
(
!
length
)
length
=
MAX_TINYINT_WIDTH
+
sign_len
;
allowed_type_modifier
=
AUTO_INCREMENT_FLAG
;
break
;
case
MYSQL_TYPE_SHORT
:
if
(
!
length
)
length
=
MAX_SMALLINT_WIDTH
+
sign_len
;
allowed_type_modifier
=
AUTO_INCREMENT_FLAG
;
break
;
case
MYSQL_TYPE_INT24
:
if
(
!
length
)
length
=
MAX_MEDIUMINT_WIDTH
+
sign_len
;
allowed_type_modifier
=
AUTO_INCREMENT_FLAG
;
break
;
case
MYSQL_TYPE_LONG
:
if
(
!
length
)
length
=
MAX_INT_WIDTH
+
sign_len
;
allowed_type_modifier
=
AUTO_INCREMENT_FLAG
;
break
;
case
MYSQL_TYPE_LONGLONG
:
if
(
!
length
)
length
=
MAX_BIGINT_WIDTH
;
allowed_type_modifier
=
AUTO_INCREMENT_FLAG
;
break
;
case
MYSQL_TYPE_NULL
:
break
;
case
MYSQL_TYPE_NEWDECIMAL
:
if
(
decimals
>=
NOT_FIXED_DEC
)
{
my_error
(
ER_TOO_BIG_SCALE
,
MYF
(
0
),
static_cast
<
ulonglong
>
(
decimals
),
field_name
.
str
,
static_cast
<
uint
>
(
NOT_FIXED_DEC
-
1
));
DBUG_RETURN
(
TRUE
);
}
my_decimal_trim
(
&
length
,
&
decimals
);
if
(
length
>
DECIMAL_MAX_PRECISION
)
{
my_error
(
ER_TOO_BIG_PRECISION
,
MYF
(
0
),
length
,
field_name
.
str
,
DECIMAL_MAX_PRECISION
);
DBUG_RETURN
(
TRUE
);
}
if
(
length
<
decimals
)
{
my_error
(
ER_M_BIGGER_THAN_D
,
MYF
(
0
),
field_name
.
str
);
DBUG_RETURN
(
TRUE
);
}
length
=
my_decimal_precision_to_length
(
length
,
decimals
,
flags
&
UNSIGNED_FLAG
);
pack_length
=
my_decimal_get_binary_size
(
length
,
decimals
);
break
;
case
MYSQL_TYPE_VARCHAR
:
/*
Long VARCHAR's are automaticly converted to blobs in mysql_prepare_table
if they don't have a default value
*/
max_field_charlength
=
MAX_FIELD_VARCHARLENGTH
;
break
;
case
MYSQL_TYPE_STRING
:
break
;
case
MYSQL_TYPE_BLOB
:
case
MYSQL_TYPE_TINY_BLOB
:
case
MYSQL_TYPE_LONG_BLOB
:
case
MYSQL_TYPE_MEDIUM_BLOB
:
case
MYSQL_TYPE_GEOMETRY
:
flags
|=
BLOB_FLAG
;
break
;
case
MYSQL_TYPE_YEAR
:
if
(
!
length
||
length
!=
2
)
length
=
4
;
/* Default length */
flags
|=
ZEROFILL_FLAG
|
UNSIGNED_FLAG
;
break
;
case
MYSQL_TYPE_FLOAT
:
/* change FLOAT(precision) to FLOAT or DOUBLE */
allowed_type_modifier
=
AUTO_INCREMENT_FLAG
;
if
(
!
length
&&
!
decimals
)
{
length
=
MAX_FLOAT_STR_LENGTH
;
decimals
=
NOT_FIXED_DEC
;
}
if
(
length
<
decimals
&&
decimals
!=
NOT_FIXED_DEC
)
{
my_error
(
ER_M_BIGGER_THAN_D
,
MYF
(
0
),
field_name
.
str
);
DBUG_RETURN
(
TRUE
);
}
if
(
decimals
!=
NOT_FIXED_DEC
&&
decimals
>=
FLOATING_POINT_DECIMALS
)
{
my_error
(
ER_TOO_BIG_SCALE
,
MYF
(
0
),
static_cast
<
ulonglong
>
(
decimals
),
field_name
.
str
,
static_cast
<
uint
>
(
FLOATING_POINT_DECIMALS
-
1
));
DBUG_RETURN
(
TRUE
);
}
break
;
case
MYSQL_TYPE_DOUBLE
:
allowed_type_modifier
=
AUTO_INCREMENT_FLAG
;
if
(
!
length
&&
!
decimals
)
{
length
=
DBL_DIG
+
7
;
decimals
=
NOT_FIXED_DEC
;
}
if
(
length
<
decimals
&&
decimals
!=
NOT_FIXED_DEC
)
{
my_error
(
ER_M_BIGGER_THAN_D
,
MYF
(
0
),
field_name
.
str
);
DBUG_RETURN
(
TRUE
);
}
if
(
decimals
!=
NOT_FIXED_DEC
&&
decimals
>=
FLOATING_POINT_DECIMALS
)
{
my_error
(
ER_TOO_BIG_SCALE
,
MYF
(
0
),
static_cast
<
ulonglong
>
(
decimals
),
field_name
.
str
,
static_cast
<
uint
>
(
FLOATING_POINT_DECIMALS
-
1
));
DBUG_RETURN
(
TRUE
);
}
break
;
case
MYSQL_TYPE_TIMESTAMP
:
case
MYSQL_TYPE_TIMESTAMP2
:
if
(
length
>
MAX_DATETIME_PRECISION
)
{
my_error
(
ER_TOO_BIG_PRECISION
,
MYF
(
0
),
length
,
field_name
.
str
,
MAX_DATETIME_PRECISION
);
DBUG_RETURN
(
TRUE
);
}
length
+=
MAX_DATETIME_WIDTH
+
(
length
?
1
:
0
);
flags
|=
UNSIGNED_FLAG
;
break
;
case
MYSQL_TYPE_DATE
:
/* We don't support creation of MYSQL_TYPE_DATE anymore */
set_handler
(
&
type_handler_newdate
);
/* fall trough */
case
MYSQL_TYPE_NEWDATE
:
length
=
MAX_DATE_WIDTH
;
break
;
case
MYSQL_TYPE_TIME
:
case
MYSQL_TYPE_TIME2
:
if
(
length
>
MAX_DATETIME_PRECISION
)
{
my_error
(
ER_TOO_BIG_PRECISION
,
MYF
(
0
),
length
,
field_name
.
str
,
MAX_DATETIME_PRECISION
);
DBUG_RETURN
(
TRUE
);
}
length
+=
MIN_TIME_WIDTH
+
(
length
?
1
:
0
);
break
;
case
MYSQL_TYPE_DATETIME
:
case
MYSQL_TYPE_DATETIME2
:
if
(
length
>
MAX_DATETIME_PRECISION
)
{
my_error
(
ER_TOO_BIG_PRECISION
,
MYF
(
0
),
length
,
field_name
.
str
,
MAX_DATETIME_PRECISION
);
DBUG_RETURN
(
TRUE
);
}
length
+=
MAX_DATETIME_WIDTH
+
(
length
?
1
:
0
);
break
;
case
MYSQL_TYPE_SET
:
pack_length
=
get_set_pack_length
(
interval_list
.
elements
);
break
;
case
MYSQL_TYPE_ENUM
:
/* Should be safe. */
pack_length
=
get_enum_pack_length
(
interval_list
.
elements
);
break
;
case
MYSQL_TYPE_VAR_STRING
:
DBUG_ASSERT
(
0
);
/* Impossible. */
break
;
case
MYSQL_TYPE_BIT
:
{
if
(
!
length
)
length
=
1
;
if
(
length
>
MAX_BIT_FIELD_LENGTH
)
{
my_error
(
ER_TOO_BIG_DISPLAYWIDTH
,
MYF
(
0
),
field_name
.
str
,
static_cast
<
ulong
>
(
MAX_BIT_FIELD_LENGTH
));
DBUG_RETURN
(
TRUE
);
}
pack_length
=
(
length
+
7
)
/
8
;
break
;
}
case
MYSQL_TYPE_DECIMAL
:
DBUG_ASSERT
(
0
);
/* Was obsolete */
}
/* Remember the value of length */
char_length
=
length
;
...
...
@@ -10174,32 +10084,9 @@ bool Column_definition::check(THD *thd)
}
}
enum_field_types
sql_type
=
real_field_type
();
if
(
!
(
flags
&
BLOB_FLAG
)
&&
((
length
>
max_field_charlength
&&
sql_type
!=
MYSQL_TYPE_VARCHAR
)
||
(
length
==
0
&&
sql_type
!=
MYSQL_TYPE_NULL
/* e.g. a ROW variable */
&&
sql_type
!=
MYSQL_TYPE_ENUM
&&
sql_type
!=
MYSQL_TYPE_SET
&&
sql_type
!=
MYSQL_TYPE_STRING
&&
sql_type
!=
MYSQL_TYPE_VARCHAR
&&
sql_type
!=
MYSQL_TYPE_GEOMETRY
)))
{
my_error
((
sql_type
==
MYSQL_TYPE_VAR_STRING
||
sql_type
==
MYSQL_TYPE_VARCHAR
||
sql_type
==
MYSQL_TYPE_STRING
)
?
ER_TOO_BIG_FIELDLENGTH
:
ER_TOO_BIG_DISPLAYWIDTH
,
MYF
(
0
),
field_name
.
str
,
max_field_charlength
);
/* purecov: inspected */
DBUG_RETURN
(
TRUE
);
}
else
if
(
length
>
MAX_FIELD_BLOBLENGTH
)
{
my_error
(
ER_TOO_BIG_DISPLAYWIDTH
,
MYF
(
0
),
field_name
.
str
,
MAX_FIELD_BLOBLENGTH
);
DBUG_RETURN
(
1
);
}
if
((
~
allowed_type_modifier
)
&
flags
&
conditional_type_modifiers
)
if
((
flags
&
AUTO_INCREMENT_FLAG
)
&&
!
type_handler
()
->
type_can_have_auto_increment_attribute
())
{
my_error
(
ER_WRONG_FIELD_SPEC
,
MYF
(
0
),
field_name
.
str
);
DBUG_RETURN
(
TRUE
);
...
...
sql/field.h
View file @
f1b729d3
...
...
@@ -3919,6 +3919,14 @@ class Column_definition: public Sql_alloc,
bool
prepare_create_field
(
uint
*
blob_columns
,
ulonglong
table_flags
);
uint
sign_length
()
const
{
return
flags
&
UNSIGNED_FLAG
?
0
:
1
;
}
bool
check_length
(
uint
mysql_errno
,
uint
max_allowed_length
)
const
;
bool
fix_attributes_real
(
uint
default_length
);
bool
fix_attributes_int
(
uint
default_length
);
bool
fix_attributes_decimal
();
bool
fix_attributes_temporal_with_time
(
uint
int_part_length
);
bool
fix_attributes_bit
();
bool
check
(
THD
*
thd
);
bool
stored_in_db
()
const
{
return
!
vcol_info
||
vcol_info
->
stored_in_db
;
}
...
...
sql/sp_head.h
View file @
f1b729d3
...
...
@@ -626,7 +626,8 @@ class sp_head :private Query_arena,
*/
bool
fill_field_definition
(
THD
*
thd
,
Column_definition
*
field_def
)
{
return
field_def
->
check
(
thd
)
||
const
Type_handler
*
h
=
field_def
->
type_handler
();
return
h
->
Column_definition_fix_attributes
(
field_def
)
||
field_def
->
sp_prepare_create_field
(
thd
,
mem_root
);
}
bool
row_fill_field_definitions
(
THD
*
thd
,
Row_definition_list
*
row
)
...
...
sql/sql_type.cc
View file @
f1b729d3
...
...
@@ -1380,6 +1380,165 @@ Field *Type_handler_set::make_conversion_table_field(TABLE *table,
((
const
Field_enum
*
)
target
)
->
typelib
,
target
->
charset
());
}
/*************************************************************************/
bool
Type_handler_null
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
return
false
;
}
bool
Type_handler_tiny
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
return
def
->
fix_attributes_int
(
MAX_TINYINT_WIDTH
+
def
->
sign_length
());
}
bool
Type_handler_short
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
return
def
->
fix_attributes_int
(
MAX_SMALLINT_WIDTH
+
def
->
sign_length
());
}
bool
Type_handler_int24
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
return
def
->
fix_attributes_int
(
MAX_MEDIUMINT_WIDTH
+
def
->
sign_length
());
}
bool
Type_handler_long
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
return
def
->
fix_attributes_int
(
MAX_INT_WIDTH
+
def
->
sign_length
());
}
bool
Type_handler_longlong
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
return
def
->
fix_attributes_int
(
MAX_BIGINT_WIDTH
/*no sign_length() added*/
);
}
bool
Type_handler_newdecimal
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
return
def
->
fix_attributes_decimal
();
}
bool
Type_handler_olddecimal
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
DBUG_ASSERT
(
0
);
// Obsolete
return
true
;
}
bool
Type_handler_var_string
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
DBUG_ASSERT
(
0
);
// Obsolete
return
true
;
}
bool
Type_handler_varchar
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
/*
Long VARCHAR's are automaticly converted to blobs in mysql_prepare_table
if they don't have a default value
*/
return
def
->
check_length
(
ER_TOO_BIG_DISPLAYWIDTH
,
MAX_FIELD_BLOBLENGTH
);
}
bool
Type_handler_string
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
return
def
->
check_length
(
ER_TOO_BIG_FIELDLENGTH
,
MAX_FIELD_CHARLENGTH
);
}
bool
Type_handler_blob_common
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
def
->
flags
|=
BLOB_FLAG
;
return
def
->
check_length
(
ER_TOO_BIG_DISPLAYWIDTH
,
MAX_FIELD_BLOBLENGTH
);
}
#ifdef HAVE_SPATIAL
bool
Type_handler_geometry
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
def
->
flags
|=
BLOB_FLAG
;
return
false
;
}
#endif
bool
Type_handler_year
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
if
(
!
def
->
length
||
def
->
length
!=
2
)
def
->
length
=
4
;
// Default length
def
->
flags
|=
ZEROFILL_FLAG
|
UNSIGNED_FLAG
;
return
false
;
}
bool
Type_handler_float
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
return
def
->
fix_attributes_real
(
MAX_FLOAT_STR_LENGTH
);
}
bool
Type_handler_double
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
return
def
->
fix_attributes_real
(
DBL_DIG
+
7
);
}
bool
Type_handler_timestamp_common
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
def
->
flags
|=
UNSIGNED_FLAG
;
return
def
->
fix_attributes_temporal_with_time
(
MAX_DATETIME_WIDTH
);
}
bool
Type_handler_date_common
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
// We don't support creation of MYSQL_TYPE_DATE anymore
def
->
set_handler
(
&
type_handler_newdate
);
def
->
length
=
MAX_DATE_WIDTH
;
return
false
;
}
bool
Type_handler_time_common
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
return
def
->
fix_attributes_temporal_with_time
(
MIN_TIME_WIDTH
);
}
bool
Type_handler_datetime_common
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
return
def
->
fix_attributes_temporal_with_time
(
MAX_DATETIME_WIDTH
);
}
bool
Type_handler_set
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
def
->
pack_length
=
get_set_pack_length
(
def
->
interval_list
.
elements
);
return
false
;
}
bool
Type_handler_enum
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
def
->
pack_length
=
get_enum_pack_length
(
def
->
interval_list
.
elements
);
return
false
;
}
bool
Type_handler_bit
::
Column_definition_fix_attributes
(
Column_definition
*
def
)
const
{
return
def
->
fix_attributes_bit
();
}
/*************************************************************************/
Field
*
Type_handler
::
make_and_init_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
...
...
sql/sql_type.h
View file @
f1b729d3
...
...
@@ -27,6 +27,7 @@
#include "my_time.h"
class
Field
;
class
Column_definition
;
class
Item
;
class
Item_param
;
class
Item_cache
;
...
...
@@ -603,6 +604,10 @@ class Type_handler
{
return
false
;
}
virtual
bool
type_can_have_auto_increment_attribute
()
const
{
return
false
;
}
/**
Prepared statement long data:
Check whether this parameter data type is compatible with long data.
...
...
@@ -686,6 +691,7 @@ class Type_handler
virtual
Field
*
make_conversion_table_field
(
TABLE
*
TABLE
,
uint
metadata
,
const
Field
*
target
)
const
=
0
;
virtual
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
=
0
;
virtual
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
@@ -924,6 +930,11 @@ class Type_handler_row: public Type_handler
DBUG_ASSERT
(
0
);
return
NULL
;
}
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
{
DBUG_ASSERT
(
0
);
return
true
;
}
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
@@ -1369,6 +1380,13 @@ class Type_handler_int_result: public Type_handler_numeric
};
class
Type_handler_general_purpose_int
:
public
Type_handler_int_result
{
public:
bool
type_can_have_auto_increment_attribute
()
const
{
return
true
;
}
};
class
Type_handler_temporal_result
:
public
Type_handler
{
protected:
...
...
@@ -1552,7 +1570,7 @@ class Type_handler_string_result: public Type_handler
*/
class
Type_handler_tiny
:
public
Type_handler_
int_resul
t
class
Type_handler_tiny
:
public
Type_handler_
general_purpose_in
t
{
static
const
Name
m_name_tiny
;
public:
...
...
@@ -1566,6 +1584,7 @@ class Type_handler_tiny: public Type_handler_int_result
}
Field
*
make_conversion_table_field
(
TABLE
*
TABLE
,
uint
metadata
,
const
Field
*
target
)
const
;
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
@@ -1573,7 +1592,7 @@ class Type_handler_tiny: public Type_handler_int_result
};
class
Type_handler_short
:
public
Type_handler_
int_resul
t
class
Type_handler_short
:
public
Type_handler_
general_purpose_in
t
{
static
const
Name
m_name_short
;
public:
...
...
@@ -1587,6 +1606,7 @@ class Type_handler_short: public Type_handler_int_result
uint32
max_display_length
(
const
Item
*
item
)
const
{
return
6
;
}
Field
*
make_conversion_table_field
(
TABLE
*
TABLE
,
uint
metadata
,
const
Field
*
target
)
const
;
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
@@ -1594,7 +1614,7 @@ class Type_handler_short: public Type_handler_int_result
};
class
Type_handler_long
:
public
Type_handler_
int_resul
t
class
Type_handler_long
:
public
Type_handler_
general_purpose_in
t
{
static
const
Name
m_name_int
;
public:
...
...
@@ -1611,6 +1631,7 @@ class Type_handler_long: public Type_handler_int_result
}
Field
*
make_conversion_table_field
(
TABLE
*
TABLE
,
uint
metadata
,
const
Field
*
target
)
const
;
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
@@ -1618,7 +1639,7 @@ class Type_handler_long: public Type_handler_int_result
};
class
Type_handler_longlong
:
public
Type_handler_
int_resul
t
class
Type_handler_longlong
:
public
Type_handler_
general_purpose_in
t
{
static
const
Name
m_name_longlong
;
public:
...
...
@@ -1632,6 +1653,7 @@ class Type_handler_longlong: public Type_handler_int_result
}
Field
*
make_conversion_table_field
(
TABLE
*
TABLE
,
uint
metadata
,
const
Field
*
target
)
const
;
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
@@ -1639,7 +1661,7 @@ class Type_handler_longlong: public Type_handler_int_result
};
class
Type_handler_int24
:
public
Type_handler_
int_resul
t
class
Type_handler_int24
:
public
Type_handler_
general_purpose_in
t
{
static
const
Name
m_name_mediumint
;
public:
...
...
@@ -1653,6 +1675,7 @@ class Type_handler_int24: public Type_handler_int_result
uint32
max_display_length
(
const
Item
*
item
)
const
{
return
8
;
}
Field
*
make_conversion_table_field
(
TABLE
*
,
uint
metadata
,
const
Field
*
target
)
const
;
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
@@ -1674,6 +1697,7 @@ class Type_handler_year: public Type_handler_int_result
}
Field
*
make_conversion_table_field
(
TABLE
*
,
uint
metadata
,
const
Field
*
target
)
const
;
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
@@ -1699,6 +1723,7 @@ class Type_handler_bit: public Type_handler_int_result
}
Field
*
make_conversion_table_field
(
TABLE
*
,
uint
metadata
,
const
Field
*
target
)
const
;
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
@@ -1713,6 +1738,7 @@ class Type_handler_float: public Type_handler_real_result
virtual
~
Type_handler_float
()
{}
const
Name
name
()
const
{
return
m_name_float
;
}
enum_field_types
field_type
()
const
{
return
MYSQL_TYPE_FLOAT
;
}
bool
type_can_have_auto_increment_attribute
()
const
{
return
true
;
}
uint32
max_display_length
(
const
Item
*
item
)
const
{
return
25
;
}
bool
Item_send
(
Item
*
item
,
Protocol
*
protocol
,
st_value
*
buf
)
const
{
...
...
@@ -1721,6 +1747,7 @@ class Type_handler_float: public Type_handler_real_result
Field
*
make_num_distinct_aggregator_field
(
MEM_ROOT
*
,
const
Item
*
)
const
;
Field
*
make_conversion_table_field
(
TABLE
*
,
uint
metadata
,
const
Field
*
target
)
const
;
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
@@ -1735,6 +1762,7 @@ class Type_handler_double: public Type_handler_real_result
virtual
~
Type_handler_double
()
{}
const
Name
name
()
const
{
return
m_name_double
;
}
enum_field_types
field_type
()
const
{
return
MYSQL_TYPE_DOUBLE
;
}
bool
type_can_have_auto_increment_attribute
()
const
{
return
true
;
}
uint32
max_display_length
(
const
Item
*
item
)
const
{
return
53
;
}
bool
Item_send
(
Item
*
item
,
Protocol
*
protocol
,
st_value
*
buf
)
const
{
...
...
@@ -1742,6 +1770,7 @@ class Type_handler_double: public Type_handler_real_result
}
Field
*
make_conversion_table_field
(
TABLE
*
,
uint
metadata
,
const
Field
*
target
)
const
;
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
@@ -1770,6 +1799,7 @@ class Type_handler_time_common: public Type_handler_temporal_result
return
Item_divisor_precision_increment_with_seconds
(
item
);
}
const
Type_handler
*
type_handler_for_comparison
()
const
;
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
bool
Item_save_in_value
(
Item
*
item
,
st_value
*
value
)
const
;
bool
Item_send
(
Item
*
item
,
Protocol
*
protocol
,
st_value
*
buf
)
const
{
...
...
@@ -1845,6 +1875,7 @@ class Type_handler_date_common: public Type_handler_temporal_with_date
{
return
MYSQL_TIMESTAMP_DATE
;
}
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
uint
Item_decimal_precision
(
const
Item
*
item
)
const
;
String
*
print_item_value
(
THD
*
thd
,
Item
*
item
,
String
*
str
)
const
;
bool
Item_hybrid_func_fix_attributes
(
THD
*
thd
,
...
...
@@ -1893,6 +1924,7 @@ class Type_handler_datetime_common: public Type_handler_temporal_with_date
{
return
MYSQL_TIMESTAMP_DATETIME
;
}
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
uint
Item_decimal_scale
(
const
Item
*
item
)
const
{
return
Item_decimal_scale_with_seconds
(
item
);
...
...
@@ -1958,6 +1990,7 @@ class Type_handler_timestamp_common: public Type_handler_temporal_with_date
{
return
true
;
}
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
uint
Item_decimal_scale
(
const
Item
*
item
)
const
{
return
Item_decimal_scale_with_seconds
(
item
);
...
...
@@ -2018,6 +2051,7 @@ class Type_handler_olddecimal: public Type_handler_decimal_result
const
Type_handler
*
type_handler_for_union
(
const
Item
*
item
)
const
;
Field
*
make_conversion_table_field
(
TABLE
*
,
uint
metadata
,
const
Field
*
target
)
const
;
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
@@ -2034,6 +2068,7 @@ class Type_handler_newdecimal: public Type_handler_decimal_result
enum_field_types
field_type
()
const
{
return
MYSQL_TYPE_NEWDECIMAL
;
}
Field
*
make_conversion_table_field
(
TABLE
*
,
uint
metadata
,
const
Field
*
target
)
const
;
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
@@ -2056,6 +2091,7 @@ class Type_handler_null: public Type_handler_string_result
bool
Item_send
(
Item
*
item
,
Protocol
*
protocol
,
st_value
*
buf
)
const
;
Field
*
make_conversion_table_field
(
TABLE
*
,
uint
metadata
,
const
Field
*
target
)
const
;
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
@@ -2087,6 +2123,7 @@ class Type_handler_string: public Type_handler_longstr
}
Field
*
make_conversion_table_field
(
TABLE
*
,
uint
metadata
,
const
Field
*
target
)
const
;
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
@@ -2107,6 +2144,7 @@ class Type_handler_var_string: public Type_handler_string
{
return
varstring_type_handler
(
item
);
}
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
const
Type_handler
*
type_handler_for_union
(
const
Item
*
item
)
const
{
return
varstring_type_handler
(
item
);
...
...
@@ -2132,6 +2170,7 @@ class Type_handler_varchar: public Type_handler_longstr
bool
is_param_long_data_type
()
const
{
return
true
;
}
Field
*
make_conversion_table_field
(
TABLE
*
,
uint
metadata
,
const
Field
*
target
)
const
;
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
@@ -2157,6 +2196,7 @@ class Type_handler_blob_common: public Type_handler_longstr
return
false
;
// Materialization does not work with BLOB columns
}
bool
is_param_long_data_type
()
const
{
return
true
;
}
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
bool
Item_hybrid_func_fix_attributes
(
THD
*
thd
,
const
char
*
name
,
Type_handler_hybrid_field_type
*
,
...
...
@@ -2254,6 +2294,7 @@ class Type_handler_geometry: public Type_handler_string_result
const
st_value
*
value
)
const
;
Field
*
make_conversion_table_field
(
TABLE
*
,
uint
metadata
,
const
Field
*
target
)
const
;
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
@@ -2314,6 +2355,7 @@ class Type_handler_enum: public Type_handler_typelib
virtual
enum_field_types
real_field_type
()
const
{
return
MYSQL_TYPE_ENUM
;
}
Field
*
make_conversion_table_field
(
TABLE
*
,
uint
metadata
,
const
Field
*
target
)
const
;
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
@@ -2330,6 +2372,7 @@ class Type_handler_set: public Type_handler_typelib
virtual
enum_field_types
real_field_type
()
const
{
return
MYSQL_TYPE_SET
;
}
Field
*
make_conversion_table_field
(
TABLE
*
,
uint
metadata
,
const
Field
*
target
)
const
;
bool
Column_definition_fix_attributes
(
Column_definition
*
c
)
const
;
Field
*
make_table_field
(
const
LEX_CSTRING
*
name
,
const
Record_addr
&
addr
,
const
Type_all_attributes
&
attr
,
...
...
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