This finishes the work (someone) started to remove FIELD_ types and use the Enum MYSQL types. The second part to this is to actually deprecate the FIELD defines in mysql_com.h
client/mysql.cc: Field update to MYSQL client/mysqldump.c: Field -> MySQL include/mysql.h: Field -> MySQL server-tools/instance-manager/protocol.cc: Field -> MySQL sql/field.cc: Field -> MySQL sql/field.h: Field -> MySQL sql/field_conv.cc: Field -> MySQL sql/handler.cc: Field -> MySQL sql/item.cc: Field -> MYSQL sql/item_func.cc: Field -> MySQL sql/item_subselect.cc: Field -> MySQL sql/item_subselect.h: Field -> MySQL sql/item_sum.h: Field -> MySQL sql/item_timefunc.cc: Field -> MySQL sql/log_event.cc: Field -> MySQL sql/opt_range.cc: Field -> MySQL sql/sp.cc: Field -> MySQL sql/sql_acl.cc: Field -> MYSQL sql/sql_analyse.cc: Field -> MYSQL sql/sql_insert.cc: Field -> MySQL sql/sql_load.cc: Field -> MySQL sql/sql_parse.cc: Field -> MySQL sql/sql_select.cc: Field -> MySQL sql/sql_select.h: Field -> MySQL sql/sql_show.cc: Field -> MySQL sql/sql_table.cc: Field -> MySQL sql/sql_yacc.yy: Field -> MySQL sql/table.cc: Field -> MySQL sql/unireg.cc: Field -> MySQL storage/innobase/handler/ha_innodb.cc: Field -> MySQL storage/myisam/ha_myisam.cc: Field -> MySQL tests/mysql_client_test.c: Field -> MySQL
This commit is contained in:
parent
46fd7deccb
commit
d6541d099b
@ -2230,32 +2230,32 @@ com_ego(String *buffer,char *line)
|
|||||||
static const char *fieldtype2str(enum enum_field_types type)
|
static const char *fieldtype2str(enum enum_field_types type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case FIELD_TYPE_BIT: return "BIT";
|
case MYSQL_TYPE_BIT: return "BIT";
|
||||||
case FIELD_TYPE_BLOB: return "BLOB";
|
case MYSQL_TYPE_BLOB: return "BLOB";
|
||||||
case FIELD_TYPE_DATE: return "DATE";
|
case MYSQL_TYPE_DATE: return "DATE";
|
||||||
case FIELD_TYPE_DATETIME: return "DATETIME";
|
case MYSQL_TYPE_DATETIME: return "DATETIME";
|
||||||
case FIELD_TYPE_NEWDECIMAL: return "NEWDECIMAL";
|
case MYSQL_TYPE_NEWDECIMAL: return "NEWDECIMAL";
|
||||||
case FIELD_TYPE_DECIMAL: return "DECIMAL";
|
case MYSQL_TYPE_DECIMAL: return "DECIMAL";
|
||||||
case FIELD_TYPE_DOUBLE: return "DOUBLE";
|
case MYSQL_TYPE_DOUBLE: return "DOUBLE";
|
||||||
case FIELD_TYPE_ENUM: return "ENUM";
|
case MYSQL_TYPE_ENUM: return "ENUM";
|
||||||
case FIELD_TYPE_FLOAT: return "FLOAT";
|
case MYSQL_TYPE_FLOAT: return "FLOAT";
|
||||||
case FIELD_TYPE_GEOMETRY: return "GEOMETRY";
|
case MYSQL_TYPE_GEOMETRY: return "GEOMETRY";
|
||||||
case FIELD_TYPE_INT24: return "INT24";
|
case MYSQL_TYPE_INT24: return "INT24";
|
||||||
case FIELD_TYPE_LONG: return "LONG";
|
case MYSQL_TYPE_LONG: return "LONG";
|
||||||
case FIELD_TYPE_LONGLONG: return "LONGLONG";
|
case MYSQL_TYPE_LONGLONG: return "LONGLONG";
|
||||||
case FIELD_TYPE_LONG_BLOB: return "LONG_BLOB";
|
case MYSQL_TYPE_LONG_BLOB: return "LONG_BLOB";
|
||||||
case FIELD_TYPE_MEDIUM_BLOB: return "MEDIUM_BLOB";
|
case MYSQL_TYPE_MEDIUM_BLOB: return "MEDIUM_BLOB";
|
||||||
case FIELD_TYPE_NEWDATE: return "NEWDATE";
|
case MYSQL_TYPE_NEWDATE: return "NEWDATE";
|
||||||
case FIELD_TYPE_NULL: return "NULL";
|
case MYSQL_TYPE_NULL: return "NULL";
|
||||||
case FIELD_TYPE_SET: return "SET";
|
case MYSQL_TYPE_SET: return "SET";
|
||||||
case FIELD_TYPE_SHORT: return "SHORT";
|
case MYSQL_TYPE_SHORT: return "SHORT";
|
||||||
case FIELD_TYPE_STRING: return "STRING";
|
case MYSQL_TYPE_STRING: return "STRING";
|
||||||
case FIELD_TYPE_TIME: return "TIME";
|
case MYSQL_TYPE_TIME: return "TIME";
|
||||||
case FIELD_TYPE_TIMESTAMP: return "TIMESTAMP";
|
case MYSQL_TYPE_TIMESTAMP: return "TIMESTAMP";
|
||||||
case FIELD_TYPE_TINY: return "TINY";
|
case MYSQL_TYPE_TINY: return "TINY";
|
||||||
case FIELD_TYPE_TINY_BLOB: return "TINY_BLOB";
|
case MYSQL_TYPE_TINY_BLOB: return "TINY_BLOB";
|
||||||
case FIELD_TYPE_VAR_STRING: return "VAR_STRING";
|
case MYSQL_TYPE_VAR_STRING: return "VAR_STRING";
|
||||||
case FIELD_TYPE_YEAR: return "YEAR";
|
case MYSQL_TYPE_YEAR: return "YEAR";
|
||||||
default: return "?-unknown-?";
|
default: return "?-unknown-?";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2622,7 +2622,7 @@ static void dump_table(char *table, char *db)
|
|||||||
dynstr_append(&extended_row, "NULL");
|
dynstr_append(&extended_row, "NULL");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (field->type == FIELD_TYPE_DECIMAL)
|
if (field->type == MYSQL_TYPE_DECIMAL)
|
||||||
{
|
{
|
||||||
/* add " signs around */
|
/* add " signs around */
|
||||||
dynstr_append(&extended_row, "'");
|
dynstr_append(&extended_row, "'");
|
||||||
@ -2695,7 +2695,7 @@ static void dump_table(char *table, char *db)
|
|||||||
else if (my_isalpha(charset_info, *ptr) ||
|
else if (my_isalpha(charset_info, *ptr) ||
|
||||||
(*ptr == '-' && my_isalpha(charset_info, ptr[1])))
|
(*ptr == '-' && my_isalpha(charset_info, ptr[1])))
|
||||||
fputs("NULL", md_result_file);
|
fputs("NULL", md_result_file);
|
||||||
else if (field->type == FIELD_TYPE_DECIMAL)
|
else if (field->type == MYSQL_TYPE_DECIMAL)
|
||||||
{
|
{
|
||||||
/* add " signs around */
|
/* add " signs around */
|
||||||
fputc('\'', md_result_file);
|
fputc('\'', md_result_file);
|
||||||
|
@ -85,9 +85,9 @@ extern char *mysql_unix_port;
|
|||||||
#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG)
|
#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG)
|
||||||
#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG)
|
#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG)
|
||||||
#define IS_BLOB(n) ((n) & BLOB_FLAG)
|
#define IS_BLOB(n) ((n) & BLOB_FLAG)
|
||||||
#define IS_NUM(t) ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR || (t) == FIELD_TYPE_NEWDECIMAL)
|
#define IS_NUM(t) ((t) <= MYSQL_TYPE_INT24 || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL)
|
||||||
#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
|
#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
|
||||||
#define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 && ((f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == FIELD_TYPE_YEAR)
|
#define INTERNAL_NUM_FIELD(f) (((f)->type <= MYSQL_TYPE_INT24 && ((f)->type != MYSQL_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == MYSQL_TYPE_YEAR)
|
||||||
|
|
||||||
|
|
||||||
typedef struct st_mysql_field {
|
typedef struct st_mysql_field {
|
||||||
|
@ -194,7 +194,7 @@ int send_fields(struct st_net *net, LIST *fields)
|
|||||||
int2store(send_buff.buffer + position, 1); /* charsetnr */
|
int2store(send_buff.buffer + position, 1); /* charsetnr */
|
||||||
int4store(send_buff.buffer + position + 2,
|
int4store(send_buff.buffer + position + 2,
|
||||||
field->length); /* field length */
|
field->length); /* field length */
|
||||||
send_buff.buffer[position+6]= (char) FIELD_TYPE_STRING; /* type */
|
send_buff.buffer[position+6]= (char) MYSQL_TYPE_STRING; /* type */
|
||||||
int2store(send_buff.buffer + position + 7, 0); /* flags */
|
int2store(send_buff.buffer + position + 7, 0); /* flags */
|
||||||
send_buff.buffer[position + 9]= (char) 0; /* decimals */
|
send_buff.buffer[position + 9]= (char) 0; /* decimals */
|
||||||
send_buff.buffer[position + 10]= 0;
|
send_buff.buffer[position + 10]= 0;
|
||||||
|
188
sql/field.cc
188
sql/field.cc
@ -8685,7 +8685,7 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||||||
it is NOT NULL, not an AUTO_INCREMENT field and not a TIMESTAMP.
|
it is NOT NULL, not an AUTO_INCREMENT field and not a TIMESTAMP.
|
||||||
*/
|
*/
|
||||||
if (!fld_default_value && !(fld_type_modifier & AUTO_INCREMENT_FLAG) &&
|
if (!fld_default_value && !(fld_type_modifier & AUTO_INCREMENT_FLAG) &&
|
||||||
(fld_type_modifier & NOT_NULL_FLAG) && fld_type != FIELD_TYPE_TIMESTAMP)
|
(fld_type_modifier & NOT_NULL_FLAG) && fld_type != MYSQL_TYPE_TIMESTAMP)
|
||||||
flags|= NO_DEFAULT_VALUE_FLAG;
|
flags|= NO_DEFAULT_VALUE_FLAG;
|
||||||
|
|
||||||
if (fld_length && !(length= (uint) atoi(fld_length)))
|
if (fld_length && !(length= (uint) atoi(fld_length)))
|
||||||
@ -8693,34 +8693,34 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||||||
sign_len= fld_type_modifier & UNSIGNED_FLAG ? 0 : 1;
|
sign_len= fld_type_modifier & UNSIGNED_FLAG ? 0 : 1;
|
||||||
|
|
||||||
switch (fld_type) {
|
switch (fld_type) {
|
||||||
case FIELD_TYPE_TINY:
|
case MYSQL_TYPE_TINY:
|
||||||
if (!fld_length)
|
if (!fld_length)
|
||||||
length= MAX_TINYINT_WIDTH+sign_len;
|
length= MAX_TINYINT_WIDTH+sign_len;
|
||||||
allowed_type_modifier= AUTO_INCREMENT_FLAG;
|
allowed_type_modifier= AUTO_INCREMENT_FLAG;
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_SHORT:
|
case MYSQL_TYPE_SHORT:
|
||||||
if (!fld_length)
|
if (!fld_length)
|
||||||
length= MAX_SMALLINT_WIDTH+sign_len;
|
length= MAX_SMALLINT_WIDTH+sign_len;
|
||||||
allowed_type_modifier= AUTO_INCREMENT_FLAG;
|
allowed_type_modifier= AUTO_INCREMENT_FLAG;
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_INT24:
|
case MYSQL_TYPE_INT24:
|
||||||
if (!fld_length)
|
if (!fld_length)
|
||||||
length= MAX_MEDIUMINT_WIDTH+sign_len;
|
length= MAX_MEDIUMINT_WIDTH+sign_len;
|
||||||
allowed_type_modifier= AUTO_INCREMENT_FLAG;
|
allowed_type_modifier= AUTO_INCREMENT_FLAG;
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_LONG:
|
case MYSQL_TYPE_LONG:
|
||||||
if (!fld_length)
|
if (!fld_length)
|
||||||
length= MAX_INT_WIDTH+sign_len;
|
length= MAX_INT_WIDTH+sign_len;
|
||||||
allowed_type_modifier= AUTO_INCREMENT_FLAG;
|
allowed_type_modifier= AUTO_INCREMENT_FLAG;
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_LONGLONG:
|
case MYSQL_TYPE_LONGLONG:
|
||||||
if (!fld_length)
|
if (!fld_length)
|
||||||
length= MAX_BIGINT_WIDTH;
|
length= MAX_BIGINT_WIDTH;
|
||||||
allowed_type_modifier= AUTO_INCREMENT_FLAG;
|
allowed_type_modifier= AUTO_INCREMENT_FLAG;
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_NULL:
|
case MYSQL_TYPE_NULL:
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_NEWDECIMAL:
|
case MYSQL_TYPE_NEWDECIMAL:
|
||||||
if (!fld_length && !decimals)
|
if (!fld_length && !decimals)
|
||||||
length= 10;
|
length= 10;
|
||||||
if (length > DECIMAL_MAX_PRECISION)
|
if (length > DECIMAL_MAX_PRECISION)
|
||||||
@ -8749,11 +8749,11 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||||||
break;
|
break;
|
||||||
case MYSQL_TYPE_STRING:
|
case MYSQL_TYPE_STRING:
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_BLOB:
|
case MYSQL_TYPE_BLOB:
|
||||||
case FIELD_TYPE_TINY_BLOB:
|
case MYSQL_TYPE_TINY_BLOB:
|
||||||
case FIELD_TYPE_LONG_BLOB:
|
case MYSQL_TYPE_LONG_BLOB:
|
||||||
case FIELD_TYPE_MEDIUM_BLOB:
|
case MYSQL_TYPE_MEDIUM_BLOB:
|
||||||
case FIELD_TYPE_GEOMETRY:
|
case MYSQL_TYPE_GEOMETRY:
|
||||||
if (fld_default_value)
|
if (fld_default_value)
|
||||||
{
|
{
|
||||||
/* Allow empty as default value. */
|
/* Allow empty as default value. */
|
||||||
@ -8785,12 +8785,12 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||||||
}
|
}
|
||||||
flags|= BLOB_FLAG;
|
flags|= BLOB_FLAG;
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_YEAR:
|
case MYSQL_TYPE_YEAR:
|
||||||
if (!fld_length || length != 2)
|
if (!fld_length || length != 2)
|
||||||
length= 4; /* Default length */
|
length= 4; /* Default length */
|
||||||
flags|= ZEROFILL_FLAG | UNSIGNED_FLAG;
|
flags|= ZEROFILL_FLAG | UNSIGNED_FLAG;
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_FLOAT:
|
case MYSQL_TYPE_FLOAT:
|
||||||
/* change FLOAT(precision) to FLOAT or DOUBLE */
|
/* change FLOAT(precision) to FLOAT or DOUBLE */
|
||||||
allowed_type_modifier= AUTO_INCREMENT_FLAG;
|
allowed_type_modifier= AUTO_INCREMENT_FLAG;
|
||||||
if (fld_length && !fld_decimals)
|
if (fld_length && !fld_decimals)
|
||||||
@ -8803,7 +8803,7 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||||||
}
|
}
|
||||||
else if (tmp_length > PRECISION_FOR_FLOAT)
|
else if (tmp_length > PRECISION_FOR_FLOAT)
|
||||||
{
|
{
|
||||||
sql_type= FIELD_TYPE_DOUBLE;
|
sql_type= MYSQL_TYPE_DOUBLE;
|
||||||
length= DBL_DIG+7; /* -[digits].E+### */
|
length= DBL_DIG+7; /* -[digits].E+### */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -8823,7 +8823,7 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_DOUBLE:
|
case MYSQL_TYPE_DOUBLE:
|
||||||
allowed_type_modifier= AUTO_INCREMENT_FLAG;
|
allowed_type_modifier= AUTO_INCREMENT_FLAG;
|
||||||
if (!fld_length && !fld_decimals)
|
if (!fld_length && !fld_decimals)
|
||||||
{
|
{
|
||||||
@ -8837,7 +8837,7 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_TIMESTAMP:
|
case MYSQL_TYPE_TIMESTAMP:
|
||||||
if (!fld_length)
|
if (!fld_length)
|
||||||
length= 14; /* Full date YYYYMMDDHHMMSS */
|
length= 14; /* Full date YYYYMMDDHHMMSS */
|
||||||
else if (length != 19)
|
else if (length != 19)
|
||||||
@ -8888,21 +8888,21 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||||||
Field::NONE));
|
Field::NONE));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_DATE:
|
case MYSQL_TYPE_DATE:
|
||||||
/* Old date type. */
|
/* Old date type. */
|
||||||
if (protocol_version != PROTOCOL_VERSION-1)
|
if (protocol_version != PROTOCOL_VERSION-1)
|
||||||
sql_type= FIELD_TYPE_NEWDATE;
|
sql_type= MYSQL_TYPE_NEWDATE;
|
||||||
/* fall trough */
|
/* fall trough */
|
||||||
case FIELD_TYPE_NEWDATE:
|
case MYSQL_TYPE_NEWDATE:
|
||||||
length= 10;
|
length= 10;
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_TIME:
|
case MYSQL_TYPE_TIME:
|
||||||
length= 10;
|
length= 10;
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_DATETIME:
|
case MYSQL_TYPE_DATETIME:
|
||||||
length= 19;
|
length= 19;
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_SET:
|
case MYSQL_TYPE_SET:
|
||||||
{
|
{
|
||||||
if (fld_interval_list->elements > sizeof(longlong)*8)
|
if (fld_interval_list->elements > sizeof(longlong)*8)
|
||||||
{
|
{
|
||||||
@ -8923,7 +8923,7 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||||||
length= 1;
|
length= 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FIELD_TYPE_ENUM:
|
case MYSQL_TYPE_ENUM:
|
||||||
{
|
{
|
||||||
/* Should be safe. */
|
/* Should be safe. */
|
||||||
pack_length= get_enum_pack_length(fld_interval_list->elements);
|
pack_length= get_enum_pack_length(fld_interval_list->elements);
|
||||||
@ -8932,7 +8932,7 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||||||
String *tmp;
|
String *tmp;
|
||||||
while ((tmp= it++))
|
while ((tmp= it++))
|
||||||
interval_list.push_back(tmp);
|
interval_list.push_back(tmp);
|
||||||
length= 1; /* See comment for FIELD_TYPE_SET above. */
|
length= 1; /* See comment for MYSQL_TYPE_SET above. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MYSQL_TYPE_VAR_STRING:
|
case MYSQL_TYPE_VAR_STRING:
|
||||||
@ -8951,19 +8951,19 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||||||
pack_length= (length + 7) / 8;
|
pack_length= (length + 7) / 8;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FIELD_TYPE_DECIMAL:
|
case MYSQL_TYPE_DECIMAL:
|
||||||
DBUG_ASSERT(0); /* Was obsolete */
|
DBUG_ASSERT(0); /* Was obsolete */
|
||||||
}
|
}
|
||||||
/* Remember the value of length */
|
/* Remember the value of length */
|
||||||
char_length= length;
|
char_length= length;
|
||||||
|
|
||||||
if (!(flags & BLOB_FLAG) &&
|
if (!(flags & BLOB_FLAG) &&
|
||||||
((length > max_field_charlength && fld_type != FIELD_TYPE_SET &&
|
((length > max_field_charlength && fld_type != MYSQL_TYPE_SET &&
|
||||||
fld_type != FIELD_TYPE_ENUM &&
|
fld_type != MYSQL_TYPE_ENUM &&
|
||||||
(fld_type != MYSQL_TYPE_VARCHAR || fld_default_value)) ||
|
(fld_type != MYSQL_TYPE_VARCHAR || fld_default_value)) ||
|
||||||
(!length &&
|
(!length &&
|
||||||
fld_type != MYSQL_TYPE_STRING &&
|
fld_type != MYSQL_TYPE_STRING &&
|
||||||
fld_type != MYSQL_TYPE_VARCHAR && fld_type != FIELD_TYPE_GEOMETRY)))
|
fld_type != MYSQL_TYPE_VARCHAR && fld_type != MYSQL_TYPE_GEOMETRY)))
|
||||||
{
|
{
|
||||||
my_error((fld_type == MYSQL_TYPE_VAR_STRING ||
|
my_error((fld_type == MYSQL_TYPE_VAR_STRING ||
|
||||||
fld_type == MYSQL_TYPE_VARCHAR ||
|
fld_type == MYSQL_TYPE_VARCHAR ||
|
||||||
@ -8988,13 +8988,13 @@ enum_field_types get_blob_type_from_length(ulong length)
|
|||||||
{
|
{
|
||||||
enum_field_types type;
|
enum_field_types type;
|
||||||
if (length < 256)
|
if (length < 256)
|
||||||
type= FIELD_TYPE_TINY_BLOB;
|
type= MYSQL_TYPE_TINY_BLOB;
|
||||||
else if (length < 65536)
|
else if (length < 65536)
|
||||||
type= FIELD_TYPE_BLOB;
|
type= MYSQL_TYPE_BLOB;
|
||||||
else if (length < 256L*256L*256L)
|
else if (length < 256L*256L*256L)
|
||||||
type= FIELD_TYPE_MEDIUM_BLOB;
|
type= MYSQL_TYPE_MEDIUM_BLOB;
|
||||||
else
|
else
|
||||||
type= FIELD_TYPE_LONG_BLOB;
|
type= MYSQL_TYPE_LONG_BLOB;
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9008,32 +9008,32 @@ uint32 calc_pack_length(enum_field_types type,uint32 length)
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case MYSQL_TYPE_VAR_STRING:
|
case MYSQL_TYPE_VAR_STRING:
|
||||||
case MYSQL_TYPE_STRING:
|
case MYSQL_TYPE_STRING:
|
||||||
case FIELD_TYPE_DECIMAL: return (length);
|
case MYSQL_TYPE_DECIMAL: return (length);
|
||||||
case MYSQL_TYPE_VARCHAR: return (length + (length < 256 ? 1: 2));
|
case MYSQL_TYPE_VARCHAR: return (length + (length < 256 ? 1: 2));
|
||||||
case FIELD_TYPE_YEAR:
|
case MYSQL_TYPE_YEAR:
|
||||||
case FIELD_TYPE_TINY : return 1;
|
case MYSQL_TYPE_TINY : return 1;
|
||||||
case FIELD_TYPE_SHORT : return 2;
|
case MYSQL_TYPE_SHORT : return 2;
|
||||||
case FIELD_TYPE_INT24:
|
case MYSQL_TYPE_INT24:
|
||||||
case FIELD_TYPE_NEWDATE:
|
case MYSQL_TYPE_NEWDATE:
|
||||||
case FIELD_TYPE_TIME: return 3;
|
case MYSQL_TYPE_TIME: return 3;
|
||||||
case FIELD_TYPE_TIMESTAMP:
|
case MYSQL_TYPE_TIMESTAMP:
|
||||||
case FIELD_TYPE_DATE:
|
case MYSQL_TYPE_DATE:
|
||||||
case FIELD_TYPE_LONG : return 4;
|
case MYSQL_TYPE_LONG : return 4;
|
||||||
case FIELD_TYPE_FLOAT : return sizeof(float);
|
case MYSQL_TYPE_FLOAT : return sizeof(float);
|
||||||
case FIELD_TYPE_DOUBLE: return sizeof(double);
|
case MYSQL_TYPE_DOUBLE: return sizeof(double);
|
||||||
case FIELD_TYPE_DATETIME:
|
case MYSQL_TYPE_DATETIME:
|
||||||
case FIELD_TYPE_LONGLONG: return 8; /* Don't crash if no longlong */
|
case MYSQL_TYPE_LONGLONG: return 8; /* Don't crash if no longlong */
|
||||||
case FIELD_TYPE_NULL : return 0;
|
case MYSQL_TYPE_NULL : return 0;
|
||||||
case FIELD_TYPE_TINY_BLOB: return 1+portable_sizeof_char_ptr;
|
case MYSQL_TYPE_TINY_BLOB: return 1+portable_sizeof_char_ptr;
|
||||||
case FIELD_TYPE_BLOB: return 2+portable_sizeof_char_ptr;
|
case MYSQL_TYPE_BLOB: return 2+portable_sizeof_char_ptr;
|
||||||
case FIELD_TYPE_MEDIUM_BLOB: return 3+portable_sizeof_char_ptr;
|
case MYSQL_TYPE_MEDIUM_BLOB: return 3+portable_sizeof_char_ptr;
|
||||||
case FIELD_TYPE_LONG_BLOB: return 4+portable_sizeof_char_ptr;
|
case MYSQL_TYPE_LONG_BLOB: return 4+portable_sizeof_char_ptr;
|
||||||
case FIELD_TYPE_GEOMETRY: return 4+portable_sizeof_char_ptr;
|
case MYSQL_TYPE_GEOMETRY: return 4+portable_sizeof_char_ptr;
|
||||||
case FIELD_TYPE_SET:
|
case MYSQL_TYPE_SET:
|
||||||
case FIELD_TYPE_ENUM:
|
case MYSQL_TYPE_ENUM:
|
||||||
case FIELD_TYPE_NEWDECIMAL:
|
case MYSQL_TYPE_NEWDECIMAL:
|
||||||
abort(); return 0; // This shouldn't happen
|
abort(); return 0; // This shouldn't happen
|
||||||
case FIELD_TYPE_BIT: return length / 8;
|
case MYSQL_TYPE_BIT: return length / 8;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -9043,11 +9043,11 @@ uint32 calc_pack_length(enum_field_types type,uint32 length)
|
|||||||
uint pack_length_to_packflag(uint type)
|
uint pack_length_to_packflag(uint type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 1: return f_settype((uint) FIELD_TYPE_TINY);
|
case 1: return f_settype((uint) MYSQL_TYPE_TINY);
|
||||||
case 2: return f_settype((uint) FIELD_TYPE_SHORT);
|
case 2: return f_settype((uint) MYSQL_TYPE_SHORT);
|
||||||
case 3: return f_settype((uint) FIELD_TYPE_INT24);
|
case 3: return f_settype((uint) MYSQL_TYPE_INT24);
|
||||||
case 4: return f_settype((uint) FIELD_TYPE_LONG);
|
case 4: return f_settype((uint) MYSQL_TYPE_LONG);
|
||||||
case 8: return f_settype((uint) FIELD_TYPE_LONGLONG);
|
case 8: return f_settype((uint) MYSQL_TYPE_LONGLONG);
|
||||||
}
|
}
|
||||||
return 0; // This shouldn't happen
|
return 0; // This shouldn't happen
|
||||||
}
|
}
|
||||||
@ -9067,7 +9067,7 @@ Field *make_field(TABLE_SHARE *share, char *ptr, uint32 field_length,
|
|||||||
uchar bit_offset;
|
uchar bit_offset;
|
||||||
LINT_INIT(bit_ptr);
|
LINT_INIT(bit_ptr);
|
||||||
LINT_INIT(bit_offset);
|
LINT_INIT(bit_offset);
|
||||||
if (field_type == FIELD_TYPE_BIT && !f_bit_as_char(pack_flag))
|
if (field_type == MYSQL_TYPE_BIT && !f_bit_as_char(pack_flag))
|
||||||
{
|
{
|
||||||
bit_ptr= null_pos;
|
bit_ptr= null_pos;
|
||||||
bit_offset= null_bit;
|
bit_offset= null_bit;
|
||||||
@ -9089,11 +9089,11 @@ Field *make_field(TABLE_SHARE *share, char *ptr, uint32 field_length,
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (field_type) {
|
switch (field_type) {
|
||||||
case FIELD_TYPE_DATE:
|
case MYSQL_TYPE_DATE:
|
||||||
case FIELD_TYPE_NEWDATE:
|
case MYSQL_TYPE_NEWDATE:
|
||||||
case FIELD_TYPE_TIME:
|
case MYSQL_TYPE_TIME:
|
||||||
case FIELD_TYPE_DATETIME:
|
case MYSQL_TYPE_DATETIME:
|
||||||
case FIELD_TYPE_TIMESTAMP:
|
case MYSQL_TYPE_TIMESTAMP:
|
||||||
field_charset= &my_charset_bin;
|
field_charset= &my_charset_bin;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
@ -9103,7 +9103,7 @@ Field *make_field(TABLE_SHARE *share, char *ptr, uint32 field_length,
|
|||||||
if (!f_is_packed(pack_flag))
|
if (!f_is_packed(pack_flag))
|
||||||
{
|
{
|
||||||
if (field_type == MYSQL_TYPE_STRING ||
|
if (field_type == MYSQL_TYPE_STRING ||
|
||||||
field_type == FIELD_TYPE_DECIMAL || // 3.23 or 4.0 string
|
field_type == MYSQL_TYPE_DECIMAL || // 3.23 or 4.0 string
|
||||||
field_type == MYSQL_TYPE_VAR_STRING)
|
field_type == MYSQL_TYPE_VAR_STRING)
|
||||||
return new Field_string(ptr,field_length,null_pos,null_bit,
|
return new Field_string(ptr,field_length,null_pos,null_bit,
|
||||||
unireg_check, field_name,
|
unireg_check, field_name,
|
||||||
@ -9146,78 +9146,78 @@ Field *make_field(TABLE_SHARE *share, char *ptr, uint32 field_length,
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (field_type) {
|
switch (field_type) {
|
||||||
case FIELD_TYPE_DECIMAL:
|
case MYSQL_TYPE_DECIMAL:
|
||||||
return new Field_decimal(ptr,field_length,null_pos,null_bit,
|
return new Field_decimal(ptr,field_length,null_pos,null_bit,
|
||||||
unireg_check, field_name,
|
unireg_check, field_name,
|
||||||
f_decimals(pack_flag),
|
f_decimals(pack_flag),
|
||||||
f_is_zerofill(pack_flag) != 0,
|
f_is_zerofill(pack_flag) != 0,
|
||||||
f_is_dec(pack_flag) == 0);
|
f_is_dec(pack_flag) == 0);
|
||||||
case FIELD_TYPE_NEWDECIMAL:
|
case MYSQL_TYPE_NEWDECIMAL:
|
||||||
return new Field_new_decimal(ptr,field_length,null_pos,null_bit,
|
return new Field_new_decimal(ptr,field_length,null_pos,null_bit,
|
||||||
unireg_check, field_name,
|
unireg_check, field_name,
|
||||||
f_decimals(pack_flag),
|
f_decimals(pack_flag),
|
||||||
f_is_zerofill(pack_flag) != 0,
|
f_is_zerofill(pack_flag) != 0,
|
||||||
f_is_dec(pack_flag) == 0);
|
f_is_dec(pack_flag) == 0);
|
||||||
case FIELD_TYPE_FLOAT:
|
case MYSQL_TYPE_FLOAT:
|
||||||
return new Field_float(ptr,field_length,null_pos,null_bit,
|
return new Field_float(ptr,field_length,null_pos,null_bit,
|
||||||
unireg_check, field_name,
|
unireg_check, field_name,
|
||||||
f_decimals(pack_flag),
|
f_decimals(pack_flag),
|
||||||
f_is_zerofill(pack_flag) != 0,
|
f_is_zerofill(pack_flag) != 0,
|
||||||
f_is_dec(pack_flag)== 0);
|
f_is_dec(pack_flag)== 0);
|
||||||
case FIELD_TYPE_DOUBLE:
|
case MYSQL_TYPE_DOUBLE:
|
||||||
return new Field_double(ptr,field_length,null_pos,null_bit,
|
return new Field_double(ptr,field_length,null_pos,null_bit,
|
||||||
unireg_check, field_name,
|
unireg_check, field_name,
|
||||||
f_decimals(pack_flag),
|
f_decimals(pack_flag),
|
||||||
f_is_zerofill(pack_flag) != 0,
|
f_is_zerofill(pack_flag) != 0,
|
||||||
f_is_dec(pack_flag)== 0);
|
f_is_dec(pack_flag)== 0);
|
||||||
case FIELD_TYPE_TINY:
|
case MYSQL_TYPE_TINY:
|
||||||
return new Field_tiny(ptr,field_length,null_pos,null_bit,
|
return new Field_tiny(ptr,field_length,null_pos,null_bit,
|
||||||
unireg_check, field_name,
|
unireg_check, field_name,
|
||||||
f_is_zerofill(pack_flag) != 0,
|
f_is_zerofill(pack_flag) != 0,
|
||||||
f_is_dec(pack_flag) == 0);
|
f_is_dec(pack_flag) == 0);
|
||||||
case FIELD_TYPE_SHORT:
|
case MYSQL_TYPE_SHORT:
|
||||||
return new Field_short(ptr,field_length,null_pos,null_bit,
|
return new Field_short(ptr,field_length,null_pos,null_bit,
|
||||||
unireg_check, field_name,
|
unireg_check, field_name,
|
||||||
f_is_zerofill(pack_flag) != 0,
|
f_is_zerofill(pack_flag) != 0,
|
||||||
f_is_dec(pack_flag) == 0);
|
f_is_dec(pack_flag) == 0);
|
||||||
case FIELD_TYPE_INT24:
|
case MYSQL_TYPE_INT24:
|
||||||
return new Field_medium(ptr,field_length,null_pos,null_bit,
|
return new Field_medium(ptr,field_length,null_pos,null_bit,
|
||||||
unireg_check, field_name,
|
unireg_check, field_name,
|
||||||
f_is_zerofill(pack_flag) != 0,
|
f_is_zerofill(pack_flag) != 0,
|
||||||
f_is_dec(pack_flag) == 0);
|
f_is_dec(pack_flag) == 0);
|
||||||
case FIELD_TYPE_LONG:
|
case MYSQL_TYPE_LONG:
|
||||||
return new Field_long(ptr,field_length,null_pos,null_bit,
|
return new Field_long(ptr,field_length,null_pos,null_bit,
|
||||||
unireg_check, field_name,
|
unireg_check, field_name,
|
||||||
f_is_zerofill(pack_flag) != 0,
|
f_is_zerofill(pack_flag) != 0,
|
||||||
f_is_dec(pack_flag) == 0);
|
f_is_dec(pack_flag) == 0);
|
||||||
case FIELD_TYPE_LONGLONG:
|
case MYSQL_TYPE_LONGLONG:
|
||||||
return new Field_longlong(ptr,field_length,null_pos,null_bit,
|
return new Field_longlong(ptr,field_length,null_pos,null_bit,
|
||||||
unireg_check, field_name,
|
unireg_check, field_name,
|
||||||
f_is_zerofill(pack_flag) != 0,
|
f_is_zerofill(pack_flag) != 0,
|
||||||
f_is_dec(pack_flag) == 0);
|
f_is_dec(pack_flag) == 0);
|
||||||
case FIELD_TYPE_TIMESTAMP:
|
case MYSQL_TYPE_TIMESTAMP:
|
||||||
return new Field_timestamp(ptr,field_length, null_pos, null_bit,
|
return new Field_timestamp(ptr,field_length, null_pos, null_bit,
|
||||||
unireg_check, field_name, share,
|
unireg_check, field_name, share,
|
||||||
field_charset);
|
field_charset);
|
||||||
case FIELD_TYPE_YEAR:
|
case MYSQL_TYPE_YEAR:
|
||||||
return new Field_year(ptr,field_length,null_pos,null_bit,
|
return new Field_year(ptr,field_length,null_pos,null_bit,
|
||||||
unireg_check, field_name);
|
unireg_check, field_name);
|
||||||
case FIELD_TYPE_DATE:
|
case MYSQL_TYPE_DATE:
|
||||||
return new Field_date(ptr,null_pos,null_bit,
|
return new Field_date(ptr,null_pos,null_bit,
|
||||||
unireg_check, field_name, field_charset);
|
unireg_check, field_name, field_charset);
|
||||||
case FIELD_TYPE_NEWDATE:
|
case MYSQL_TYPE_NEWDATE:
|
||||||
return new Field_newdate(ptr,null_pos,null_bit,
|
return new Field_newdate(ptr,null_pos,null_bit,
|
||||||
unireg_check, field_name, field_charset);
|
unireg_check, field_name, field_charset);
|
||||||
case FIELD_TYPE_TIME:
|
case MYSQL_TYPE_TIME:
|
||||||
return new Field_time(ptr,null_pos,null_bit,
|
return new Field_time(ptr,null_pos,null_bit,
|
||||||
unireg_check, field_name, field_charset);
|
unireg_check, field_name, field_charset);
|
||||||
case FIELD_TYPE_DATETIME:
|
case MYSQL_TYPE_DATETIME:
|
||||||
return new Field_datetime(ptr,null_pos,null_bit,
|
return new Field_datetime(ptr,null_pos,null_bit,
|
||||||
unireg_check, field_name, field_charset);
|
unireg_check, field_name, field_charset);
|
||||||
case FIELD_TYPE_NULL:
|
case MYSQL_TYPE_NULL:
|
||||||
return new Field_null(ptr, field_length, unireg_check, field_name,
|
return new Field_null(ptr, field_length, unireg_check, field_name,
|
||||||
field_charset);
|
field_charset);
|
||||||
case FIELD_TYPE_BIT:
|
case MYSQL_TYPE_BIT:
|
||||||
return f_bit_as_char(pack_flag) ?
|
return f_bit_as_char(pack_flag) ?
|
||||||
new Field_bit_as_char(ptr, field_length, null_pos, null_bit,
|
new Field_bit_as_char(ptr, field_length, null_pos, null_bit,
|
||||||
unireg_check, field_name) :
|
unireg_check, field_name) :
|
||||||
@ -9253,12 +9253,12 @@ create_field::create_field(Field *old_field,Field *orig_field)
|
|||||||
portable_sizeof_char_ptr);
|
portable_sizeof_char_ptr);
|
||||||
|
|
||||||
switch (sql_type) {
|
switch (sql_type) {
|
||||||
case FIELD_TYPE_BLOB:
|
case MYSQL_TYPE_BLOB:
|
||||||
switch (pack_length - portable_sizeof_char_ptr) {
|
switch (pack_length - portable_sizeof_char_ptr) {
|
||||||
case 1: sql_type= FIELD_TYPE_TINY_BLOB; break;
|
case 1: sql_type= MYSQL_TYPE_TINY_BLOB; break;
|
||||||
case 2: sql_type= FIELD_TYPE_BLOB; break;
|
case 2: sql_type= MYSQL_TYPE_BLOB; break;
|
||||||
case 3: sql_type= FIELD_TYPE_MEDIUM_BLOB; break;
|
case 3: sql_type= MYSQL_TYPE_MEDIUM_BLOB; break;
|
||||||
default: sql_type= FIELD_TYPE_LONG_BLOB; break;
|
default: sql_type= MYSQL_TYPE_LONG_BLOB; break;
|
||||||
}
|
}
|
||||||
length/= charset->mbmaxlen;
|
length/= charset->mbmaxlen;
|
||||||
key_length/= charset->mbmaxlen;
|
key_length/= charset->mbmaxlen;
|
||||||
@ -9277,7 +9277,7 @@ create_field::create_field(Field *old_field,Field *orig_field)
|
|||||||
length= (length+charset->mbmaxlen-1) / charset->mbmaxlen;
|
length= (length+charset->mbmaxlen-1) / charset->mbmaxlen;
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_SPATIAL
|
#ifdef HAVE_SPATIAL
|
||||||
case FIELD_TYPE_GEOMETRY:
|
case MYSQL_TYPE_GEOMETRY:
|
||||||
geom_type= ((Field_geom*)old_field)->geom_type;
|
geom_type= ((Field_geom*)old_field)->geom_type;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@ -9294,7 +9294,7 @@ create_field::create_field(Field *old_field,Field *orig_field)
|
|||||||
|
|
||||||
if (!(flags & (NO_DEFAULT_VALUE_FLAG | BLOB_FLAG)) &&
|
if (!(flags & (NO_DEFAULT_VALUE_FLAG | BLOB_FLAG)) &&
|
||||||
old_field->ptr && orig_field &&
|
old_field->ptr && orig_field &&
|
||||||
(sql_type != FIELD_TYPE_TIMESTAMP || /* set def only if */
|
(sql_type != MYSQL_TYPE_TIMESTAMP || /* set def only if */
|
||||||
old_field->table->timestamp_field != old_field || /* timestamp field */
|
old_field->table->timestamp_field != old_field || /* timestamp field */
|
||||||
unireg_check == Field::TIMESTAMP_UN_FIELD)) /* has default val */
|
unireg_check == Field::TIMESTAMP_UN_FIELD)) /* has default val */
|
||||||
{
|
{
|
||||||
|
48
sql/field.h
48
sql/field.h
@ -518,7 +518,7 @@ public:
|
|||||||
unireg_check_arg, field_name_arg,
|
unireg_check_arg, field_name_arg,
|
||||||
dec_arg, zero_arg, unsigned_arg)
|
dec_arg, zero_arg, unsigned_arg)
|
||||||
{}
|
{}
|
||||||
enum_field_types type() const { return FIELD_TYPE_DECIMAL;}
|
enum_field_types type() const { return MYSQL_TYPE_DECIMAL;}
|
||||||
enum ha_base_keytype key_type() const
|
enum ha_base_keytype key_type() const
|
||||||
{ return zerofill ? HA_KEYTYPE_BINARY : HA_KEYTYPE_NUM; }
|
{ return zerofill ? HA_KEYTYPE_BINARY : HA_KEYTYPE_NUM; }
|
||||||
void reset(void);
|
void reset(void);
|
||||||
@ -556,7 +556,7 @@ public:
|
|||||||
Field_new_decimal(uint32 len_arg, bool maybe_null_arg,
|
Field_new_decimal(uint32 len_arg, bool maybe_null_arg,
|
||||||
const char *field_name_arg, uint8 dec_arg,
|
const char *field_name_arg, uint8 dec_arg,
|
||||||
bool unsigned_arg);
|
bool unsigned_arg);
|
||||||
enum_field_types type() const { return FIELD_TYPE_NEWDECIMAL;}
|
enum_field_types type() const { return MYSQL_TYPE_NEWDECIMAL;}
|
||||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
|
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
|
||||||
Item_result result_type () const { return DECIMAL_RESULT; }
|
Item_result result_type () const { return DECIMAL_RESULT; }
|
||||||
void reset(void);
|
void reset(void);
|
||||||
@ -593,7 +593,7 @@ public:
|
|||||||
0, zero_arg,unsigned_arg)
|
0, zero_arg,unsigned_arg)
|
||||||
{}
|
{}
|
||||||
enum Item_result result_type () const { return INT_RESULT; }
|
enum Item_result result_type () const { return INT_RESULT; }
|
||||||
enum_field_types type() const { return FIELD_TYPE_TINY;}
|
enum_field_types type() const { return MYSQL_TYPE_TINY;}
|
||||||
enum ha_base_keytype key_type() const
|
enum ha_base_keytype key_type() const
|
||||||
{ return unsigned_flag ? HA_KEYTYPE_BINARY : HA_KEYTYPE_INT8; }
|
{ return unsigned_flag ? HA_KEYTYPE_BINARY : HA_KEYTYPE_INT8; }
|
||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
@ -628,7 +628,7 @@ public:
|
|||||||
NONE, field_name_arg, 0, 0, unsigned_arg)
|
NONE, field_name_arg, 0, 0, unsigned_arg)
|
||||||
{}
|
{}
|
||||||
enum Item_result result_type () const { return INT_RESULT; }
|
enum Item_result result_type () const { return INT_RESULT; }
|
||||||
enum_field_types type() const { return FIELD_TYPE_SHORT;}
|
enum_field_types type() const { return MYSQL_TYPE_SHORT;}
|
||||||
enum ha_base_keytype key_type() const
|
enum ha_base_keytype key_type() const
|
||||||
{ return unsigned_flag ? HA_KEYTYPE_USHORT_INT : HA_KEYTYPE_SHORT_INT;}
|
{ return unsigned_flag ? HA_KEYTYPE_USHORT_INT : HA_KEYTYPE_SHORT_INT;}
|
||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
@ -658,7 +658,7 @@ public:
|
|||||||
0, zero_arg,unsigned_arg)
|
0, zero_arg,unsigned_arg)
|
||||||
{}
|
{}
|
||||||
enum Item_result result_type () const { return INT_RESULT; }
|
enum Item_result result_type () const { return INT_RESULT; }
|
||||||
enum_field_types type() const { return FIELD_TYPE_INT24;}
|
enum_field_types type() const { return MYSQL_TYPE_INT24;}
|
||||||
enum ha_base_keytype key_type() const
|
enum ha_base_keytype key_type() const
|
||||||
{ return unsigned_flag ? HA_KEYTYPE_UINT24 : HA_KEYTYPE_INT24; }
|
{ return unsigned_flag ? HA_KEYTYPE_UINT24 : HA_KEYTYPE_INT24; }
|
||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
@ -693,7 +693,7 @@ public:
|
|||||||
NONE, field_name_arg,0,0,unsigned_arg)
|
NONE, field_name_arg,0,0,unsigned_arg)
|
||||||
{}
|
{}
|
||||||
enum Item_result result_type () const { return INT_RESULT; }
|
enum Item_result result_type () const { return INT_RESULT; }
|
||||||
enum_field_types type() const { return FIELD_TYPE_LONG;}
|
enum_field_types type() const { return MYSQL_TYPE_LONG;}
|
||||||
enum ha_base_keytype key_type() const
|
enum ha_base_keytype key_type() const
|
||||||
{ return unsigned_flag ? HA_KEYTYPE_ULONG_INT : HA_KEYTYPE_LONG_INT; }
|
{ return unsigned_flag ? HA_KEYTYPE_ULONG_INT : HA_KEYTYPE_LONG_INT; }
|
||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
@ -730,7 +730,7 @@ public:
|
|||||||
NONE, field_name_arg,0,0,unsigned_arg)
|
NONE, field_name_arg,0,0,unsigned_arg)
|
||||||
{}
|
{}
|
||||||
enum Item_result result_type () const { return INT_RESULT; }
|
enum Item_result result_type () const { return INT_RESULT; }
|
||||||
enum_field_types type() const { return FIELD_TYPE_LONGLONG;}
|
enum_field_types type() const { return MYSQL_TYPE_LONGLONG;}
|
||||||
enum ha_base_keytype key_type() const
|
enum ha_base_keytype key_type() const
|
||||||
{ return unsigned_flag ? HA_KEYTYPE_ULONGLONG : HA_KEYTYPE_LONGLONG; }
|
{ return unsigned_flag ? HA_KEYTYPE_ULONGLONG : HA_KEYTYPE_LONGLONG; }
|
||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
@ -766,7 +766,7 @@ public:
|
|||||||
:Field_real((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0,
|
:Field_real((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0,
|
||||||
NONE, field_name_arg, dec_arg, 0, 0)
|
NONE, field_name_arg, dec_arg, 0, 0)
|
||||||
{}
|
{}
|
||||||
enum_field_types type() const { return FIELD_TYPE_FLOAT;}
|
enum_field_types type() const { return MYSQL_TYPE_FLOAT;}
|
||||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_FLOAT; }
|
enum ha_base_keytype key_type() const { return HA_KEYTYPE_FLOAT; }
|
||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
int store(double nr);
|
int store(double nr);
|
||||||
@ -799,7 +799,7 @@ public:
|
|||||||
:Field_real((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0,
|
:Field_real((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, (uint) 0,
|
||||||
NONE, field_name_arg, dec_arg, 0, 0)
|
NONE, field_name_arg, dec_arg, 0, 0)
|
||||||
{}
|
{}
|
||||||
enum_field_types type() const { return FIELD_TYPE_DOUBLE;}
|
enum_field_types type() const { return MYSQL_TYPE_DOUBLE;}
|
||||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_DOUBLE; }
|
enum ha_base_keytype key_type() const { return HA_KEYTYPE_DOUBLE; }
|
||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
int store(double nr);
|
int store(double nr);
|
||||||
@ -828,7 +828,7 @@ public:
|
|||||||
:Field_str(ptr_arg, len_arg, null, 1,
|
:Field_str(ptr_arg, len_arg, null, 1,
|
||||||
unireg_check_arg, field_name_arg, cs)
|
unireg_check_arg, field_name_arg, cs)
|
||||||
{}
|
{}
|
||||||
enum_field_types type() const { return FIELD_TYPE_NULL;}
|
enum_field_types type() const { return MYSQL_TYPE_NULL;}
|
||||||
int store(const char *to, uint length, CHARSET_INFO *cs)
|
int store(const char *to, uint length, CHARSET_INFO *cs)
|
||||||
{ null[0]=1; return 0; }
|
{ null[0]=1; return 0; }
|
||||||
int store(double nr) { null[0]=1; return 0; }
|
int store(double nr) { null[0]=1; return 0; }
|
||||||
@ -857,7 +857,7 @@ public:
|
|||||||
TABLE_SHARE *share, CHARSET_INFO *cs);
|
TABLE_SHARE *share, CHARSET_INFO *cs);
|
||||||
Field_timestamp(bool maybe_null_arg, const char *field_name_arg,
|
Field_timestamp(bool maybe_null_arg, const char *field_name_arg,
|
||||||
CHARSET_INFO *cs);
|
CHARSET_INFO *cs);
|
||||||
enum_field_types type() const { return FIELD_TYPE_TIMESTAMP;}
|
enum_field_types type() const { return MYSQL_TYPE_TIMESTAMP;}
|
||||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
|
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
|
||||||
enum Item_result cmp_type () const { return INT_RESULT; }
|
enum Item_result cmp_type () const { return INT_RESULT; }
|
||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
@ -910,7 +910,7 @@ public:
|
|||||||
:Field_tiny(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
|
:Field_tiny(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
|
||||||
unireg_check_arg, field_name_arg, 1, 1)
|
unireg_check_arg, field_name_arg, 1, 1)
|
||||||
{}
|
{}
|
||||||
enum_field_types type() const { return FIELD_TYPE_YEAR;}
|
enum_field_types type() const { return MYSQL_TYPE_YEAR;}
|
||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
int store(double nr);
|
int store(double nr);
|
||||||
int store(longlong nr, bool unsigned_val);
|
int store(longlong nr, bool unsigned_val);
|
||||||
@ -935,7 +935,7 @@ public:
|
|||||||
CHARSET_INFO *cs)
|
CHARSET_INFO *cs)
|
||||||
:Field_str((char*) 0,10, maybe_null_arg ? (uchar*) "": 0,0,
|
:Field_str((char*) 0,10, maybe_null_arg ? (uchar*) "": 0,0,
|
||||||
NONE, field_name_arg, cs) {}
|
NONE, field_name_arg, cs) {}
|
||||||
enum_field_types type() const { return FIELD_TYPE_DATE;}
|
enum_field_types type() const { return MYSQL_TYPE_DATE;}
|
||||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
|
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
|
||||||
enum Item_result cmp_type () const { return INT_RESULT; }
|
enum Item_result cmp_type () const { return INT_RESULT; }
|
||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
@ -963,8 +963,8 @@ public:
|
|||||||
:Field_str(ptr_arg, 10, null_ptr_arg, null_bit_arg,
|
:Field_str(ptr_arg, 10, null_ptr_arg, null_bit_arg,
|
||||||
unireg_check_arg, field_name_arg, cs)
|
unireg_check_arg, field_name_arg, cs)
|
||||||
{}
|
{}
|
||||||
enum_field_types type() const { return FIELD_TYPE_DATE;}
|
enum_field_types type() const { return MYSQL_TYPE_DATE;}
|
||||||
enum_field_types real_type() const { return FIELD_TYPE_NEWDATE; }
|
enum_field_types real_type() const { return MYSQL_TYPE_NEWDATE; }
|
||||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_UINT24; }
|
enum ha_base_keytype key_type() const { return HA_KEYTYPE_UINT24; }
|
||||||
enum Item_result cmp_type () const { return INT_RESULT; }
|
enum Item_result cmp_type () const { return INT_RESULT; }
|
||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
@ -999,7 +999,7 @@ public:
|
|||||||
CHARSET_INFO *cs)
|
CHARSET_INFO *cs)
|
||||||
:Field_str((char*) 0,8, maybe_null_arg ? (uchar*) "": 0,0,
|
:Field_str((char*) 0,8, maybe_null_arg ? (uchar*) "": 0,0,
|
||||||
NONE, field_name_arg, cs) {}
|
NONE, field_name_arg, cs) {}
|
||||||
enum_field_types type() const { return FIELD_TYPE_TIME;}
|
enum_field_types type() const { return MYSQL_TYPE_TIME;}
|
||||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; }
|
enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; }
|
||||||
enum Item_result cmp_type () const { return INT_RESULT; }
|
enum Item_result cmp_type () const { return INT_RESULT; }
|
||||||
int store_time(TIME *ltime, timestamp_type type);
|
int store_time(TIME *ltime, timestamp_type type);
|
||||||
@ -1034,7 +1034,7 @@ public:
|
|||||||
CHARSET_INFO *cs)
|
CHARSET_INFO *cs)
|
||||||
:Field_str((char*) 0,19, maybe_null_arg ? (uchar*) "": 0,0,
|
:Field_str((char*) 0,19, maybe_null_arg ? (uchar*) "": 0,0,
|
||||||
NONE, field_name_arg, cs) {}
|
NONE, field_name_arg, cs) {}
|
||||||
enum_field_types type() const { return FIELD_TYPE_DATETIME;}
|
enum_field_types type() const { return MYSQL_TYPE_DATETIME;}
|
||||||
#ifdef HAVE_LONG_LONG
|
#ifdef HAVE_LONG_LONG
|
||||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONGLONG; }
|
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONGLONG; }
|
||||||
#endif
|
#endif
|
||||||
@ -1106,7 +1106,7 @@ public:
|
|||||||
uint packed_col_length(const char *to, uint length);
|
uint packed_col_length(const char *to, uint length);
|
||||||
uint max_packed_col_length(uint max_length);
|
uint max_packed_col_length(uint max_length);
|
||||||
uint size_of() const { return sizeof(*this); }
|
uint size_of() const { return sizeof(*this); }
|
||||||
enum_field_types real_type() const { return FIELD_TYPE_STRING; }
|
enum_field_types real_type() const { return MYSQL_TYPE_STRING; }
|
||||||
bool has_charset(void) const
|
bool has_charset(void) const
|
||||||
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
|
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
|
||||||
Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type);
|
Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type);
|
||||||
@ -1223,7 +1223,7 @@ public:
|
|||||||
char_length <= 16777215 ? 3 : 4;
|
char_length <= 16777215 ? 3 : 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
enum_field_types type() const { return FIELD_TYPE_BLOB;}
|
enum_field_types type() const { return MYSQL_TYPE_BLOB;}
|
||||||
enum ha_base_keytype key_type() const
|
enum ha_base_keytype key_type() const
|
||||||
{ return binary() ? HA_KEYTYPE_VARBINARY2 : HA_KEYTYPE_VARTEXT2; }
|
{ return binary() ? HA_KEYTYPE_VARBINARY2 : HA_KEYTYPE_VARTEXT2; }
|
||||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||||
@ -1325,7 +1325,7 @@ public:
|
|||||||
:Field_blob(len_arg, maybe_null_arg, field_name_arg, &my_charset_bin)
|
:Field_blob(len_arg, maybe_null_arg, field_name_arg, &my_charset_bin)
|
||||||
{ geom_type= geom_type_arg; }
|
{ geom_type= geom_type_arg; }
|
||||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_VARBINARY2; }
|
enum ha_base_keytype key_type() const { return HA_KEYTYPE_VARBINARY2; }
|
||||||
enum_field_types type() const { return FIELD_TYPE_GEOMETRY; }
|
enum_field_types type() const { return MYSQL_TYPE_GEOMETRY; }
|
||||||
void sql_type(String &str) const;
|
void sql_type(String &str) const;
|
||||||
int store(const char *to, uint length, CHARSET_INFO *charset);
|
int store(const char *to, uint length, CHARSET_INFO *charset);
|
||||||
int store(double nr);
|
int store(double nr);
|
||||||
@ -1354,7 +1354,7 @@ public:
|
|||||||
{
|
{
|
||||||
flags|=ENUM_FLAG;
|
flags|=ENUM_FLAG;
|
||||||
}
|
}
|
||||||
enum_field_types type() const { return FIELD_TYPE_STRING; }
|
enum_field_types type() const { return MYSQL_TYPE_STRING; }
|
||||||
enum Item_result cmp_type () const { return INT_RESULT; }
|
enum Item_result cmp_type () const { return INT_RESULT; }
|
||||||
enum Item_result cast_to_int_type () const { return INT_RESULT; }
|
enum Item_result cast_to_int_type () const { return INT_RESULT; }
|
||||||
enum ha_base_keytype key_type() const;
|
enum ha_base_keytype key_type() const;
|
||||||
@ -1371,7 +1371,7 @@ public:
|
|||||||
void store_type(ulonglong value);
|
void store_type(ulonglong value);
|
||||||
void sql_type(String &str) const;
|
void sql_type(String &str) const;
|
||||||
uint size_of() const { return sizeof(*this); }
|
uint size_of() const { return sizeof(*this); }
|
||||||
enum_field_types real_type() const { return FIELD_TYPE_ENUM; }
|
enum_field_types real_type() const { return MYSQL_TYPE_ENUM; }
|
||||||
virtual bool zero_pack() const { return 0; }
|
virtual bool zero_pack() const { return 0; }
|
||||||
bool optimize_range(uint idx, uint part) { return 0; }
|
bool optimize_range(uint idx, uint part) { return 0; }
|
||||||
bool eq_def(Field *field);
|
bool eq_def(Field *field);
|
||||||
@ -1401,7 +1401,7 @@ public:
|
|||||||
virtual bool zero_pack() const { return 1; }
|
virtual bool zero_pack() const { return 1; }
|
||||||
String *val_str(String*,String *);
|
String *val_str(String*,String *);
|
||||||
void sql_type(String &str) const;
|
void sql_type(String &str) const;
|
||||||
enum_field_types real_type() const { return FIELD_TYPE_SET; }
|
enum_field_types real_type() const { return MYSQL_TYPE_SET; }
|
||||||
bool has_charset(void) const { return TRUE; }
|
bool has_charset(void) const { return TRUE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1429,7 +1429,7 @@ public:
|
|||||||
Field_bit(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
|
Field_bit(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
|
||||||
uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg,
|
uchar null_bit_arg, uchar *bit_ptr_arg, uchar bit_ofs_arg,
|
||||||
enum utype unireg_check_arg, const char *field_name_arg);
|
enum utype unireg_check_arg, const char *field_name_arg);
|
||||||
enum_field_types type() const { return FIELD_TYPE_BIT; }
|
enum_field_types type() const { return MYSQL_TYPE_BIT; }
|
||||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BIT; }
|
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BIT; }
|
||||||
uint32 key_length() const { return (uint32) (field_length + 7) / 8; }
|
uint32 key_length() const { return (uint32) (field_length + 7) / 8; }
|
||||||
uint32 max_length() { return field_length; }
|
uint32 max_length() { return field_length; }
|
||||||
|
@ -165,7 +165,7 @@ set_field_to_null_with_conversions(Field *field, bool no_conversions)
|
|||||||
when set to NULL (TIMESTAMP fields which allow setting to NULL
|
when set to NULL (TIMESTAMP fields which allow setting to NULL
|
||||||
are handled by first check).
|
are handled by first check).
|
||||||
*/
|
*/
|
||||||
if (field->type() == FIELD_TYPE_TIMESTAMP)
|
if (field->type() == MYSQL_TYPE_TIMESTAMP)
|
||||||
{
|
{
|
||||||
((Field_timestamp*) field)->set_time();
|
((Field_timestamp*) field)->set_time();
|
||||||
return 0; // Ok to set time to NULL
|
return 0; // Ok to set time to NULL
|
||||||
@ -485,7 +485,7 @@ void Copy_field::set(char *to,Field *from)
|
|||||||
|
|
||||||
void Copy_field::set(Field *to,Field *from,bool save)
|
void Copy_field::set(Field *to,Field *from,bool save)
|
||||||
{
|
{
|
||||||
if (to->type() == FIELD_TYPE_NULL)
|
if (to->type() == MYSQL_TYPE_NULL)
|
||||||
{
|
{
|
||||||
to_null_ptr=0; // For easy debugging
|
to_null_ptr=0; // For easy debugging
|
||||||
to_ptr=0;
|
to_ptr=0;
|
||||||
@ -519,7 +519,7 @@ void Copy_field::set(Field *to,Field *from,bool save)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (to_field->type() == FIELD_TYPE_TIMESTAMP)
|
if (to_field->type() == MYSQL_TYPE_TIMESTAMP)
|
||||||
do_copy= do_copy_timestamp; // Automatic timestamp
|
do_copy= do_copy_timestamp; // Automatic timestamp
|
||||||
else if (to_field == to_field->table->next_number_field)
|
else if (to_field == to_field->table->next_number_field)
|
||||||
do_copy= do_copy_next_number;
|
do_copy= do_copy_next_number;
|
||||||
@ -563,8 +563,8 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (to->real_type() == FIELD_TYPE_BIT ||
|
if (to->real_type() == MYSQL_TYPE_BIT ||
|
||||||
from->real_type() == FIELD_TYPE_BIT)
|
from->real_type() == MYSQL_TYPE_BIT)
|
||||||
return do_field_int;
|
return do_field_int;
|
||||||
// Check if identical fields
|
// Check if identical fields
|
||||||
if (from->result_type() == STRING_RESULT)
|
if (from->result_type() == STRING_RESULT)
|
||||||
@ -577,17 +577,17 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
|
|||||||
!compatible_db_low_byte_first ||
|
!compatible_db_low_byte_first ||
|
||||||
((to->table->in_use->variables.sql_mode &
|
((to->table->in_use->variables.sql_mode &
|
||||||
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) &&
|
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) &&
|
||||||
to->type() == FIELD_TYPE_DATE ||
|
to->type() == MYSQL_TYPE_DATE ||
|
||||||
to->type() == FIELD_TYPE_DATETIME))
|
to->type() == MYSQL_TYPE_DATETIME))
|
||||||
{
|
{
|
||||||
if (from->real_type() == FIELD_TYPE_ENUM ||
|
if (from->real_type() == MYSQL_TYPE_ENUM ||
|
||||||
from->real_type() == FIELD_TYPE_SET)
|
from->real_type() == MYSQL_TYPE_SET)
|
||||||
if (to->result_type() != STRING_RESULT)
|
if (to->result_type() != STRING_RESULT)
|
||||||
return do_field_int; // Convert SET to number
|
return do_field_int; // Convert SET to number
|
||||||
return do_field_string;
|
return do_field_string;
|
||||||
}
|
}
|
||||||
if (to->real_type() == FIELD_TYPE_ENUM ||
|
if (to->real_type() == MYSQL_TYPE_ENUM ||
|
||||||
to->real_type() == FIELD_TYPE_SET)
|
to->real_type() == MYSQL_TYPE_SET)
|
||||||
{
|
{
|
||||||
if (!to->eq_def(from))
|
if (!to->eq_def(from))
|
||||||
return do_field_string;
|
return do_field_string;
|
||||||
@ -620,7 +620,7 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
|
|||||||
to_length != from_length ||
|
to_length != from_length ||
|
||||||
!compatible_db_low_byte_first)
|
!compatible_db_low_byte_first)
|
||||||
{
|
{
|
||||||
if (to->real_type() == FIELD_TYPE_DECIMAL ||
|
if (to->real_type() == MYSQL_TYPE_DECIMAL ||
|
||||||
to->result_type() == STRING_RESULT)
|
to->result_type() == STRING_RESULT)
|
||||||
return do_field_string;
|
return do_field_string;
|
||||||
if (to->result_type() == INT_RESULT)
|
if (to->result_type() == INT_RESULT)
|
||||||
@ -631,7 +631,7 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
|
|||||||
{
|
{
|
||||||
if (!to->eq_def(from) || !compatible_db_low_byte_first)
|
if (!to->eq_def(from) || !compatible_db_low_byte_first)
|
||||||
{
|
{
|
||||||
if (to->real_type() == FIELD_TYPE_DECIMAL)
|
if (to->real_type() == MYSQL_TYPE_DECIMAL)
|
||||||
return do_field_string;
|
return do_field_string;
|
||||||
if (to->result_type() == INT_RESULT)
|
if (to->result_type() == INT_RESULT)
|
||||||
return do_field_int;
|
return do_field_int;
|
||||||
@ -658,22 +658,22 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
|
|||||||
void field_conv(Field *to,Field *from)
|
void field_conv(Field *to,Field *from)
|
||||||
{
|
{
|
||||||
if (to->real_type() == from->real_type() &&
|
if (to->real_type() == from->real_type() &&
|
||||||
!(to->type() == FIELD_TYPE_BLOB && to->table->copy_blobs))
|
!(to->type() == MYSQL_TYPE_BLOB && to->table->copy_blobs))
|
||||||
{
|
{
|
||||||
if (to->pack_length() == from->pack_length() &&
|
if (to->pack_length() == from->pack_length() &&
|
||||||
!(to->flags & UNSIGNED_FLAG && !(from->flags & UNSIGNED_FLAG)) &&
|
!(to->flags & UNSIGNED_FLAG && !(from->flags & UNSIGNED_FLAG)) &&
|
||||||
to->real_type() != FIELD_TYPE_ENUM &&
|
to->real_type() != MYSQL_TYPE_ENUM &&
|
||||||
to->real_type() != FIELD_TYPE_SET &&
|
to->real_type() != MYSQL_TYPE_SET &&
|
||||||
to->real_type() != FIELD_TYPE_BIT &&
|
to->real_type() != MYSQL_TYPE_BIT &&
|
||||||
(to->real_type() != FIELD_TYPE_NEWDECIMAL ||
|
(to->real_type() != MYSQL_TYPE_NEWDECIMAL ||
|
||||||
(to->field_length == from->field_length &&
|
(to->field_length == from->field_length &&
|
||||||
(((Field_num*)to)->dec == ((Field_num*)from)->dec))) &&
|
(((Field_num*)to)->dec == ((Field_num*)from)->dec))) &&
|
||||||
from->charset() == to->charset() &&
|
from->charset() == to->charset() &&
|
||||||
to->table->s->db_low_byte_first == from->table->s->db_low_byte_first &&
|
to->table->s->db_low_byte_first == from->table->s->db_low_byte_first &&
|
||||||
(!(to->table->in_use->variables.sql_mode &
|
(!(to->table->in_use->variables.sql_mode &
|
||||||
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) ||
|
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) ||
|
||||||
to->type() != FIELD_TYPE_DATE &&
|
to->type() != MYSQL_TYPE_DATE &&
|
||||||
to->type() != FIELD_TYPE_DATETIME) &&
|
to->type() != MYSQL_TYPE_DATETIME) &&
|
||||||
(from->real_type() != MYSQL_TYPE_VARCHAR ||
|
(from->real_type() != MYSQL_TYPE_VARCHAR ||
|
||||||
((Field_varstring*)from)->length_bytes ==
|
((Field_varstring*)from)->length_bytes ==
|
||||||
((Field_varstring*)to)->length_bytes))
|
((Field_varstring*)to)->length_bytes))
|
||||||
@ -686,7 +686,7 @@ void field_conv(Field *to,Field *from)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (to->type() == FIELD_TYPE_BLOB)
|
if (to->type() == MYSQL_TYPE_BLOB)
|
||||||
{ // Be sure the value is stored
|
{ // Be sure the value is stored
|
||||||
Field_blob *blob=(Field_blob*) to;
|
Field_blob *blob=(Field_blob*) to;
|
||||||
from->val_str(&blob->value);
|
from->val_str(&blob->value);
|
||||||
@ -704,9 +704,9 @@ void field_conv(Field *to,Field *from)
|
|||||||
}
|
}
|
||||||
if ((from->result_type() == STRING_RESULT &&
|
if ((from->result_type() == STRING_RESULT &&
|
||||||
(to->result_type() == STRING_RESULT ||
|
(to->result_type() == STRING_RESULT ||
|
||||||
(from->real_type() != FIELD_TYPE_ENUM &&
|
(from->real_type() != MYSQL_TYPE_ENUM &&
|
||||||
from->real_type() != FIELD_TYPE_SET))) ||
|
from->real_type() != MYSQL_TYPE_SET))) ||
|
||||||
to->type() == FIELD_TYPE_DECIMAL)
|
to->type() == MYSQL_TYPE_DECIMAL)
|
||||||
{
|
{
|
||||||
char buff[MAX_FIELD_WIDTH];
|
char buff[MAX_FIELD_WIDTH];
|
||||||
String result(buff,sizeof(buff),from->charset());
|
String result(buff,sizeof(buff),from->charset());
|
||||||
|
@ -2278,7 +2278,7 @@ int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt)
|
|||||||
if (!keypart->fieldnr)
|
if (!keypart->fieldnr)
|
||||||
continue;
|
continue;
|
||||||
Field *field= table->field[keypart->fieldnr-1];
|
Field *field= table->field[keypart->fieldnr-1];
|
||||||
if (field->type() == FIELD_TYPE_BLOB)
|
if (field->type() == MYSQL_TYPE_BLOB)
|
||||||
{
|
{
|
||||||
if (check_opt->sql_flags & TT_FOR_UPGRADE)
|
if (check_opt->sql_flags & TT_FOR_UPGRADE)
|
||||||
check_opt->flags= T_MEDIUM;
|
check_opt->flags= T_MEDIUM;
|
||||||
@ -2300,7 +2300,7 @@ int handler::check_old_types()
|
|||||||
/* check for bad DECIMAL field */
|
/* check for bad DECIMAL field */
|
||||||
for (field= table->field; (*field); field++)
|
for (field= table->field; (*field); field++)
|
||||||
{
|
{
|
||||||
if ((*field)->type() == FIELD_TYPE_NEWDECIMAL)
|
if ((*field)->type() == MYSQL_TYPE_NEWDECIMAL)
|
||||||
{
|
{
|
||||||
return HA_ADMIN_NEEDS_ALTER;
|
return HA_ADMIN_NEEDS_ALTER;
|
||||||
}
|
}
|
||||||
|
12
sql/item.cc
12
sql/item.cc
@ -4100,11 +4100,11 @@ void Item::make_field(Send_field *tmp_field)
|
|||||||
|
|
||||||
enum_field_types Item::string_field_type() const
|
enum_field_types Item::string_field_type() const
|
||||||
{
|
{
|
||||||
enum_field_types type= FIELD_TYPE_VAR_STRING;
|
enum_field_types type= MYSQL_TYPE_VAR_STRING;
|
||||||
if (max_length >= 16777216)
|
if (max_length >= 16777216)
|
||||||
type= FIELD_TYPE_LONG_BLOB;
|
type= MYSQL_TYPE_LONG_BLOB;
|
||||||
else if (max_length >= 65536)
|
else if (max_length >= 65536)
|
||||||
type= FIELD_TYPE_MEDIUM_BLOB;
|
type= MYSQL_TYPE_MEDIUM_BLOB;
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4119,9 +4119,9 @@ enum_field_types Item::field_type() const
|
|||||||
{
|
{
|
||||||
switch (result_type()) {
|
switch (result_type()) {
|
||||||
case STRING_RESULT: return string_field_type();
|
case STRING_RESULT: return string_field_type();
|
||||||
case INT_RESULT: return FIELD_TYPE_LONGLONG;
|
case INT_RESULT: return MYSQL_TYPE_LONGLONG;
|
||||||
case DECIMAL_RESULT: return FIELD_TYPE_NEWDECIMAL;
|
case DECIMAL_RESULT: return MYSQL_TYPE_NEWDECIMAL;
|
||||||
case REAL_RESULT: return FIELD_TYPE_DOUBLE;
|
case REAL_RESULT: return MYSQL_TYPE_DOUBLE;
|
||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
default:
|
default:
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
|
@ -2499,7 +2499,7 @@ void Item_func_find_in_set::fix_length_and_dec()
|
|||||||
if (args[0]->const_item() && args[1]->type() == FIELD_ITEM)
|
if (args[0]->const_item() && args[1]->type() == FIELD_ITEM)
|
||||||
{
|
{
|
||||||
Field *field= ((Item_field*) args[1])->field;
|
Field *field= ((Item_field*) args[1])->field;
|
||||||
if (field->real_type() == FIELD_TYPE_SET)
|
if (field->real_type() == MYSQL_TYPE_SET)
|
||||||
{
|
{
|
||||||
String *find=args[0]->val_str(&value);
|
String *find=args[0]->val_str(&value);
|
||||||
if (find)
|
if (find)
|
||||||
|
@ -1674,7 +1674,7 @@ void subselect_engine::set_row(List<Item> &item_list, Item_cache **row)
|
|||||||
Item *sel_item;
|
Item *sel_item;
|
||||||
List_iterator_fast<Item> li(item_list);
|
List_iterator_fast<Item> li(item_list);
|
||||||
res_type= STRING_RESULT;
|
res_type= STRING_RESULT;
|
||||||
res_field_type= FIELD_TYPE_VAR_STRING;
|
res_field_type= MYSQL_TYPE_VAR_STRING;
|
||||||
for (uint i= 0; (sel_item= li++); i++)
|
for (uint i= 0; (sel_item= li++); i++)
|
||||||
{
|
{
|
||||||
item->max_length= sel_item->max_length;
|
item->max_length= sel_item->max_length;
|
||||||
|
@ -323,7 +323,7 @@ public:
|
|||||||
result= res;
|
result= res;
|
||||||
item= si;
|
item= si;
|
||||||
res_type= STRING_RESULT;
|
res_type= STRING_RESULT;
|
||||||
res_field_type= FIELD_TYPE_VAR_STRING;
|
res_field_type= MYSQL_TYPE_VAR_STRING;
|
||||||
maybe_null= 0;
|
maybe_null= 0;
|
||||||
}
|
}
|
||||||
virtual ~subselect_engine() {}; // to satisfy compiler
|
virtual ~subselect_engine() {}; // to satisfy compiler
|
||||||
|
@ -804,7 +804,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
Item_sum_hybrid(Item *item_par,int sign)
|
Item_sum_hybrid(Item *item_par,int sign)
|
||||||
:Item_sum(item_par), sum(0.0), sum_int(0),
|
:Item_sum(item_par), sum(0.0), sum_int(0),
|
||||||
hybrid_type(INT_RESULT), hybrid_field_type(FIELD_TYPE_LONGLONG),
|
hybrid_type(INT_RESULT), hybrid_field_type(MYSQL_TYPE_LONGLONG),
|
||||||
cmp_sign(sign), used_table_cache(~(table_map) 0),
|
cmp_sign(sign), used_table_cache(~(table_map) 0),
|
||||||
was_values(TRUE)
|
was_values(TRUE)
|
||||||
{ collation.set(&my_charset_bin); }
|
{ collation.set(&my_charset_bin); }
|
||||||
@ -1187,7 +1187,7 @@ public:
|
|||||||
enum_field_types field_type() const
|
enum_field_types field_type() const
|
||||||
{
|
{
|
||||||
if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB )
|
if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB )
|
||||||
return FIELD_TYPE_BLOB;
|
return MYSQL_TYPE_BLOB;
|
||||||
else
|
else
|
||||||
return MYSQL_TYPE_VARCHAR;
|
return MYSQL_TYPE_VARCHAR;
|
||||||
}
|
}
|
||||||
|
@ -1185,7 +1185,7 @@ longlong Item_func_unix_timestamp::val_int()
|
|||||||
if (args[0]->type() == FIELD_ITEM)
|
if (args[0]->type() == FIELD_ITEM)
|
||||||
{ // Optimize timestamp field
|
{ // Optimize timestamp field
|
||||||
Field *field=((Item_field*) args[0])->field;
|
Field *field=((Item_field*) args[0])->field;
|
||||||
if (field->type() == FIELD_TYPE_TIMESTAMP)
|
if (field->type() == MYSQL_TYPE_TIMESTAMP)
|
||||||
return ((Field_timestamp*) field)->get_timestamp(&null_value);
|
return ((Field_timestamp*) field)->get_timestamp(&null_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6581,7 +6581,7 @@ copy_extra_record_fields(TABLE *table,
|
|||||||
/* Nothing to do */
|
/* Nothing to do */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FIELD_TYPE_BIT:
|
case MYSQL_TYPE_BIT:
|
||||||
Field_bit *f= static_cast<Field_bit*>(*field_ptr);
|
Field_bit *f= static_cast<Field_bit*>(*field_ptr);
|
||||||
my_ptrdiff_t const offset= table->record[1] - table->record[0];
|
my_ptrdiff_t const offset= table->record[1] - table->record[0];
|
||||||
uchar const bits=
|
uchar const bits=
|
||||||
|
@ -3132,7 +3132,7 @@ static bool fields_ok_for_partition_index(Field **pfield)
|
|||||||
for (; (*pfield); pfield++)
|
for (; (*pfield); pfield++)
|
||||||
{
|
{
|
||||||
enum_field_types ftype= (*pfield)->real_type();
|
enum_field_types ftype= (*pfield)->real_type();
|
||||||
if (ftype == FIELD_TYPE_ENUM || ftype == FIELD_TYPE_GEOMETRY)
|
if (ftype == MYSQL_TYPE_ENUM || ftype == MYSQL_TYPE_GEOMETRY)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -3231,7 +3231,7 @@ static bool create_partition_index_description(PART_PRUNE_PARAM *ppar)
|
|||||||
key_part->store_length= (*field)->pack_length();
|
key_part->store_length= (*field)->pack_length();
|
||||||
if ((*field)->real_maybe_null())
|
if ((*field)->real_maybe_null())
|
||||||
key_part->store_length+= HA_KEY_NULL_LENGTH;
|
key_part->store_length+= HA_KEY_NULL_LENGTH;
|
||||||
if ((*field)->type() == FIELD_TYPE_BLOB ||
|
if ((*field)->type() == MYSQL_TYPE_BLOB ||
|
||||||
(*field)->real_type() == MYSQL_TYPE_VARCHAR)
|
(*field)->real_type() == MYSQL_TYPE_VARCHAR)
|
||||||
key_part->store_length+= HA_KEY_BLOB_LENGTH;
|
key_part->store_length+= HA_KEY_BLOB_LENGTH;
|
||||||
|
|
||||||
@ -5589,8 +5589,8 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
|
|||||||
/* For comparison purposes allow invalid dates like 2000-01-32 */
|
/* For comparison purposes allow invalid dates like 2000-01-32 */
|
||||||
orig_sql_mode= field->table->in_use->variables.sql_mode;
|
orig_sql_mode= field->table->in_use->variables.sql_mode;
|
||||||
if (value->real_item()->type() == Item::STRING_ITEM &&
|
if (value->real_item()->type() == Item::STRING_ITEM &&
|
||||||
(field->type() == FIELD_TYPE_DATE ||
|
(field->type() == MYSQL_TYPE_DATE ||
|
||||||
field->type() == FIELD_TYPE_DATETIME))
|
field->type() == MYSQL_TYPE_DATETIME))
|
||||||
field->table->in_use->variables.sql_mode|= MODE_INVALID_DATES;
|
field->table->in_use->variables.sql_mode|= MODE_INVALID_DATES;
|
||||||
err= value->save_in_field_no_warnings(field, 1);
|
err= value->save_in_field_no_warnings(field, 1);
|
||||||
if (err > 0 && field->cmp_type() != value->result_type())
|
if (err > 0 && field->cmp_type() != value->result_type())
|
||||||
|
@ -48,7 +48,7 @@ enum
|
|||||||
{
|
{
|
||||||
MYSQL_PROC_FIELD_DB = 0,
|
MYSQL_PROC_FIELD_DB = 0,
|
||||||
MYSQL_PROC_FIELD_NAME,
|
MYSQL_PROC_FIELD_NAME,
|
||||||
MYSQL_PROC_FIELD_TYPE,
|
MYSQL_PROC_MYSQL_TYPE,
|
||||||
MYSQL_PROC_FIELD_SPECIFIC_NAME,
|
MYSQL_PROC_FIELD_SPECIFIC_NAME,
|
||||||
MYSQL_PROC_FIELD_LANGUAGE,
|
MYSQL_PROC_FIELD_LANGUAGE,
|
||||||
MYSQL_PROC_FIELD_ACCESS,
|
MYSQL_PROC_FIELD_ACCESS,
|
||||||
@ -541,7 +541,7 @@ db_create_routine(THD *thd, int type, sp_head *sp)
|
|||||||
store(sp->m_db.str, sp->m_db.length, system_charset_info);
|
store(sp->m_db.str, sp->m_db.length, system_charset_info);
|
||||||
table->field[MYSQL_PROC_FIELD_NAME]->
|
table->field[MYSQL_PROC_FIELD_NAME]->
|
||||||
store(sp->m_name.str, sp->m_name.length, system_charset_info);
|
store(sp->m_name.str, sp->m_name.length, system_charset_info);
|
||||||
table->field[MYSQL_PROC_FIELD_TYPE]->
|
table->field[MYSQL_PROC_MYSQL_TYPE]->
|
||||||
store((longlong)type, TRUE);
|
store((longlong)type, TRUE);
|
||||||
table->field[MYSQL_PROC_FIELD_SPECIFIC_NAME]->
|
table->field[MYSQL_PROC_FIELD_SPECIFIC_NAME]->
|
||||||
store(sp->m_name.str, sp->m_name.length, system_charset_info);
|
store(sp->m_name.str, sp->m_name.length, system_charset_info);
|
||||||
@ -743,7 +743,7 @@ print_field_values(THD *thd, TABLE *table,
|
|||||||
{
|
{
|
||||||
Protocol *protocol= thd->protocol;
|
Protocol *protocol= thd->protocol;
|
||||||
|
|
||||||
if (table->field[MYSQL_PROC_FIELD_TYPE]->val_int() == type)
|
if (table->field[MYSQL_PROC_MYSQL_TYPE]->val_int() == type)
|
||||||
{
|
{
|
||||||
String db_string;
|
String db_string;
|
||||||
String name_string;
|
String name_string;
|
||||||
|
@ -761,7 +761,7 @@ static ulong get_access(TABLE *form, uint fieldnr, uint *next_field)
|
|||||||
Field **pos;
|
Field **pos;
|
||||||
|
|
||||||
for (pos=form->field+fieldnr, bit=1;
|
for (pos=form->field+fieldnr, bit=1;
|
||||||
*pos && (*pos)->real_type() == FIELD_TYPE_ENUM &&
|
*pos && (*pos)->real_type() == MYSQL_TYPE_ENUM &&
|
||||||
((Field_enum*) (*pos))->typelib->count == 2 ;
|
((Field_enum*) (*pos))->typelib->count == 2 ;
|
||||||
pos++, fieldnr++, bit<<=1)
|
pos++, fieldnr++, bit<<=1)
|
||||||
{
|
{
|
||||||
@ -1969,7 +1969,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
|
|||||||
ulong priv;
|
ulong priv;
|
||||||
uint next_field;
|
uint next_field;
|
||||||
for (tmp_field= table->field+3, priv = SELECT_ACL;
|
for (tmp_field= table->field+3, priv = SELECT_ACL;
|
||||||
*tmp_field && (*tmp_field)->real_type() == FIELD_TYPE_ENUM &&
|
*tmp_field && (*tmp_field)->real_type() == MYSQL_TYPE_ENUM &&
|
||||||
((Field_enum*) (*tmp_field))->typelib->count == 2 ;
|
((Field_enum*) (*tmp_field))->typelib->count == 2 ;
|
||||||
tmp_field++, priv <<= 1)
|
tmp_field++, priv <<= 1)
|
||||||
{
|
{
|
||||||
|
@ -140,7 +140,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
|
|||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
// Check if fieldtype is ulonglong
|
// Check if fieldtype is ulonglong
|
||||||
if (item->type() == Item::FIELD_ITEM &&
|
if (item->type() == Item::FIELD_ITEM &&
|
||||||
((Item_field*) item)->field->type() == FIELD_TYPE_LONGLONG &&
|
((Item_field*) item)->field->type() == MYSQL_TYPE_LONGLONG &&
|
||||||
((Field_longlong*) ((Item_field*) item)->field)->unsigned_flag)
|
((Field_longlong*) ((Item_field*) item)->field)->unsigned_flag)
|
||||||
new_field= new field_ulonglong(item, pc);
|
new_field= new field_ulonglong(item, pc);
|
||||||
else
|
else
|
||||||
@ -755,26 +755,26 @@ bool analyse::end_of_records()
|
|||||||
{
|
{
|
||||||
switch (((Item_field*) (*f)->item)->field->real_type())
|
switch (((Item_field*) (*f)->item)->field->real_type())
|
||||||
{
|
{
|
||||||
case FIELD_TYPE_TIMESTAMP:
|
case MYSQL_TYPE_TIMESTAMP:
|
||||||
ans.append(STRING_WITH_LEN("TIMESTAMP"));
|
ans.append(STRING_WITH_LEN("TIMESTAMP"));
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_DATETIME:
|
case MYSQL_TYPE_DATETIME:
|
||||||
ans.append(STRING_WITH_LEN("DATETIME"));
|
ans.append(STRING_WITH_LEN("DATETIME"));
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_DATE:
|
case MYSQL_TYPE_DATE:
|
||||||
case FIELD_TYPE_NEWDATE:
|
case MYSQL_TYPE_NEWDATE:
|
||||||
ans.append(STRING_WITH_LEN("DATE"));
|
ans.append(STRING_WITH_LEN("DATE"));
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_SET:
|
case MYSQL_TYPE_SET:
|
||||||
ans.append(STRING_WITH_LEN("SET"));
|
ans.append(STRING_WITH_LEN("SET"));
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_YEAR:
|
case MYSQL_TYPE_YEAR:
|
||||||
ans.append(STRING_WITH_LEN("YEAR"));
|
ans.append(STRING_WITH_LEN("YEAR"));
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_TIME:
|
case MYSQL_TYPE_TIME:
|
||||||
ans.append(STRING_WITH_LEN("TIME"));
|
ans.append(STRING_WITH_LEN("TIME"));
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_DECIMAL:
|
case MYSQL_TYPE_DECIMAL:
|
||||||
ans.append(STRING_WITH_LEN("DECIMAL"));
|
ans.append(STRING_WITH_LEN("DECIMAL"));
|
||||||
// if item is FIELD_ITEM, it _must_be_ Field_num in this case
|
// if item is FIELD_ITEM, it _must_be_ Field_num in this case
|
||||||
if (((Field_num*) ((Item_field*) (*f)->item)->field)->zerofill)
|
if (((Field_num*) ((Item_field*) (*f)->item)->field)->zerofill)
|
||||||
|
@ -1292,7 +1292,7 @@ int check_that_all_fields_are_given_values(THD *thd, TABLE *entry,
|
|||||||
{
|
{
|
||||||
if (!bitmap_is_set(write_set, (*field)->field_index) &&
|
if (!bitmap_is_set(write_set, (*field)->field_index) &&
|
||||||
((*field)->flags & NO_DEFAULT_VALUE_FLAG) &&
|
((*field)->flags & NO_DEFAULT_VALUE_FLAG) &&
|
||||||
((*field)->real_type() != FIELD_TYPE_ENUM))
|
((*field)->real_type() != MYSQL_TYPE_ENUM))
|
||||||
{
|
{
|
||||||
bool view= FALSE;
|
bool view= FALSE;
|
||||||
if (table_list)
|
if (table_list)
|
||||||
|
@ -716,7 +716,7 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
|
|||||||
table->auto_increment_field_not_null= TRUE;
|
table->auto_increment_field_not_null= TRUE;
|
||||||
if (!field->maybe_null())
|
if (!field->maybe_null())
|
||||||
{
|
{
|
||||||
if (field->type() == FIELD_TYPE_TIMESTAMP)
|
if (field->type() == MYSQL_TYPE_TIMESTAMP)
|
||||||
((Field_timestamp*) field)->set_time();
|
((Field_timestamp*) field)->set_time();
|
||||||
else if (field != table->next_number_field)
|
else if (field != table->next_number_field)
|
||||||
field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
@ -6209,7 +6209,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
|
|||||||
*/
|
*/
|
||||||
if (default_value->type() == Item::FUNC_ITEM &&
|
if (default_value->type() == Item::FUNC_ITEM &&
|
||||||
!(((Item_func*)default_value)->functype() == Item_func::NOW_FUNC &&
|
!(((Item_func*)default_value)->functype() == Item_func::NOW_FUNC &&
|
||||||
type == FIELD_TYPE_TIMESTAMP))
|
type == MYSQL_TYPE_TIMESTAMP))
|
||||||
{
|
{
|
||||||
my_error(ER_INVALID_DEFAULT, MYF(0), field_name);
|
my_error(ER_INVALID_DEFAULT, MYF(0), field_name);
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
@ -6231,13 +6231,13 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (on_update_value && type != FIELD_TYPE_TIMESTAMP)
|
if (on_update_value && type != MYSQL_TYPE_TIMESTAMP)
|
||||||
{
|
{
|
||||||
my_error(ER_INVALID_ON_UPDATE, MYF(0), field_name);
|
my_error(ER_INVALID_ON_UPDATE, MYF(0), field_name);
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == FIELD_TYPE_TIMESTAMP && length)
|
if (type == MYSQL_TYPE_TIMESTAMP && length)
|
||||||
{
|
{
|
||||||
/* Display widths are no longer supported for TIMSTAMP as of MySQL 4.1.
|
/* Display widths are no longer supported for TIMSTAMP as of MySQL 4.1.
|
||||||
In other words, for declarations such as TIMESTAMP(2), TIMESTAMP(4),
|
In other words, for declarations such as TIMESTAMP(2), TIMESTAMP(4),
|
||||||
|
@ -8553,8 +8553,8 @@ remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value)
|
|||||||
thd->substitute_null_with_insert_id= FALSE;
|
thd->substitute_null_with_insert_id= FALSE;
|
||||||
}
|
}
|
||||||
/* fix to replace 'NULL' dates with '0' (shreeve@uci.edu) */
|
/* fix to replace 'NULL' dates with '0' (shreeve@uci.edu) */
|
||||||
else if (((field->type() == FIELD_TYPE_DATE) ||
|
else if (((field->type() == MYSQL_TYPE_DATE) ||
|
||||||
(field->type() == FIELD_TYPE_DATETIME)) &&
|
(field->type() == MYSQL_TYPE_DATETIME)) &&
|
||||||
(field->flags & NOT_NULL_FLAG) &&
|
(field->flags & NOT_NULL_FLAG) &&
|
||||||
!field->table->maybe_null)
|
!field->table->maybe_null)
|
||||||
{
|
{
|
||||||
@ -8929,7 +8929,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
|||||||
field->result_field= result;
|
field->result_field= result;
|
||||||
}
|
}
|
||||||
else if (table_cant_handle_bit_fields && field->field->type() ==
|
else if (table_cant_handle_bit_fields && field->field->type() ==
|
||||||
FIELD_TYPE_BIT)
|
MYSQL_TYPE_BIT)
|
||||||
{
|
{
|
||||||
*from_field= field->field;
|
*from_field= field->field;
|
||||||
result= create_tmp_field_from_item(thd, item, table, copy_func,
|
result= create_tmp_field_from_item(thd, item, table, copy_func,
|
||||||
@ -9246,7 +9246,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||||||
*blob_field++= fieldnr;
|
*blob_field++= fieldnr;
|
||||||
blob_count++;
|
blob_count++;
|
||||||
}
|
}
|
||||||
if (new_field->type() == FIELD_TYPE_BIT)
|
if (new_field->type() == MYSQL_TYPE_BIT)
|
||||||
total_uneven_bit_length+= new_field->field_length & 7;
|
total_uneven_bit_length+= new_field->field_length & 7;
|
||||||
*(reg_field++)= new_field;
|
*(reg_field++)= new_field;
|
||||||
if (new_field->real_type() == MYSQL_TYPE_STRING ||
|
if (new_field->real_type() == MYSQL_TYPE_STRING ||
|
||||||
@ -9308,7 +9308,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||||||
reclength+=new_field->pack_length();
|
reclength+=new_field->pack_length();
|
||||||
if (!(new_field->flags & NOT_NULL_FLAG))
|
if (!(new_field->flags & NOT_NULL_FLAG))
|
||||||
null_count++;
|
null_count++;
|
||||||
if (new_field->type() == FIELD_TYPE_BIT)
|
if (new_field->type() == MYSQL_TYPE_BIT)
|
||||||
total_uneven_bit_length+= new_field->field_length & 7;
|
total_uneven_bit_length+= new_field->field_length & 7;
|
||||||
if (new_field->flags & BLOB_FLAG)
|
if (new_field->flags & BLOB_FLAG)
|
||||||
{
|
{
|
||||||
@ -9453,7 +9453,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
field->move_field((char*) pos,(uchar*) 0,0);
|
field->move_field((char*) pos,(uchar*) 0,0);
|
||||||
if (field->type() == FIELD_TYPE_BIT)
|
if (field->type() == MYSQL_TYPE_BIT)
|
||||||
{
|
{
|
||||||
/* We have to reserve place for extra bits among null bits */
|
/* We have to reserve place for extra bits among null bits */
|
||||||
((Field_bit*) field)->set_bit_ptr(null_flags + null_count / 8,
|
((Field_bit*) field)->set_bit_ptr(null_flags + null_count / 8,
|
||||||
@ -11748,7 +11748,7 @@ static bool test_if_ref(Item_field *left_item,Item *right_item)
|
|||||||
if (field->binary() &&
|
if (field->binary() &&
|
||||||
field->real_type() != MYSQL_TYPE_STRING &&
|
field->real_type() != MYSQL_TYPE_STRING &&
|
||||||
field->real_type() != MYSQL_TYPE_VARCHAR &&
|
field->real_type() != MYSQL_TYPE_VARCHAR &&
|
||||||
(field->type() != FIELD_TYPE_FLOAT || field->decimals() == 0))
|
(field->type() != MYSQL_TYPE_FLOAT || field->decimals() == 0))
|
||||||
{
|
{
|
||||||
return !store_val_in_field(field, right_item, CHECK_FIELD_WARN);
|
return !store_val_in_field(field, right_item, CHECK_FIELD_WARN);
|
||||||
}
|
}
|
||||||
@ -13663,11 +13663,11 @@ calc_group_buffer(JOIN *join,ORDER *group)
|
|||||||
if (field)
|
if (field)
|
||||||
{
|
{
|
||||||
enum_field_types type;
|
enum_field_types type;
|
||||||
if ((type= field->type()) == FIELD_TYPE_BLOB)
|
if ((type= field->type()) == MYSQL_TYPE_BLOB)
|
||||||
key_length+=MAX_BLOB_WIDTH; // Can't be used as a key
|
key_length+=MAX_BLOB_WIDTH; // Can't be used as a key
|
||||||
else if (type == MYSQL_TYPE_VARCHAR || type == MYSQL_TYPE_VAR_STRING)
|
else if (type == MYSQL_TYPE_VARCHAR || type == MYSQL_TYPE_VAR_STRING)
|
||||||
key_length+= field->field_length + HA_KEY_BLOB_LENGTH;
|
key_length+= field->field_length + HA_KEY_BLOB_LENGTH;
|
||||||
else if (type == FIELD_TYPE_BIT)
|
else if (type == MYSQL_TYPE_BIT)
|
||||||
{
|
{
|
||||||
/* Bit is usually stored as a longlong key for group fields */
|
/* Bit is usually stored as a longlong key for group fields */
|
||||||
key_length+= 8; // Big enough
|
key_length+= 8; // Big enough
|
||||||
|
@ -502,7 +502,7 @@ public:
|
|||||||
store_key(THD *thd, Field *field_arg, char *ptr, char *null, uint length)
|
store_key(THD *thd, Field *field_arg, char *ptr, char *null, uint length)
|
||||||
:null_ptr(null), err(0), null_key(0)
|
:null_ptr(null), err(0), null_key(0)
|
||||||
{
|
{
|
||||||
if (field_arg->type() == FIELD_TYPE_BLOB)
|
if (field_arg->type() == MYSQL_TYPE_BLOB)
|
||||||
{
|
{
|
||||||
/* Key segments are always packed with a 2 byte length prefix */
|
/* Key segments are always packed with a 2 byte length prefix */
|
||||||
to_field= new Field_varstring(ptr, length, 2, (uchar*) null, 1,
|
to_field= new Field_varstring(ptr, length, 2, (uchar*) null, 1,
|
||||||
|
@ -1123,7 +1123,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
|
|||||||
|
|
||||||
if (flags & NOT_NULL_FLAG)
|
if (flags & NOT_NULL_FLAG)
|
||||||
packet->append(STRING_WITH_LEN(" NOT NULL"));
|
packet->append(STRING_WITH_LEN(" NOT NULL"));
|
||||||
else if (field->type() == FIELD_TYPE_TIMESTAMP)
|
else if (field->type() == MYSQL_TYPE_TIMESTAMP)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
TIMESTAMP field require explicit NULL flag, because unlike
|
TIMESTAMP field require explicit NULL flag, because unlike
|
||||||
@ -1139,7 +1139,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
|
|||||||
has_now_default= table->timestamp_field == field &&
|
has_now_default= table->timestamp_field == field &&
|
||||||
field->unireg_check != Field::TIMESTAMP_UN_FIELD;
|
field->unireg_check != Field::TIMESTAMP_UN_FIELD;
|
||||||
|
|
||||||
has_default= (field->type() != FIELD_TYPE_BLOB &&
|
has_default= (field->type() != MYSQL_TYPE_BLOB &&
|
||||||
!(field->flags & NO_DEFAULT_VALUE_FLAG) &&
|
!(field->flags & NO_DEFAULT_VALUE_FLAG) &&
|
||||||
field->unireg_check != Field::NEXT_NUMBER &&
|
field->unireg_check != Field::NEXT_NUMBER &&
|
||||||
!((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40))
|
!((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40))
|
||||||
@ -1632,7 +1632,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
|
|||||||
field_list.push_back(field=new Item_empty_string("db",NAME_LEN));
|
field_list.push_back(field=new Item_empty_string("db",NAME_LEN));
|
||||||
field->maybe_null=1;
|
field->maybe_null=1;
|
||||||
field_list.push_back(new Item_empty_string("Command",16));
|
field_list.push_back(new Item_empty_string("Command",16));
|
||||||
field_list.push_back(new Item_return_int("Time",7, FIELD_TYPE_LONG));
|
field_list.push_back(new Item_return_int("Time",7, MYSQL_TYPE_LONG));
|
||||||
field_list.push_back(field=new Item_empty_string("State",30));
|
field_list.push_back(field=new Item_empty_string("State",30));
|
||||||
field->maybe_null=1;
|
field->maybe_null=1;
|
||||||
field_list.push_back(field=new Item_empty_string("Info",max_query_length));
|
field_list.push_back(field=new Item_empty_string("Info",max_query_length));
|
||||||
@ -3106,7 +3106,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
|
|||||||
pos=(byte*) ((flags & NOT_NULL_FLAG) ? "NO" : "YES");
|
pos=(byte*) ((flags & NOT_NULL_FLAG) ? "NO" : "YES");
|
||||||
table->field[6]->store((const char*) pos,
|
table->field[6]->store((const char*) pos,
|
||||||
strlen((const char*) pos), cs);
|
strlen((const char*) pos), cs);
|
||||||
is_blob= (field->type() == FIELD_TYPE_BLOB);
|
is_blob= (field->type() == MYSQL_TYPE_BLOB);
|
||||||
if (field->has_charset() || is_blob ||
|
if (field->has_charset() || is_blob ||
|
||||||
field->real_type() == MYSQL_TYPE_VARCHAR || // For varbinary type
|
field->real_type() == MYSQL_TYPE_VARCHAR || // For varbinary type
|
||||||
field->real_type() == MYSQL_TYPE_STRING) // For binary type
|
field->real_type() == MYSQL_TYPE_STRING) // For binary type
|
||||||
@ -3130,25 +3130,25 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
|
|||||||
|
|
||||||
decimals= field->decimals();
|
decimals= field->decimals();
|
||||||
switch (field->type()) {
|
switch (field->type()) {
|
||||||
case FIELD_TYPE_NEWDECIMAL:
|
case MYSQL_TYPE_NEWDECIMAL:
|
||||||
field_length= ((Field_new_decimal*) field)->precision;
|
field_length= ((Field_new_decimal*) field)->precision;
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_DECIMAL:
|
case MYSQL_TYPE_DECIMAL:
|
||||||
field_length= field->field_length - (decimals ? 2 : 1);
|
field_length= field->field_length - (decimals ? 2 : 1);
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_TINY:
|
case MYSQL_TYPE_TINY:
|
||||||
case FIELD_TYPE_SHORT:
|
case MYSQL_TYPE_SHORT:
|
||||||
case FIELD_TYPE_LONG:
|
case MYSQL_TYPE_LONG:
|
||||||
case FIELD_TYPE_LONGLONG:
|
case MYSQL_TYPE_LONGLONG:
|
||||||
case FIELD_TYPE_INT24:
|
case MYSQL_TYPE_INT24:
|
||||||
field_length= field->max_length() - 1;
|
field_length= field->max_length() - 1;
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_BIT:
|
case MYSQL_TYPE_BIT:
|
||||||
field_length= field->max_length();
|
field_length= field->max_length();
|
||||||
decimals= -1; // return NULL
|
decimals= -1; // return NULL
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_FLOAT:
|
case MYSQL_TYPE_FLOAT:
|
||||||
case FIELD_TYPE_DOUBLE:
|
case MYSQL_TYPE_DOUBLE:
|
||||||
field_length= field->field_length;
|
field_length= field->field_length;
|
||||||
if (decimals == NOT_FIXED_DEC)
|
if (decimals == NOT_FIXED_DEC)
|
||||||
decimals= -1; // return NULL
|
decimals= -1; // return NULL
|
||||||
|
@ -2022,10 +2022,10 @@ int prepare_create_field(create_field *sql_field,
|
|||||||
DBUG_ASSERT(sql_field->charset);
|
DBUG_ASSERT(sql_field->charset);
|
||||||
|
|
||||||
switch (sql_field->sql_type) {
|
switch (sql_field->sql_type) {
|
||||||
case FIELD_TYPE_BLOB:
|
case MYSQL_TYPE_BLOB:
|
||||||
case FIELD_TYPE_MEDIUM_BLOB:
|
case MYSQL_TYPE_MEDIUM_BLOB:
|
||||||
case FIELD_TYPE_TINY_BLOB:
|
case MYSQL_TYPE_TINY_BLOB:
|
||||||
case FIELD_TYPE_LONG_BLOB:
|
case MYSQL_TYPE_LONG_BLOB:
|
||||||
sql_field->pack_flag=FIELDFLAG_BLOB |
|
sql_field->pack_flag=FIELDFLAG_BLOB |
|
||||||
pack_length_to_packflag(sql_field->pack_length -
|
pack_length_to_packflag(sql_field->pack_length -
|
||||||
portable_sizeof_char_ptr);
|
portable_sizeof_char_ptr);
|
||||||
@ -2035,7 +2035,7 @@ int prepare_create_field(create_field *sql_field,
|
|||||||
sql_field->unireg_check=Field::BLOB_FIELD;
|
sql_field->unireg_check=Field::BLOB_FIELD;
|
||||||
(*blob_columns)++;
|
(*blob_columns)++;
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_GEOMETRY:
|
case MYSQL_TYPE_GEOMETRY:
|
||||||
#ifdef HAVE_SPATIAL
|
#ifdef HAVE_SPATIAL
|
||||||
if (!(table_flags & HA_CAN_GEOMETRY))
|
if (!(table_flags & HA_CAN_GEOMETRY))
|
||||||
{
|
{
|
||||||
@ -2075,12 +2075,12 @@ int prepare_create_field(create_field *sql_field,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case FIELD_TYPE_STRING:
|
case MYSQL_TYPE_STRING:
|
||||||
sql_field->pack_flag=0;
|
sql_field->pack_flag=0;
|
||||||
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;
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_ENUM:
|
case MYSQL_TYPE_ENUM:
|
||||||
sql_field->pack_flag=pack_length_to_packflag(sql_field->pack_length) |
|
sql_field->pack_flag=pack_length_to_packflag(sql_field->pack_length) |
|
||||||
FIELDFLAG_INTERVAL;
|
FIELDFLAG_INTERVAL;
|
||||||
if (sql_field->charset->state & MY_CS_BINSORT)
|
if (sql_field->charset->state & MY_CS_BINSORT)
|
||||||
@ -2090,7 +2090,7 @@ int prepare_create_field(create_field *sql_field,
|
|||||||
sql_field->interval,
|
sql_field->interval,
|
||||||
sql_field->charset);
|
sql_field->charset);
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_SET:
|
case MYSQL_TYPE_SET:
|
||||||
sql_field->pack_flag=pack_length_to_packflag(sql_field->pack_length) |
|
sql_field->pack_flag=pack_length_to_packflag(sql_field->pack_length) |
|
||||||
FIELDFLAG_BITFIELD;
|
FIELDFLAG_BITFIELD;
|
||||||
if (sql_field->charset->state & MY_CS_BINSORT)
|
if (sql_field->charset->state & MY_CS_BINSORT)
|
||||||
@ -2100,19 +2100,19 @@ int prepare_create_field(create_field *sql_field,
|
|||||||
sql_field->interval,
|
sql_field->interval,
|
||||||
sql_field->charset);
|
sql_field->charset);
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_DATE: // Rest of string types
|
case MYSQL_TYPE_DATE: // Rest of string types
|
||||||
case FIELD_TYPE_NEWDATE:
|
case MYSQL_TYPE_NEWDATE:
|
||||||
case FIELD_TYPE_TIME:
|
case MYSQL_TYPE_TIME:
|
||||||
case FIELD_TYPE_DATETIME:
|
case MYSQL_TYPE_DATETIME:
|
||||||
case FIELD_TYPE_NULL:
|
case MYSQL_TYPE_NULL:
|
||||||
sql_field->pack_flag=f_settype((uint) sql_field->sql_type);
|
sql_field->pack_flag=f_settype((uint) sql_field->sql_type);
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_BIT:
|
case MYSQL_TYPE_BIT:
|
||||||
/*
|
/*
|
||||||
We have sql_field->pack_flag already set here, see mysql_prepare_table().
|
We have sql_field->pack_flag already set here, see mysql_prepare_table().
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_NEWDECIMAL:
|
case MYSQL_TYPE_NEWDECIMAL:
|
||||||
sql_field->pack_flag=(FIELDFLAG_NUMBER |
|
sql_field->pack_flag=(FIELDFLAG_NUMBER |
|
||||||
(sql_field->flags & UNSIGNED_FLAG ? 0 :
|
(sql_field->flags & UNSIGNED_FLAG ? 0 :
|
||||||
FIELDFLAG_DECIMAL) |
|
FIELDFLAG_DECIMAL) |
|
||||||
@ -2120,7 +2120,7 @@ int prepare_create_field(create_field *sql_field,
|
|||||||
FIELDFLAG_ZEROFILL : 0) |
|
FIELDFLAG_ZEROFILL : 0) |
|
||||||
(sql_field->decimals << FIELDFLAG_DEC_SHIFT));
|
(sql_field->decimals << FIELDFLAG_DEC_SHIFT));
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_TIMESTAMP:
|
case MYSQL_TYPE_TIMESTAMP:
|
||||||
/* We should replace old TIMESTAMP fields with their newer analogs */
|
/* We should replace old TIMESTAMP fields with their newer analogs */
|
||||||
if (sql_field->unireg_check == Field::TIMESTAMP_OLD_FIELD)
|
if (sql_field->unireg_check == Field::TIMESTAMP_OLD_FIELD)
|
||||||
{
|
{
|
||||||
@ -2245,10 +2245,10 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
*/
|
*/
|
||||||
if (sql_field->def &&
|
if (sql_field->def &&
|
||||||
save_cs != sql_field->def->collation.collation &&
|
save_cs != sql_field->def->collation.collation &&
|
||||||
(sql_field->sql_type == FIELD_TYPE_VAR_STRING ||
|
(sql_field->sql_type == MYSQL_TYPE_VAR_STRING ||
|
||||||
sql_field->sql_type == FIELD_TYPE_STRING ||
|
sql_field->sql_type == MYSQL_TYPE_STRING ||
|
||||||
sql_field->sql_type == FIELD_TYPE_SET ||
|
sql_field->sql_type == MYSQL_TYPE_SET ||
|
||||||
sql_field->sql_type == FIELD_TYPE_ENUM))
|
sql_field->sql_type == MYSQL_TYPE_ENUM))
|
||||||
{
|
{
|
||||||
Query_arena backup_arena;
|
Query_arena backup_arena;
|
||||||
bool need_to_change_arena= !thd->stmt_arena->is_conventional();
|
bool need_to_change_arena= !thd->stmt_arena->is_conventional();
|
||||||
@ -2273,8 +2273,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sql_field->sql_type == FIELD_TYPE_SET ||
|
if (sql_field->sql_type == MYSQL_TYPE_SET ||
|
||||||
sql_field->sql_type == FIELD_TYPE_ENUM)
|
sql_field->sql_type == MYSQL_TYPE_ENUM)
|
||||||
{
|
{
|
||||||
uint32 dummy;
|
uint32 dummy;
|
||||||
CHARSET_INFO *cs= sql_field->charset;
|
CHARSET_INFO *cs= sql_field->charset;
|
||||||
@ -2320,7 +2320,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
interval->type_lengths[i]);
|
interval->type_lengths[i]);
|
||||||
interval->type_lengths[i]= lengthsp;
|
interval->type_lengths[i]= lengthsp;
|
||||||
((uchar *)interval->type_names[i])[lengthsp]= '\0';
|
((uchar *)interval->type_names[i])[lengthsp]= '\0';
|
||||||
if (sql_field->sql_type == FIELD_TYPE_SET)
|
if (sql_field->sql_type == MYSQL_TYPE_SET)
|
||||||
{
|
{
|
||||||
if (cs->coll->instr(cs, interval->type_names[i],
|
if (cs->coll->instr(cs, interval->type_names[i],
|
||||||
interval->type_lengths[i],
|
interval->type_lengths[i],
|
||||||
@ -2334,7 +2334,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
sql_field->interval_list.empty(); // Don't need interval_list anymore
|
sql_field->interval_list.empty(); // Don't need interval_list anymore
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sql_field->sql_type == FIELD_TYPE_SET)
|
if (sql_field->sql_type == MYSQL_TYPE_SET)
|
||||||
{
|
{
|
||||||
uint32 field_length;
|
uint32 field_length;
|
||||||
if (sql_field->def != NULL)
|
if (sql_field->def != NULL)
|
||||||
@ -2370,10 +2370,10 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
calculate_interval_lengths(cs, interval, &dummy, &field_length);
|
calculate_interval_lengths(cs, interval, &dummy, &field_length);
|
||||||
sql_field->length= field_length + (interval->count - 1);
|
sql_field->length= field_length + (interval->count - 1);
|
||||||
}
|
}
|
||||||
else /* FIELD_TYPE_ENUM */
|
else /* MYSQL_TYPE_ENUM */
|
||||||
{
|
{
|
||||||
uint32 field_length;
|
uint32 field_length;
|
||||||
DBUG_ASSERT(sql_field->sql_type == FIELD_TYPE_ENUM);
|
DBUG_ASSERT(sql_field->sql_type == MYSQL_TYPE_ENUM);
|
||||||
if (sql_field->def != NULL)
|
if (sql_field->def != NULL)
|
||||||
{
|
{
|
||||||
String str, *def= sql_field->def->val_str(&str);
|
String str, *def= sql_field->def->val_str(&str);
|
||||||
@ -2403,7 +2403,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
set_if_smaller(sql_field->length, MAX_FIELD_WIDTH-1);
|
set_if_smaller(sql_field->length, MAX_FIELD_WIDTH-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sql_field->sql_type == FIELD_TYPE_BIT)
|
if (sql_field->sql_type == MYSQL_TYPE_BIT)
|
||||||
{
|
{
|
||||||
sql_field->pack_flag= FIELDFLAG_NUMBER;
|
sql_field->pack_flag= FIELDFLAG_NUMBER;
|
||||||
if (file->ha_table_flags() & HA_CAN_BIT_FIELD)
|
if (file->ha_table_flags() & HA_CAN_BIT_FIELD)
|
||||||
@ -3059,7 +3059,7 @@ static bool prepare_blob_field(THD *thd, create_field *sql_field)
|
|||||||
MAX_FIELD_VARCHARLENGTH / sql_field->charset->mbmaxlen);
|
MAX_FIELD_VARCHARLENGTH / sql_field->charset->mbmaxlen);
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
sql_field->sql_type= FIELD_TYPE_BLOB;
|
sql_field->sql_type= MYSQL_TYPE_BLOB;
|
||||||
sql_field->flags|= BLOB_FLAG;
|
sql_field->flags|= BLOB_FLAG;
|
||||||
sprintf(warn_buff, ER(ER_AUTO_CONVERT), sql_field->field_name,
|
sprintf(warn_buff, ER(ER_AUTO_CONVERT), sql_field->field_name,
|
||||||
(sql_field->charset == &my_charset_bin) ? "VARBINARY" : "VARCHAR",
|
(sql_field->charset == &my_charset_bin) ? "VARBINARY" : "VARCHAR",
|
||||||
@ -3070,7 +3070,7 @@ static bool prepare_blob_field(THD *thd, create_field *sql_field)
|
|||||||
|
|
||||||
if ((sql_field->flags & BLOB_FLAG) && sql_field->length)
|
if ((sql_field->flags & BLOB_FLAG) && sql_field->length)
|
||||||
{
|
{
|
||||||
if (sql_field->sql_type == FIELD_TYPE_BLOB)
|
if (sql_field->sql_type == MYSQL_TYPE_BLOB)
|
||||||
{
|
{
|
||||||
/* The user has given a length to the blob column */
|
/* The user has given a length to the blob column */
|
||||||
sql_field->sql_type= get_blob_type_from_length(sql_field->length);
|
sql_field->sql_type= get_blob_type_from_length(sql_field->length);
|
||||||
@ -3098,11 +3098,11 @@ static bool prepare_blob_field(THD *thd, create_field *sql_field)
|
|||||||
|
|
||||||
void sp_prepare_create_field(THD *thd, create_field *sql_field)
|
void sp_prepare_create_field(THD *thd, create_field *sql_field)
|
||||||
{
|
{
|
||||||
if (sql_field->sql_type == FIELD_TYPE_SET ||
|
if (sql_field->sql_type == MYSQL_TYPE_SET ||
|
||||||
sql_field->sql_type == FIELD_TYPE_ENUM)
|
sql_field->sql_type == MYSQL_TYPE_ENUM)
|
||||||
{
|
{
|
||||||
uint32 field_length, dummy;
|
uint32 field_length, dummy;
|
||||||
if (sql_field->sql_type == FIELD_TYPE_SET)
|
if (sql_field->sql_type == MYSQL_TYPE_SET)
|
||||||
{
|
{
|
||||||
calculate_interval_lengths(sql_field->charset,
|
calculate_interval_lengths(sql_field->charset,
|
||||||
sql_field->interval, &dummy,
|
sql_field->interval, &dummy,
|
||||||
@ -3110,7 +3110,7 @@ void sp_prepare_create_field(THD *thd, create_field *sql_field)
|
|||||||
sql_field->length= field_length +
|
sql_field->length= field_length +
|
||||||
(sql_field->interval->count - 1);
|
(sql_field->interval->count - 1);
|
||||||
}
|
}
|
||||||
else /* FIELD_TYPE_ENUM */
|
else /* MYSQL_TYPE_ENUM */
|
||||||
{
|
{
|
||||||
calculate_interval_lengths(sql_field->charset,
|
calculate_interval_lengths(sql_field->charset,
|
||||||
sql_field->interval,
|
sql_field->interval,
|
||||||
@ -3120,7 +3120,7 @@ void sp_prepare_create_field(THD *thd, create_field *sql_field)
|
|||||||
set_if_smaller(sql_field->length, MAX_FIELD_WIDTH-1);
|
set_if_smaller(sql_field->length, MAX_FIELD_WIDTH-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sql_field->sql_type == FIELD_TYPE_BIT)
|
if (sql_field->sql_type == MYSQL_TYPE_BIT)
|
||||||
{
|
{
|
||||||
sql_field->pack_flag= FIELDFLAG_NUMBER |
|
sql_field->pack_flag= FIELDFLAG_NUMBER |
|
||||||
FIELDFLAG_TREAT_BIT_AS_CHAR;
|
FIELDFLAG_TREAT_BIT_AS_CHAR;
|
||||||
@ -5600,7 +5600,7 @@ view_err:
|
|||||||
}
|
}
|
||||||
if (alter)
|
if (alter)
|
||||||
{
|
{
|
||||||
if (def->sql_type == FIELD_TYPE_BLOB)
|
if (def->sql_type == MYSQL_TYPE_BLOB)
|
||||||
{
|
{
|
||||||
my_error(ER_BLOB_CANT_HAVE_DEFAULT, MYF(0), def->change);
|
my_error(ER_BLOB_CANT_HAVE_DEFAULT, MYF(0), def->change);
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
@ -6828,7 +6828,7 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables,
|
|||||||
for (uint i= 0; i < t->s->fields; i++ )
|
for (uint i= 0; i < t->s->fields; i++ )
|
||||||
{
|
{
|
||||||
Field *f= t->field[i];
|
Field *f= t->field[i];
|
||||||
if ((f->type() == FIELD_TYPE_BLOB) ||
|
if ((f->type() == MYSQL_TYPE_BLOB) ||
|
||||||
(f->type() == MYSQL_TYPE_VARCHAR))
|
(f->type() == MYSQL_TYPE_VARCHAR))
|
||||||
{
|
{
|
||||||
String tmp;
|
String tmp;
|
||||||
|
@ -1632,7 +1632,7 @@ create_function_tail:
|
|||||||
When collation support in SP is implemented, then this test
|
When collation support in SP is implemented, then this test
|
||||||
should be removed.
|
should be removed.
|
||||||
*/
|
*/
|
||||||
if (($8 == FIELD_TYPE_STRING || $8 == MYSQL_TYPE_VARCHAR)
|
if (($8 == MYSQL_TYPE_STRING || $8 == MYSQL_TYPE_VARCHAR)
|
||||||
&& (lex->type & BINCMP_FLAG))
|
&& (lex->type & BINCMP_FLAG))
|
||||||
{
|
{
|
||||||
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "return value collation");
|
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "return value collation");
|
||||||
@ -4148,31 +4148,31 @@ field_spec:
|
|||||||
type:
|
type:
|
||||||
int_type opt_len field_options { $$=$1; }
|
int_type opt_len field_options { $$=$1; }
|
||||||
| real_type opt_precision field_options { $$=$1; }
|
| real_type opt_precision field_options { $$=$1; }
|
||||||
| FLOAT_SYM float_options field_options { $$=FIELD_TYPE_FLOAT; }
|
| FLOAT_SYM float_options field_options { $$=MYSQL_TYPE_FLOAT; }
|
||||||
| BIT_SYM { Lex->length= (char*) "1";
|
| BIT_SYM { Lex->length= (char*) "1";
|
||||||
$$=FIELD_TYPE_BIT; }
|
$$=MYSQL_TYPE_BIT; }
|
||||||
| BIT_SYM '(' NUM ')' { Lex->length= $3.str;
|
| BIT_SYM '(' NUM ')' { Lex->length= $3.str;
|
||||||
$$=FIELD_TYPE_BIT; }
|
$$=MYSQL_TYPE_BIT; }
|
||||||
| BOOL_SYM { Lex->length=(char*) "1";
|
| BOOL_SYM { Lex->length=(char*) "1";
|
||||||
$$=FIELD_TYPE_TINY; }
|
$$=MYSQL_TYPE_TINY; }
|
||||||
| BOOLEAN_SYM { Lex->length=(char*) "1";
|
| BOOLEAN_SYM { Lex->length=(char*) "1";
|
||||||
$$=FIELD_TYPE_TINY; }
|
$$=MYSQL_TYPE_TINY; }
|
||||||
| char '(' NUM ')' opt_binary { Lex->length=$3.str;
|
| char '(' NUM ')' opt_binary { Lex->length=$3.str;
|
||||||
$$=FIELD_TYPE_STRING; }
|
$$=MYSQL_TYPE_STRING; }
|
||||||
| char opt_binary { Lex->length=(char*) "1";
|
| char opt_binary { Lex->length=(char*) "1";
|
||||||
$$=FIELD_TYPE_STRING; }
|
$$=MYSQL_TYPE_STRING; }
|
||||||
| nchar '(' NUM ')' opt_bin_mod { Lex->length=$3.str;
|
| nchar '(' NUM ')' opt_bin_mod { Lex->length=$3.str;
|
||||||
$$=FIELD_TYPE_STRING;
|
$$=MYSQL_TYPE_STRING;
|
||||||
Lex->charset=national_charset_info; }
|
Lex->charset=national_charset_info; }
|
||||||
| nchar opt_bin_mod { Lex->length=(char*) "1";
|
| nchar opt_bin_mod { Lex->length=(char*) "1";
|
||||||
$$=FIELD_TYPE_STRING;
|
$$=MYSQL_TYPE_STRING;
|
||||||
Lex->charset=national_charset_info; }
|
Lex->charset=national_charset_info; }
|
||||||
| BINARY '(' NUM ')' { Lex->length=$3.str;
|
| BINARY '(' NUM ')' { Lex->length=$3.str;
|
||||||
Lex->charset=&my_charset_bin;
|
Lex->charset=&my_charset_bin;
|
||||||
$$=FIELD_TYPE_STRING; }
|
$$=MYSQL_TYPE_STRING; }
|
||||||
| BINARY { Lex->length= (char*) "1";
|
| BINARY { Lex->length= (char*) "1";
|
||||||
Lex->charset=&my_charset_bin;
|
Lex->charset=&my_charset_bin;
|
||||||
$$=FIELD_TYPE_STRING; }
|
$$=MYSQL_TYPE_STRING; }
|
||||||
| varchar '(' NUM ')' opt_binary { Lex->length=$3.str;
|
| varchar '(' NUM ')' opt_binary { Lex->length=$3.str;
|
||||||
$$= MYSQL_TYPE_VARCHAR; }
|
$$= MYSQL_TYPE_VARCHAR; }
|
||||||
| nvarchar '(' NUM ')' opt_bin_mod { Lex->length=$3.str;
|
| nvarchar '(' NUM ')' opt_bin_mod { Lex->length=$3.str;
|
||||||
@ -4181,33 +4181,33 @@ type:
|
|||||||
| VARBINARY '(' NUM ')' { Lex->length=$3.str;
|
| VARBINARY '(' NUM ')' { Lex->length=$3.str;
|
||||||
Lex->charset=&my_charset_bin;
|
Lex->charset=&my_charset_bin;
|
||||||
$$= MYSQL_TYPE_VARCHAR; }
|
$$= MYSQL_TYPE_VARCHAR; }
|
||||||
| YEAR_SYM opt_len field_options { $$=FIELD_TYPE_YEAR; }
|
| YEAR_SYM opt_len field_options { $$=MYSQL_TYPE_YEAR; }
|
||||||
| DATE_SYM { $$=FIELD_TYPE_DATE; }
|
| DATE_SYM { $$=MYSQL_TYPE_DATE; }
|
||||||
| TIME_SYM { $$=FIELD_TYPE_TIME; }
|
| TIME_SYM { $$=MYSQL_TYPE_TIME; }
|
||||||
| TIMESTAMP opt_len
|
| TIMESTAMP opt_len
|
||||||
{
|
{
|
||||||
if (YYTHD->variables.sql_mode & MODE_MAXDB)
|
if (YYTHD->variables.sql_mode & MODE_MAXDB)
|
||||||
$$=FIELD_TYPE_DATETIME;
|
$$=MYSQL_TYPE_DATETIME;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Unlike other types TIMESTAMP fields are NOT NULL by default.
|
Unlike other types TIMESTAMP fields are NOT NULL by default.
|
||||||
*/
|
*/
|
||||||
Lex->type|= NOT_NULL_FLAG;
|
Lex->type|= NOT_NULL_FLAG;
|
||||||
$$=FIELD_TYPE_TIMESTAMP;
|
$$=MYSQL_TYPE_TIMESTAMP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| DATETIME { $$=FIELD_TYPE_DATETIME; }
|
| DATETIME { $$=MYSQL_TYPE_DATETIME; }
|
||||||
| TINYBLOB { Lex->charset=&my_charset_bin;
|
| TINYBLOB { Lex->charset=&my_charset_bin;
|
||||||
$$=FIELD_TYPE_TINY_BLOB; }
|
$$=MYSQL_TYPE_TINY_BLOB; }
|
||||||
| BLOB_SYM opt_len { Lex->charset=&my_charset_bin;
|
| BLOB_SYM opt_len { Lex->charset=&my_charset_bin;
|
||||||
$$=FIELD_TYPE_BLOB; }
|
$$=MYSQL_TYPE_BLOB; }
|
||||||
| spatial_type
|
| spatial_type
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SPATIAL
|
#ifdef HAVE_SPATIAL
|
||||||
Lex->charset=&my_charset_bin;
|
Lex->charset=&my_charset_bin;
|
||||||
Lex->uint_geom_type= (uint)$1;
|
Lex->uint_geom_type= (uint)$1;
|
||||||
$$=FIELD_TYPE_GEOMETRY;
|
$$=MYSQL_TYPE_GEOMETRY;
|
||||||
#else
|
#else
|
||||||
my_error(ER_FEATURE_DISABLED, MYF(0),
|
my_error(ER_FEATURE_DISABLED, MYF(0),
|
||||||
sym_group_geom.name, sym_group_geom.needed_define);
|
sym_group_geom.name, sym_group_geom.needed_define);
|
||||||
@ -4215,30 +4215,30 @@ type:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
| MEDIUMBLOB { Lex->charset=&my_charset_bin;
|
| MEDIUMBLOB { Lex->charset=&my_charset_bin;
|
||||||
$$=FIELD_TYPE_MEDIUM_BLOB; }
|
$$=MYSQL_TYPE_MEDIUM_BLOB; }
|
||||||
| LONGBLOB { Lex->charset=&my_charset_bin;
|
| LONGBLOB { Lex->charset=&my_charset_bin;
|
||||||
$$=FIELD_TYPE_LONG_BLOB; }
|
$$=MYSQL_TYPE_LONG_BLOB; }
|
||||||
| LONG_SYM VARBINARY { Lex->charset=&my_charset_bin;
|
| LONG_SYM VARBINARY { Lex->charset=&my_charset_bin;
|
||||||
$$=FIELD_TYPE_MEDIUM_BLOB; }
|
$$=MYSQL_TYPE_MEDIUM_BLOB; }
|
||||||
| LONG_SYM varchar opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; }
|
| LONG_SYM varchar opt_binary { $$=MYSQL_TYPE_MEDIUM_BLOB; }
|
||||||
| TINYTEXT opt_binary { $$=FIELD_TYPE_TINY_BLOB; }
|
| TINYTEXT opt_binary { $$=MYSQL_TYPE_TINY_BLOB; }
|
||||||
| TEXT_SYM opt_len opt_binary { $$=FIELD_TYPE_BLOB; }
|
| TEXT_SYM opt_len opt_binary { $$=MYSQL_TYPE_BLOB; }
|
||||||
| MEDIUMTEXT opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; }
|
| MEDIUMTEXT opt_binary { $$=MYSQL_TYPE_MEDIUM_BLOB; }
|
||||||
| LONGTEXT opt_binary { $$=FIELD_TYPE_LONG_BLOB; }
|
| LONGTEXT opt_binary { $$=MYSQL_TYPE_LONG_BLOB; }
|
||||||
| DECIMAL_SYM float_options field_options
|
| DECIMAL_SYM float_options field_options
|
||||||
{ $$=FIELD_TYPE_NEWDECIMAL;}
|
{ $$=MYSQL_TYPE_NEWDECIMAL;}
|
||||||
| NUMERIC_SYM float_options field_options
|
| NUMERIC_SYM float_options field_options
|
||||||
{ $$=FIELD_TYPE_NEWDECIMAL;}
|
{ $$=MYSQL_TYPE_NEWDECIMAL;}
|
||||||
| FIXED_SYM float_options field_options
|
| FIXED_SYM float_options field_options
|
||||||
{ $$=FIELD_TYPE_NEWDECIMAL;}
|
{ $$=MYSQL_TYPE_NEWDECIMAL;}
|
||||||
| ENUM {Lex->interval_list.empty();} '(' string_list ')' opt_binary
|
| ENUM {Lex->interval_list.empty();} '(' string_list ')' opt_binary
|
||||||
{ $$=FIELD_TYPE_ENUM; }
|
{ $$=MYSQL_TYPE_ENUM; }
|
||||||
| SET { Lex->interval_list.empty();} '(' string_list ')' opt_binary
|
| SET { Lex->interval_list.empty();} '(' string_list ')' opt_binary
|
||||||
{ $$=FIELD_TYPE_SET; }
|
{ $$=MYSQL_TYPE_SET; }
|
||||||
| LONG_SYM opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; }
|
| LONG_SYM opt_binary { $$=MYSQL_TYPE_MEDIUM_BLOB; }
|
||||||
| SERIAL_SYM
|
| SERIAL_SYM
|
||||||
{
|
{
|
||||||
$$=FIELD_TYPE_LONGLONG;
|
$$=MYSQL_TYPE_LONGLONG;
|
||||||
Lex->type|= (AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNSIGNED_FLAG |
|
Lex->type|= (AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNSIGNED_FLAG |
|
||||||
UNIQUE_FLAG);
|
UNIQUE_FLAG);
|
||||||
}
|
}
|
||||||
@ -4280,17 +4280,17 @@ nvarchar:
|
|||||||
;
|
;
|
||||||
|
|
||||||
int_type:
|
int_type:
|
||||||
INT_SYM { $$=FIELD_TYPE_LONG; }
|
INT_SYM { $$=MYSQL_TYPE_LONG; }
|
||||||
| TINYINT { $$=FIELD_TYPE_TINY; }
|
| TINYINT { $$=MYSQL_TYPE_TINY; }
|
||||||
| SMALLINT { $$=FIELD_TYPE_SHORT; }
|
| SMALLINT { $$=MYSQL_TYPE_SHORT; }
|
||||||
| MEDIUMINT { $$=FIELD_TYPE_INT24; }
|
| MEDIUMINT { $$=MYSQL_TYPE_INT24; }
|
||||||
| BIGINT { $$=FIELD_TYPE_LONGLONG; };
|
| BIGINT { $$=MYSQL_TYPE_LONGLONG; };
|
||||||
|
|
||||||
real_type:
|
real_type:
|
||||||
REAL { $$= YYTHD->variables.sql_mode & MODE_REAL_AS_FLOAT ?
|
REAL { $$= YYTHD->variables.sql_mode & MODE_REAL_AS_FLOAT ?
|
||||||
FIELD_TYPE_FLOAT : FIELD_TYPE_DOUBLE; }
|
MYSQL_TYPE_FLOAT : MYSQL_TYPE_DOUBLE; }
|
||||||
| DOUBLE_SYM { $$=FIELD_TYPE_DOUBLE; }
|
| DOUBLE_SYM { $$=MYSQL_TYPE_DOUBLE; }
|
||||||
| DOUBLE_SYM PRECISION { $$=FIELD_TYPE_DOUBLE; };
|
| DOUBLE_SYM PRECISION { $$=MYSQL_TYPE_DOUBLE; };
|
||||||
|
|
||||||
|
|
||||||
float_options:
|
float_options:
|
||||||
|
12
sql/table.cc
12
sql/table.cc
@ -877,7 +877,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
|
|||||||
field_type=(enum_field_types) (uint) strpos[13];
|
field_type=(enum_field_types) (uint) strpos[13];
|
||||||
|
|
||||||
/* charset and geometry_type share the same byte in frm */
|
/* charset and geometry_type share the same byte in frm */
|
||||||
if (field_type == FIELD_TYPE_GEOMETRY)
|
if (field_type == MYSQL_TYPE_GEOMETRY)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_SPATIAL
|
#ifdef HAVE_SPATIAL
|
||||||
geom_type= (Field::geometry_type) strpos[14];
|
geom_type= (Field::geometry_type) strpos[14];
|
||||||
@ -952,7 +952,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TO_BE_DELETED_ON_PRODUCTION
|
#ifndef TO_BE_DELETED_ON_PRODUCTION
|
||||||
if (field_type == FIELD_TYPE_NEWDECIMAL && !share->mysql_version)
|
if (field_type == MYSQL_TYPE_NEWDECIMAL && !share->mysql_version)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Fix pack length of old decimal values from 5.0.3 -> 5.0.4
|
Fix pack length of old decimal values from 5.0.3 -> 5.0.4
|
||||||
@ -999,7 +999,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
|
|||||||
|
|
||||||
reg_field->field_index= i;
|
reg_field->field_index= i;
|
||||||
reg_field->comment=comment;
|
reg_field->comment=comment;
|
||||||
if (field_type == FIELD_TYPE_BIT && !f_bit_as_char(pack_flag))
|
if (field_type == MYSQL_TYPE_BIT && !f_bit_as_char(pack_flag))
|
||||||
{
|
{
|
||||||
if ((null_bit_pos+= field_length & 7) > 7)
|
if ((null_bit_pos+= field_length & 7) > 7)
|
||||||
{
|
{
|
||||||
@ -1088,10 +1088,10 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
|
|||||||
keyinfo->extra_length+= HA_KEY_NULL_LENGTH;
|
keyinfo->extra_length+= HA_KEY_NULL_LENGTH;
|
||||||
keyinfo->key_length+= HA_KEY_NULL_LENGTH;
|
keyinfo->key_length+= HA_KEY_NULL_LENGTH;
|
||||||
}
|
}
|
||||||
if (field->type() == FIELD_TYPE_BLOB ||
|
if (field->type() == MYSQL_TYPE_BLOB ||
|
||||||
field->real_type() == MYSQL_TYPE_VARCHAR)
|
field->real_type() == MYSQL_TYPE_VARCHAR)
|
||||||
{
|
{
|
||||||
if (field->type() == FIELD_TYPE_BLOB)
|
if (field->type() == MYSQL_TYPE_BLOB)
|
||||||
key_part->key_part_flag|= HA_BLOB_PART;
|
key_part->key_part_flag|= HA_BLOB_PART;
|
||||||
else
|
else
|
||||||
key_part->key_part_flag|= HA_VAR_LENGTH_PART;
|
key_part->key_part_flag|= HA_VAR_LENGTH_PART;
|
||||||
@ -1143,7 +1143,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
|
|||||||
if (field->key_length() != key_part->length)
|
if (field->key_length() != key_part->length)
|
||||||
{
|
{
|
||||||
#ifndef TO_BE_DELETED_ON_PRODUCTION
|
#ifndef TO_BE_DELETED_ON_PRODUCTION
|
||||||
if (field->type() == FIELD_TYPE_NEWDECIMAL)
|
if (field->type() == MYSQL_TYPE_NEWDECIMAL)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Fix a fatal error in decimal key handling that causes crashes
|
Fix a fatal error in decimal key handling that causes crashes
|
||||||
|
@ -584,7 +584,7 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
|
|||||||
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.
|
||||||
*/
|
*/
|
||||||
if (field->sql_type == FIELD_TYPE_TIMESTAMP &&
|
if (field->sql_type == MYSQL_TYPE_TIMESTAMP &&
|
||||||
MTYP_TYPENR(field->unireg_check) != Field::NONE &&
|
MTYP_TYPENR(field->unireg_check) != Field::NONE &&
|
||||||
!time_stamp_pos)
|
!time_stamp_pos)
|
||||||
time_stamp_pos= (uint) field->offset+ (uint) data_offset + 1;
|
time_stamp_pos= (uint) field->offset+ (uint) data_offset + 1;
|
||||||
@ -743,7 +743,7 @@ static bool pack_fields(File file, List<create_field> &create_fields,
|
|||||||
int2store(buff+10,field->unireg_check);
|
int2store(buff+10,field->unireg_check);
|
||||||
buff[12]= (uchar) field->interval_id;
|
buff[12]= (uchar) field->interval_id;
|
||||||
buff[13]= (uchar) field->sql_type;
|
buff[13]= (uchar) field->sql_type;
|
||||||
if (field->sql_type == FIELD_TYPE_GEOMETRY)
|
if (field->sql_type == MYSQL_TYPE_GEOMETRY)
|
||||||
{
|
{
|
||||||
buff[14]= (uchar) field->geom_type;
|
buff[14]= (uchar) field->geom_type;
|
||||||
#ifndef HAVE_SPATIAL
|
#ifndef HAVE_SPATIAL
|
||||||
@ -906,13 +906,13 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type,
|
|||||||
null_count++;
|
null_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field->sql_type == FIELD_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);
|
type= (Field::utype) MTYP_TYPENR(field->unireg_check);
|
||||||
|
|
||||||
if (field->def &&
|
if (field->def &&
|
||||||
(regfield->real_type() != FIELD_TYPE_YEAR ||
|
(regfield->real_type() != MYSQL_TYPE_YEAR ||
|
||||||
field->def->val_int() != 0))
|
field->def->val_int() != 0))
|
||||||
{
|
{
|
||||||
if (field->def->save_in_field(regfield, 1))
|
if (field->def->save_in_field(regfield, 1))
|
||||||
@ -923,7 +923,7 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (regfield->real_type() == FIELD_TYPE_ENUM &&
|
else if (regfield->real_type() == MYSQL_TYPE_ENUM &&
|
||||||
(field->flags & NOT_NULL_FLAG))
|
(field->flags & NOT_NULL_FLAG))
|
||||||
{
|
{
|
||||||
regfield->set_notnull();
|
regfield->set_notnull();
|
||||||
|
@ -2591,10 +2591,10 @@ innobase_mysql_cmp(
|
|||||||
case MYSQL_TYPE_BIT:
|
case MYSQL_TYPE_BIT:
|
||||||
case MYSQL_TYPE_STRING:
|
case MYSQL_TYPE_STRING:
|
||||||
case MYSQL_TYPE_VAR_STRING:
|
case MYSQL_TYPE_VAR_STRING:
|
||||||
case FIELD_TYPE_TINY_BLOB:
|
case MYSQL_TYPE_TINY_BLOB:
|
||||||
case FIELD_TYPE_MEDIUM_BLOB:
|
case MYSQL_TYPE_MEDIUM_BLOB:
|
||||||
case FIELD_TYPE_BLOB:
|
case MYSQL_TYPE_BLOB:
|
||||||
case FIELD_TYPE_LONG_BLOB:
|
case MYSQL_TYPE_LONG_BLOB:
|
||||||
case MYSQL_TYPE_VARCHAR:
|
case MYSQL_TYPE_VARCHAR:
|
||||||
/* Use the charset number to pick the right charset struct for
|
/* Use the charset number to pick the right charset struct for
|
||||||
the comparison. Since the MySQL function get_charset may be
|
the comparison. Since the MySQL function get_charset may be
|
||||||
@ -2658,11 +2658,11 @@ get_innobase_type_from_mysql_type(
|
|||||||
8 bits: this is used in ibuf and also when DATA_NOT_NULL is ORed to
|
8 bits: this is used in ibuf and also when DATA_NOT_NULL is ORed to
|
||||||
the type */
|
the type */
|
||||||
|
|
||||||
DBUG_ASSERT((ulint)FIELD_TYPE_STRING < 256);
|
DBUG_ASSERT((ulint)MYSQL_TYPE_STRING < 256);
|
||||||
DBUG_ASSERT((ulint)FIELD_TYPE_VAR_STRING < 256);
|
DBUG_ASSERT((ulint)MYSQL_TYPE_VAR_STRING < 256);
|
||||||
DBUG_ASSERT((ulint)FIELD_TYPE_DOUBLE < 256);
|
DBUG_ASSERT((ulint)MYSQL_TYPE_DOUBLE < 256);
|
||||||
DBUG_ASSERT((ulint)FIELD_TYPE_FLOAT < 256);
|
DBUG_ASSERT((ulint)MYSQL_TYPE_FLOAT < 256);
|
||||||
DBUG_ASSERT((ulint)FIELD_TYPE_DECIMAL < 256);
|
DBUG_ASSERT((ulint)MYSQL_TYPE_DECIMAL < 256);
|
||||||
|
|
||||||
if (field->flags & UNSIGNED_FLAG) {
|
if (field->flags & UNSIGNED_FLAG) {
|
||||||
|
|
||||||
@ -2671,8 +2671,8 @@ get_innobase_type_from_mysql_type(
|
|||||||
*unsigned_flag = 0;
|
*unsigned_flag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field->real_type() == FIELD_TYPE_ENUM
|
if (field->real_type() == MYSQL_TYPE_ENUM
|
||||||
|| field->real_type() == FIELD_TYPE_SET) {
|
|| field->real_type() == MYSQL_TYPE_SET) {
|
||||||
|
|
||||||
/* MySQL has field->type() a string type for these, but the
|
/* MySQL has field->type() a string type for these, but the
|
||||||
data is actually internally stored as an unsigned integer
|
data is actually internally stored as an unsigned integer
|
||||||
@ -2710,31 +2710,31 @@ get_innobase_type_from_mysql_type(
|
|||||||
} else {
|
} else {
|
||||||
return(DATA_MYSQL);
|
return(DATA_MYSQL);
|
||||||
}
|
}
|
||||||
case FIELD_TYPE_NEWDECIMAL:
|
case MYSQL_TYPE_NEWDECIMAL:
|
||||||
return(DATA_FIXBINARY);
|
return(DATA_FIXBINARY);
|
||||||
case FIELD_TYPE_LONG:
|
case MYSQL_TYPE_LONG:
|
||||||
case FIELD_TYPE_LONGLONG:
|
case MYSQL_TYPE_LONGLONG:
|
||||||
case FIELD_TYPE_TINY:
|
case MYSQL_TYPE_TINY:
|
||||||
case FIELD_TYPE_SHORT:
|
case MYSQL_TYPE_SHORT:
|
||||||
case FIELD_TYPE_INT24:
|
case MYSQL_TYPE_INT24:
|
||||||
case FIELD_TYPE_DATE:
|
case MYSQL_TYPE_DATE:
|
||||||
case FIELD_TYPE_DATETIME:
|
case MYSQL_TYPE_DATETIME:
|
||||||
case FIELD_TYPE_YEAR:
|
case MYSQL_TYPE_YEAR:
|
||||||
case FIELD_TYPE_NEWDATE:
|
case MYSQL_TYPE_NEWDATE:
|
||||||
case FIELD_TYPE_TIME:
|
case MYSQL_TYPE_TIME:
|
||||||
case FIELD_TYPE_TIMESTAMP:
|
case MYSQL_TYPE_TIMESTAMP:
|
||||||
return(DATA_INT);
|
return(DATA_INT);
|
||||||
case FIELD_TYPE_FLOAT:
|
case MYSQL_TYPE_FLOAT:
|
||||||
return(DATA_FLOAT);
|
return(DATA_FLOAT);
|
||||||
case FIELD_TYPE_DOUBLE:
|
case MYSQL_TYPE_DOUBLE:
|
||||||
return(DATA_DOUBLE);
|
return(DATA_DOUBLE);
|
||||||
case FIELD_TYPE_DECIMAL:
|
case MYSQL_TYPE_DECIMAL:
|
||||||
return(DATA_DECIMAL);
|
return(DATA_DECIMAL);
|
||||||
case FIELD_TYPE_GEOMETRY:
|
case MYSQL_TYPE_GEOMETRY:
|
||||||
case FIELD_TYPE_TINY_BLOB:
|
case MYSQL_TYPE_TINY_BLOB:
|
||||||
case FIELD_TYPE_MEDIUM_BLOB:
|
case MYSQL_TYPE_MEDIUM_BLOB:
|
||||||
case FIELD_TYPE_BLOB:
|
case MYSQL_TYPE_BLOB:
|
||||||
case FIELD_TYPE_LONG_BLOB:
|
case MYSQL_TYPE_LONG_BLOB:
|
||||||
return(DATA_BLOB);
|
return(DATA_BLOB);
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
@ -2902,10 +2902,10 @@ ha_innobase::store_key_val_for_row(
|
|||||||
|
|
||||||
buff += key_len;
|
buff += key_len;
|
||||||
|
|
||||||
} else if (mysql_type == FIELD_TYPE_TINY_BLOB
|
} else if (mysql_type == MYSQL_TYPE_TINY_BLOB
|
||||||
|| mysql_type == FIELD_TYPE_MEDIUM_BLOB
|
|| mysql_type == MYSQL_TYPE_MEDIUM_BLOB
|
||||||
|| mysql_type == FIELD_TYPE_BLOB
|
|| mysql_type == MYSQL_TYPE_BLOB
|
||||||
|| mysql_type == FIELD_TYPE_LONG_BLOB) {
|
|| mysql_type == MYSQL_TYPE_LONG_BLOB) {
|
||||||
|
|
||||||
CHARSET_INFO* cs;
|
CHARSET_INFO* cs;
|
||||||
ulint key_len;
|
ulint key_len;
|
||||||
@ -2999,8 +2999,8 @@ ha_innobase::store_key_val_for_row(
|
|||||||
type is not enum or set. For these fields check
|
type is not enum or set. For these fields check
|
||||||
if character set is multi byte. */
|
if character set is multi byte. */
|
||||||
|
|
||||||
if (real_type != FIELD_TYPE_ENUM
|
if (real_type != MYSQL_TYPE_ENUM
|
||||||
&& real_type != FIELD_TYPE_SET
|
&& real_type != MYSQL_TYPE_SET
|
||||||
&& ( mysql_type == MYSQL_TYPE_VAR_STRING
|
&& ( mysql_type == MYSQL_TYPE_VAR_STRING
|
||||||
|| mysql_type == MYSQL_TYPE_STRING)) {
|
|| mysql_type == MYSQL_TYPE_STRING)) {
|
||||||
|
|
||||||
@ -7219,10 +7219,10 @@ ha_innobase::cmp_ref(
|
|||||||
field = key_part->field;
|
field = key_part->field;
|
||||||
mysql_type = field->type();
|
mysql_type = field->type();
|
||||||
|
|
||||||
if (mysql_type == FIELD_TYPE_TINY_BLOB
|
if (mysql_type == MYSQL_TYPE_TINY_BLOB
|
||||||
|| mysql_type == FIELD_TYPE_MEDIUM_BLOB
|
|| mysql_type == MYSQL_TYPE_MEDIUM_BLOB
|
||||||
|| mysql_type == FIELD_TYPE_BLOB
|
|| mysql_type == MYSQL_TYPE_BLOB
|
||||||
|| mysql_type == FIELD_TYPE_LONG_BLOB) {
|
|| mysql_type == MYSQL_TYPE_LONG_BLOB) {
|
||||||
|
|
||||||
/* In the MySQL key value format, a column prefix of
|
/* In the MySQL key value format, a column prefix of
|
||||||
a BLOB is preceded by a 2-byte length field */
|
a BLOB is preceded by a 2-byte length field */
|
||||||
|
@ -1540,15 +1540,15 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
|
|||||||
keydef[i].seg[j].null_bit=0;
|
keydef[i].seg[j].null_bit=0;
|
||||||
keydef[i].seg[j].null_pos=0;
|
keydef[i].seg[j].null_pos=0;
|
||||||
}
|
}
|
||||||
if (field->type() == FIELD_TYPE_BLOB ||
|
if (field->type() == MYSQL_TYPE_BLOB ||
|
||||||
field->type() == FIELD_TYPE_GEOMETRY)
|
field->type() == MYSQL_TYPE_GEOMETRY)
|
||||||
{
|
{
|
||||||
keydef[i].seg[j].flag|=HA_BLOB_PART;
|
keydef[i].seg[j].flag|=HA_BLOB_PART;
|
||||||
/* save number of bytes used to pack length */
|
/* save number of bytes used to pack length */
|
||||||
keydef[i].seg[j].bit_start= (uint) (field->pack_length() -
|
keydef[i].seg[j].bit_start= (uint) (field->pack_length() -
|
||||||
share->blob_ptr_size);
|
share->blob_ptr_size);
|
||||||
}
|
}
|
||||||
else if (field->type() == FIELD_TYPE_BIT)
|
else if (field->type() == MYSQL_TYPE_BIT)
|
||||||
{
|
{
|
||||||
keydef[i].seg[j].bit_length= ((Field_bit *) field)->bit_len;
|
keydef[i].seg[j].bit_length= ((Field_bit *) field)->bit_len;
|
||||||
keydef[i].seg[j].bit_start= ((Field_bit *) field)->bit_ofs;
|
keydef[i].seg[j].bit_start= ((Field_bit *) field)->bit_ofs;
|
||||||
|
@ -11001,7 +11001,7 @@ static void test_view()
|
|||||||
|
|
||||||
strmov(str_data, "TEST");
|
strmov(str_data, "TEST");
|
||||||
bzero((char*) bind, sizeof(bind));
|
bzero((char*) bind, sizeof(bind));
|
||||||
bind[0].buffer_type= FIELD_TYPE_STRING;
|
bind[0].buffer_type= MYSQL_TYPE_STRING;
|
||||||
bind[0].buffer= (char *)&str_data;
|
bind[0].buffer= (char *)&str_data;
|
||||||
bind[0].buffer_length= 50;
|
bind[0].buffer_length= 50;
|
||||||
bind[0].length= &length;
|
bind[0].length= &length;
|
||||||
@ -11239,7 +11239,7 @@ static void test_view_insert()
|
|||||||
check_execute(select_stmt, rc);
|
check_execute(select_stmt, rc);
|
||||||
|
|
||||||
bzero((char*) bind, sizeof(bind));
|
bzero((char*) bind, sizeof(bind));
|
||||||
bind[0].buffer_type = FIELD_TYPE_LONG;
|
bind[0].buffer_type = MYSQL_TYPE_LONG;
|
||||||
bind[0].buffer = (char *)&my_val;
|
bind[0].buffer = (char *)&my_val;
|
||||||
bind[0].length = &my_length;
|
bind[0].length = &my_length;
|
||||||
bind[0].is_null = (char*)&my_null;
|
bind[0].is_null = (char*)&my_null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user