summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-03-09 12:32:35 +0100
committerSergei Golubchik <serg@mariadb.org>2016-12-12 20:27:30 +0100
commitdb3f110864f05132b86b996089f69105d69a7ecf (patch)
treeb5bfc60845e74050c62f22e5644b3097dbd4cbd3
parent4210538122e6e868848c703dab6c1b0d59733d28 (diff)
downloadmariadb-git-db3f110864f05132b86b996089f69105d69a7ecf.tar.gz
cleanup: remove unused Field::utype values
and FIELDFLAG_xxx constants
-rw-r--r--sql/field.cc2
-rw-r--r--sql/field.h29
-rw-r--r--sql/sql_table.cc4
-rw-r--r--sql/table.cc2
-rw-r--r--sql/unireg.cc22
-rw-r--r--sql/unireg.h4
6 files changed, 18 insertions, 45 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 572633c0469..2a807ae599b 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -80,7 +80,7 @@ const char field_separator=',';
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
- 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_TO (MYSQL_TYPE_NEWDECIMAL - 1)
diff --git a/sql/field.h b/sql/field.h
index 40dff170dac..52e0d2ea6d7 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -709,10 +709,14 @@ public:
in more clean way with transition to new text based .frm format.
See also comment for Field_timestamp::Field_timestamp().
*/
- enum utype { NONE,DATE,SHIELD,NOEMPTY,CASEUP,PNR,BGNR,PGNR,YES,NO,REL,
- CHECK,EMPTY,UNKNOWN_FIELD,CASEDN,NEXT_NUMBER,INTERVAL_FIELD,
- BIT_FIELD, TIMESTAMP_OLD_FIELD, CAPITALIZE, BLOB_FIELD,
- TIMESTAMP_DN_FIELD, TIMESTAMP_UN_FIELD, TIMESTAMP_DNUN_FIELD};
+ enum utype {
+ NONE=0,
+ NEXT_NUMBER=15, // AUTO_INCREMENT
+ 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
{
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,
#define FIELDFLAG_GEOM 2048 // mangled with decimals!
#define FIELDFLAG_TREAT_BIT_AS_CHAR 4096 /* use Field_bit_as_char */
-
-#define FIELDFLAG_LEFT_FULLSCREEN 8192
-#define FIELDFLAG_RIGHT_FULLSCREEN 16384
-#define FIELDFLAG_FORMAT_NUMBER 16384 // predit: ###,,## in output
+#define FIELDFLAG_LONG_DECIMAL 8192
#define FIELDFLAG_NO_DEFAULT 16384 /* sql */
-#define FIELDFLAG_SUM ((uint) 32768)// predit: +#fieldflag
#define FIELDFLAG_MAYBE_NULL ((uint) 32768)// sql
#define FIELDFLAG_HEX_ESCAPE ((uint) 0x10000)
#define FIELDFLAG_PACK_SHIFT 3
#define FIELDFLAG_DEC_SHIFT 8
-#define FIELDFLAG_MAX_DEC 63
-#define FIELDFLAG_NUM_SCREEN_TYPE 0x7F01
-#define FIELDFLAG_ALFA_SCREEN_TYPE 0x7800
+#define FIELDFLAG_MAX_DEC 63
#define MTYP_TYPENR(type) (type & 127) /* Remove bits from 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_blob(x) (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == FIELDFLAG_BLOB)
#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_maybe_null(x) (x & FIELDFLAG_MAYBE_NULL)
-#define f_no_default(x) (x & FIELDFLAG_NO_DEFAULT)
+#define f_settype(x) (((int) (x)) << FIELDFLAG_PACK_SHIFT)
+#define f_maybe_null(x) ((x) & FIELDFLAG_MAYBE_NULL)
+#define f_no_default(x) ((x) & FIELDFLAG_NO_DEFAULT)
#define f_bit_as_char(x) ((x) & FIELDFLAG_TREAT_BIT_AS_CHAR)
#define f_is_hex_escape(x) ((x) & FIELDFLAG_HEX_ESCAPE)
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index e1dccf029e9..632290703be 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2898,7 +2898,6 @@ int prepare_create_field(Column_definition *sql_field,
if (sql_field->charset->state & MY_CS_BINSORT)
sql_field->pack_flag|=FIELDFLAG_BINARY;
sql_field->length=8; // Unireg field length
- sql_field->unireg_check=Field::BLOB_FIELD;
(*blob_columns)++;
break;
case MYSQL_TYPE_GEOMETRY:
@@ -2914,7 +2913,6 @@ int prepare_create_field(Column_definition *sql_field,
if (sql_field->charset->state & MY_CS_BINSORT)
sql_field->pack_flag|=FIELDFLAG_BINARY;
sql_field->length=8; // Unireg field length
- sql_field->unireg_check=Field::BLOB_FIELD;
(*blob_columns)++;
break;
#else
@@ -2950,7 +2948,6 @@ int prepare_create_field(Column_definition *sql_field,
FIELDFLAG_INTERVAL;
if (sql_field->charset->state & MY_CS_BINSORT)
sql_field->pack_flag|=FIELDFLAG_BINARY;
- sql_field->unireg_check=Field::INTERVAL_FIELD;
if (check_duplicates_in_interval("ENUM",sql_field->field_name,
sql_field->interval,
sql_field->charset, &dup_val_count))
@@ -2961,7 +2958,6 @@ int prepare_create_field(Column_definition *sql_field,
FIELDFLAG_BITFIELD;
if (sql_field->charset->state & MY_CS_BINSORT)
sql_field->pack_flag|=FIELDFLAG_BINARY;
- sql_field->unireg_check=Field::BIT_FIELD;
if (check_duplicates_in_interval("SET",sql_field->field_name,
sql_field->interval,
sql_field->charset, &dup_val_count))
diff --git a/sql/table.cc b/sql/table.cc
index 0f3906406d3..2aaa05b5ae6 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1724,7 +1724,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
/* Remove >32 decimals from old files */
if (share->mysql_version < 100200)
- pack_flag&= ~(FIELDFLAG_LEFT_FULLSCREEN);
+ pack_flag&= ~FIELDFLAG_LONG_DECIMAL;
if (interval_nr && charset->mbminlen > 1)
{
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 0199d3aa9c1..66fde186b5b 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -592,7 +592,7 @@ static bool pack_header(THD *thd, uchar *forminfo,
HA_CREATE_INFO *create_info, ulong data_offset,
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 table_options= create_info->table_options;
size_t reclength, totlength, n_length, com_length, expression_length;
@@ -606,7 +606,7 @@ static bool pack_header(THD *thd, uchar *forminfo,
totlength= 0L;
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;
n_length=2L;
create_info->field_check_constraints= 0;
@@ -640,13 +640,6 @@ static bool pack_header(THD *thd, uchar *forminfo,
totlength+= field->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
as auto-update field.
@@ -745,7 +738,7 @@ static bool pack_header(THD *thd, uchar *forminfo,
int2store(forminfo+258,create_fields.elements);
int2store(forminfo+260,0); // Screen length, not used anymore
int2store(forminfo+262,totlength);
- int2store(forminfo+264,no_empty);
+ int2store(forminfo+264,0); // unused
int2store(forminfo+266,reclength);
int2store(forminfo+268,n_length);
int2store(forminfo+270,int_count);
@@ -998,7 +991,6 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options,
uint reclength, ulong data_offset)
{
int error= 0;
- Field::utype type;
uint null_count;
uchar *null_pos;
TABLE table;
@@ -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))
null_count+= field->length & 7;
- type= (Field::utype) MTYP_TYPENR(field->unireg_check);
-
if (field->default_value && !field->has_default_expression())
{
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,
regfield->set_notnull();
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
regfield->reset();
}
diff --git a/sql/unireg.h b/sql/unireg.h
index 8e74519862e..4a287853438 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -142,10 +142,6 @@
*/
#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
for SELECT "text" LIKE "%pattern%", excluding the two