Commit db3f1108 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: remove unused Field::utype values

and FIELDFLAG_xxx constants
parent 42105381
...@@ -80,7 +80,7 @@ const char field_separator=','; ...@@ -80,7 +80,7 @@ const char field_separator=',';
NOTE: to avoid 256*256 table, gap in table types numeration is skiped NOTE: to avoid 256*256 table, gap in table types numeration is skiped
following #defines describe that gap and how to canculate number of fields following #defines describe that gap and how to canculate number of fields
and index of field in thia array. and index of field in this array.
*/ */
#define FIELDTYPE_TEAR_FROM (MYSQL_TYPE_BIT + 1) #define FIELDTYPE_TEAR_FROM (MYSQL_TYPE_BIT + 1)
#define FIELDTYPE_TEAR_TO (MYSQL_TYPE_NEWDECIMAL - 1) #define FIELDTYPE_TEAR_TO (MYSQL_TYPE_NEWDECIMAL - 1)
......
...@@ -709,10 +709,14 @@ class Field: public Value_source ...@@ -709,10 +709,14 @@ class Field: public Value_source
in more clean way with transition to new text based .frm format. in more clean way with transition to new text based .frm format.
See also comment for Field_timestamp::Field_timestamp(). See also comment for Field_timestamp::Field_timestamp().
*/ */
enum utype { NONE,DATE,SHIELD,NOEMPTY,CASEUP,PNR,BGNR,PGNR,YES,NO,REL, enum utype {
CHECK,EMPTY,UNKNOWN_FIELD,CASEDN,NEXT_NUMBER,INTERVAL_FIELD, NONE=0,
BIT_FIELD, TIMESTAMP_OLD_FIELD, CAPITALIZE, BLOB_FIELD, NEXT_NUMBER=15, // AUTO_INCREMENT
TIMESTAMP_DN_FIELD, TIMESTAMP_UN_FIELD, TIMESTAMP_DNUN_FIELD}; TIMESTAMP_OLD_FIELD=18, // TIMESTAMP created before 4.1.3
TIMESTAMP_DN_FIELD=21, // TIMESTAMP DEFAULT NOW()
TIMESTAMP_UN_FIELD=22, // TIMESTAMP ON UPDATE NOW()
TIMESTAMP_DNUN_FIELD=23 // TIMESTAMP DEFAULT NOW() ON UPDATE NOW()
};
enum geometry_type enum geometry_type
{ {
GEOM_GEOMETRY = 0, GEOM_POINT = 1, GEOM_LINESTRING = 2, GEOM_POLYGON = 3, GEOM_GEOMETRY = 0, GEOM_POINT = 1, GEOM_LINESTRING = 2, GEOM_POLYGON = 3,
...@@ -3905,19 +3909,13 @@ bool check_expression(Virtual_column_info *vcol, const char *type, ...@@ -3905,19 +3909,13 @@ bool check_expression(Virtual_column_info *vcol, const char *type,
#define FIELDFLAG_GEOM 2048 // mangled with decimals! #define FIELDFLAG_GEOM 2048 // mangled with decimals!
#define FIELDFLAG_TREAT_BIT_AS_CHAR 4096 /* use Field_bit_as_char */ #define FIELDFLAG_TREAT_BIT_AS_CHAR 4096 /* use Field_bit_as_char */
#define FIELDFLAG_LONG_DECIMAL 8192
#define FIELDFLAG_LEFT_FULLSCREEN 8192
#define FIELDFLAG_RIGHT_FULLSCREEN 16384
#define FIELDFLAG_FORMAT_NUMBER 16384 // predit: ###,,## in output
#define FIELDFLAG_NO_DEFAULT 16384 /* sql */ #define FIELDFLAG_NO_DEFAULT 16384 /* sql */
#define FIELDFLAG_SUM ((uint) 32768)// predit: +#fieldflag
#define FIELDFLAG_MAYBE_NULL ((uint) 32768)// sql #define FIELDFLAG_MAYBE_NULL ((uint) 32768)// sql
#define FIELDFLAG_HEX_ESCAPE ((uint) 0x10000) #define FIELDFLAG_HEX_ESCAPE ((uint) 0x10000)
#define FIELDFLAG_PACK_SHIFT 3 #define FIELDFLAG_PACK_SHIFT 3
#define FIELDFLAG_DEC_SHIFT 8 #define FIELDFLAG_DEC_SHIFT 8
#define FIELDFLAG_MAX_DEC 63 #define FIELDFLAG_MAX_DEC 63
#define FIELDFLAG_NUM_SCREEN_TYPE 0x7F01
#define FIELDFLAG_ALFA_SCREEN_TYPE 0x7800
#define MTYP_TYPENR(type) (type & 127) /* Remove bits from type */ #define MTYP_TYPENR(type) (type & 127) /* Remove bits from type */
...@@ -3933,10 +3931,9 @@ bool check_expression(Virtual_column_info *vcol, const char *type, ...@@ -3933,10 +3931,9 @@ bool check_expression(Virtual_column_info *vcol, const char *type,
#define f_is_bitfield(x) (((x) & (FIELDFLAG_BITFIELD | FIELDFLAG_NUMBER)) == FIELDFLAG_BITFIELD) #define f_is_bitfield(x) (((x) & (FIELDFLAG_BITFIELD | FIELDFLAG_NUMBER)) == FIELDFLAG_BITFIELD)
#define f_is_blob(x) (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == FIELDFLAG_BLOB) #define f_is_blob(x) (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == FIELDFLAG_BLOB)
#define f_is_geom(x) (((x) & (FIELDFLAG_GEOM | FIELDFLAG_NUMBER)) == FIELDFLAG_GEOM) #define f_is_geom(x) (((x) & (FIELDFLAG_GEOM | FIELDFLAG_NUMBER)) == FIELDFLAG_GEOM)
#define f_is_equ(x) ((x) & (1+2+FIELDFLAG_PACK+31*256)) #define f_settype(x) (((int) (x)) << FIELDFLAG_PACK_SHIFT)
#define f_settype(x) (((int) x) << FIELDFLAG_PACK_SHIFT) #define f_maybe_null(x) ((x) & FIELDFLAG_MAYBE_NULL)
#define f_maybe_null(x) (x & FIELDFLAG_MAYBE_NULL) #define f_no_default(x) ((x) & FIELDFLAG_NO_DEFAULT)
#define f_no_default(x) (x & FIELDFLAG_NO_DEFAULT)
#define f_bit_as_char(x) ((x) & FIELDFLAG_TREAT_BIT_AS_CHAR) #define f_bit_as_char(x) ((x) & FIELDFLAG_TREAT_BIT_AS_CHAR)
#define f_is_hex_escape(x) ((x) & FIELDFLAG_HEX_ESCAPE) #define f_is_hex_escape(x) ((x) & FIELDFLAG_HEX_ESCAPE)
......
...@@ -2898,7 +2898,6 @@ int prepare_create_field(Column_definition *sql_field, ...@@ -2898,7 +2898,6 @@ int prepare_create_field(Column_definition *sql_field,
if (sql_field->charset->state & MY_CS_BINSORT) if (sql_field->charset->state & MY_CS_BINSORT)
sql_field->pack_flag|=FIELDFLAG_BINARY; sql_field->pack_flag|=FIELDFLAG_BINARY;
sql_field->length=8; // Unireg field length sql_field->length=8; // Unireg field length
sql_field->unireg_check=Field::BLOB_FIELD;
(*blob_columns)++; (*blob_columns)++;
break; break;
case MYSQL_TYPE_GEOMETRY: case MYSQL_TYPE_GEOMETRY:
...@@ -2914,7 +2913,6 @@ int prepare_create_field(Column_definition *sql_field, ...@@ -2914,7 +2913,6 @@ int prepare_create_field(Column_definition *sql_field,
if (sql_field->charset->state & MY_CS_BINSORT) if (sql_field->charset->state & MY_CS_BINSORT)
sql_field->pack_flag|=FIELDFLAG_BINARY; sql_field->pack_flag|=FIELDFLAG_BINARY;
sql_field->length=8; // Unireg field length sql_field->length=8; // Unireg field length
sql_field->unireg_check=Field::BLOB_FIELD;
(*blob_columns)++; (*blob_columns)++;
break; break;
#else #else
...@@ -2950,7 +2948,6 @@ int prepare_create_field(Column_definition *sql_field, ...@@ -2950,7 +2948,6 @@ int prepare_create_field(Column_definition *sql_field,
FIELDFLAG_INTERVAL; FIELDFLAG_INTERVAL;
if (sql_field->charset->state & MY_CS_BINSORT) if (sql_field->charset->state & MY_CS_BINSORT)
sql_field->pack_flag|=FIELDFLAG_BINARY; sql_field->pack_flag|=FIELDFLAG_BINARY;
sql_field->unireg_check=Field::INTERVAL_FIELD;
if (check_duplicates_in_interval("ENUM",sql_field->field_name, if (check_duplicates_in_interval("ENUM",sql_field->field_name,
sql_field->interval, sql_field->interval,
sql_field->charset, &dup_val_count)) sql_field->charset, &dup_val_count))
...@@ -2961,7 +2958,6 @@ int prepare_create_field(Column_definition *sql_field, ...@@ -2961,7 +2958,6 @@ int prepare_create_field(Column_definition *sql_field,
FIELDFLAG_BITFIELD; FIELDFLAG_BITFIELD;
if (sql_field->charset->state & MY_CS_BINSORT) if (sql_field->charset->state & MY_CS_BINSORT)
sql_field->pack_flag|=FIELDFLAG_BINARY; sql_field->pack_flag|=FIELDFLAG_BINARY;
sql_field->unireg_check=Field::BIT_FIELD;
if (check_duplicates_in_interval("SET",sql_field->field_name, if (check_duplicates_in_interval("SET",sql_field->field_name,
sql_field->interval, sql_field->interval,
sql_field->charset, &dup_val_count)) sql_field->charset, &dup_val_count))
......
...@@ -1724,7 +1724,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, ...@@ -1724,7 +1724,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
/* Remove >32 decimals from old files */ /* Remove >32 decimals from old files */
if (share->mysql_version < 100200) if (share->mysql_version < 100200)
pack_flag&= ~(FIELDFLAG_LEFT_FULLSCREEN); pack_flag&= ~FIELDFLAG_LONG_DECIMAL;
if (interval_nr && charset->mbminlen > 1) if (interval_nr && charset->mbminlen > 1)
{ {
......
...@@ -592,7 +592,7 @@ static bool pack_header(THD *thd, uchar *forminfo, ...@@ -592,7 +592,7 @@ static bool pack_header(THD *thd, uchar *forminfo,
HA_CREATE_INFO *create_info, ulong data_offset, HA_CREATE_INFO *create_info, ulong data_offset,
handler *file) handler *file)
{ {
uint length,int_count,int_length,no_empty, int_parts; uint length,int_count,int_length, int_parts;
uint time_stamp_pos,null_fields; uint time_stamp_pos,null_fields;
uint table_options= create_info->table_options; uint table_options= create_info->table_options;
size_t reclength, totlength, n_length, com_length, expression_length; size_t reclength, totlength, n_length, com_length, expression_length;
...@@ -606,7 +606,7 @@ static bool pack_header(THD *thd, uchar *forminfo, ...@@ -606,7 +606,7 @@ static bool pack_header(THD *thd, uchar *forminfo,
totlength= 0L; totlength= 0L;
reclength= data_offset; reclength= data_offset;
no_empty=int_count=int_parts=int_length=time_stamp_pos=null_fields=0; int_count=int_parts=int_length=time_stamp_pos=null_fields=0;
com_length= 0; com_length= 0;
n_length=2L; n_length=2L;
create_info->field_check_constraints= 0; create_info->field_check_constraints= 0;
...@@ -640,13 +640,6 @@ static bool pack_header(THD *thd, uchar *forminfo, ...@@ -640,13 +640,6 @@ static bool pack_header(THD *thd, uchar *forminfo,
totlength+= field->length; totlength+= field->length;
com_length+= field->comment.length; com_length+= field->comment.length;
if (MTYP_TYPENR(field->unireg_check) == Field::NOEMPTY ||
field->unireg_check & MTYP_NOEMPTY_BIT)
{
field->unireg_check= (Field::utype) ((uint) field->unireg_check |
MTYP_NOEMPTY_BIT);
no_empty++;
}
/* /*
We mark first TIMESTAMP field with NOW() in DEFAULT or ON UPDATE We mark first TIMESTAMP field with NOW() in DEFAULT or ON UPDATE
as auto-update field. as auto-update field.
...@@ -745,7 +738,7 @@ static bool pack_header(THD *thd, uchar *forminfo, ...@@ -745,7 +738,7 @@ static bool pack_header(THD *thd, uchar *forminfo,
int2store(forminfo+258,create_fields.elements); int2store(forminfo+258,create_fields.elements);
int2store(forminfo+260,0); // Screen length, not used anymore int2store(forminfo+260,0); // Screen length, not used anymore
int2store(forminfo+262,totlength); int2store(forminfo+262,totlength);
int2store(forminfo+264,no_empty); int2store(forminfo+264,0); // unused
int2store(forminfo+266,reclength); int2store(forminfo+266,reclength);
int2store(forminfo+268,n_length); int2store(forminfo+268,n_length);
int2store(forminfo+270,int_count); int2store(forminfo+270,int_count);
...@@ -998,7 +991,6 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options, ...@@ -998,7 +991,6 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options,
uint reclength, ulong data_offset) uint reclength, ulong data_offset)
{ {
int error= 0; int error= 0;
Field::utype type;
uint null_count; uint null_count;
uchar *null_pos; uchar *null_pos;
TABLE table; TABLE table;
...@@ -1061,8 +1053,6 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options, ...@@ -1061,8 +1053,6 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options,
if (field->sql_type == MYSQL_TYPE_BIT && !f_bit_as_char(field->pack_flag)) if (field->sql_type == MYSQL_TYPE_BIT && !f_bit_as_char(field->pack_flag))
null_count+= field->length & 7; null_count+= field->length & 7;
type= (Field::utype) MTYP_TYPENR(field->unireg_check);
if (field->default_value && !field->has_default_expression()) if (field->default_value && !field->has_default_expression())
{ {
int res= field->default_value->expr_item->save_in_field(regfield, 1); int res= field->default_value->expr_item->save_in_field(regfield, 1);
...@@ -1081,12 +1071,6 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options, ...@@ -1081,12 +1071,6 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options,
regfield->set_notnull(); regfield->set_notnull();
regfield->store((longlong) 1, TRUE); regfield->store((longlong) 1, TRUE);
} }
else if (type == Field::YES) // Old unireg type
regfield->store(ER_THD(thd, ER_YES),(uint) strlen(ER_THD(thd, ER_YES)),
system_charset_info);
else if (type == Field::NO) // Old unireg type
regfield->store(ER_THD(thd, ER_NO), (uint) strlen(ER_THD(thd, ER_NO)),
system_charset_info);
else else
regfield->reset(); regfield->reset();
} }
......
...@@ -142,10 +142,6 @@ ...@@ -142,10 +142,6 @@
*/ */
#define OPEN_TRIGGER_ONLY (OPTIMIZE_I_S_TABLE*2) #define OPEN_TRIGGER_ONLY (OPTIMIZE_I_S_TABLE*2)
#define SC_INFO_LENGTH 4 /* Form format constant */
#define TE_INFO_LENGTH 3
#define MTYP_NOEMPTY_BIT 128
/* /*
Minimum length pattern before Turbo Boyer-Moore is used Minimum length pattern before Turbo Boyer-Moore is used
for SELECT "text" LIKE "%pattern%", excluding the two for SELECT "text" LIKE "%pattern%", excluding the two
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment