Commit c9459f0d authored by marko's avatar marko

Merge changes from MySQL AB:

Rename some FIELD_TYPE_ constants to MYSQL_TYPE_.

Change the scope of a type cast of two dividends.
parent eb967c21
...@@ -2573,10 +2573,10 @@ innobase_mysql_cmp( ...@@ -2573,10 +2573,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
...@@ -2640,11 +2640,11 @@ get_innobase_type_from_mysql_type( ...@@ -2640,11 +2640,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) {
...@@ -2653,8 +2653,8 @@ get_innobase_type_from_mysql_type( ...@@ -2653,8 +2653,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
...@@ -2692,31 +2692,31 @@ get_innobase_type_from_mysql_type( ...@@ -2692,31 +2692,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);
...@@ -2884,10 +2884,10 @@ ha_innobase::store_key_val_for_row( ...@@ -2884,10 +2884,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;
...@@ -2981,8 +2981,8 @@ ha_innobase::store_key_val_for_row( ...@@ -2981,8 +2981,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)) {
...@@ -5876,6 +5876,9 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list) ...@@ -5876,6 +5876,9 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
uint i; uint i;
FOREIGN_KEY_INFO f_key_info; FOREIGN_KEY_INFO f_key_info;
LEX_STRING *name= 0; LEX_STRING *name= 0;
uint ulen;
char uname[NAME_LEN*3+1]; /* Unencoded name */
char db_name[NAME_LEN*3+1];
const char *tmp_buff; const char *tmp_buff;
tmp_buff= foreign->id; tmp_buff= foreign->id;
...@@ -5886,14 +5889,23 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list) ...@@ -5886,14 +5889,23 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
f_key_info.forein_id= make_lex_string(thd, 0, tmp_buff, f_key_info.forein_id= make_lex_string(thd, 0, tmp_buff,
(uint) strlen(tmp_buff), 1); (uint) strlen(tmp_buff), 1);
tmp_buff= foreign->referenced_table_name; tmp_buff= foreign->referenced_table_name;
/* Database name */
i= 0; i= 0;
while (tmp_buff[i] != '/') while (tmp_buff[i] != '/')
{
db_name[i]= tmp_buff[i];
i++; i++;
f_key_info.referenced_db= make_lex_string(thd, 0, }
tmp_buff, i, 1); db_name[i]= 0;
ulen= filename_to_tablename(db_name, uname, sizeof(uname));
f_key_info.referenced_db= make_lex_string(thd, 0, uname, ulen, 1);
/* Table name */
tmp_buff+= i + 1; tmp_buff+= i + 1;
f_key_info.referenced_table= make_lex_string(thd, 0, tmp_buff, ulen= filename_to_tablename(tmp_buff, uname, sizeof(uname));
(uint) strlen(tmp_buff), 1); f_key_info.referenced_table= make_lex_string(thd, 0, uname,
ulen, 1);
for (i= 0;;) { for (i= 0;;) {
tmp_buff= foreign->foreign_col_names[i]; tmp_buff= foreign->foreign_col_names[i];
...@@ -5955,8 +5967,14 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list) ...@@ -5955,8 +5967,14 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
} }
f_key_info.update_method= make_lex_string(thd, f_key_info.update_method, f_key_info.update_method= make_lex_string(thd, f_key_info.update_method,
tmp_buff, length, 1); tmp_buff, length, 1);
if (foreign->referenced_index &&
foreign->referenced_index->name)
{
f_key_info.referenced_key_name=
make_lex_string(thd, f_key_info.referenced_key_name,
foreign->referenced_index->name,
strlen(foreign->referenced_index->name), 1);
}
FOREIGN_KEY_INFO *pf_key_info= ((FOREIGN_KEY_INFO *) FOREIGN_KEY_INFO *pf_key_info= ((FOREIGN_KEY_INFO *)
thd->memdup((gptr) &f_key_info, thd->memdup((gptr) &f_key_info,
...@@ -6571,7 +6589,7 @@ innodb_mutex_show_status( ...@@ -6571,7 +6589,7 @@ innodb_mutex_show_status(
mutex->count_spin_rounds, mutex->count_spin_rounds,
mutex->count_os_wait, mutex->count_os_wait,
mutex->count_os_yield, mutex->count_os_yield,
(ulong) mutex->lspent_time/1000); (ulong) (mutex->lspent_time/1000));
if (stat_print(thd, innobase_hton_name, if (stat_print(thd, innobase_hton_name,
hton_name_len, buf1, buf1len, hton_name_len, buf1, buf1len,
...@@ -6616,7 +6634,7 @@ innodb_mutex_show_status( ...@@ -6616,7 +6634,7 @@ innodb_mutex_show_status(
rw_lock_count, rw_lock_count_spin_loop, rw_lock_count, rw_lock_count_spin_loop,
rw_lock_count_spin_rounds, rw_lock_count_spin_rounds,
rw_lock_count_os_wait, rw_lock_count_os_yield, rw_lock_count_os_wait, rw_lock_count_os_yield,
(ulong) rw_lock_wait_time/1000); (ulong) (rw_lock_wait_time/1000));
if (stat_print(thd, innobase_hton_name, hton_name_len, if (stat_print(thd, innobase_hton_name, hton_name_len,
STRING_WITH_LEN("rw_lock_mutexes"), buf2, buf2len)) { STRING_WITH_LEN("rw_lock_mutexes"), buf2, buf2len)) {
...@@ -7168,10 +7186,10 @@ ha_innobase::cmp_ref( ...@@ -7168,10 +7186,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 */
......
...@@ -1733,7 +1733,7 @@ os_file_set_size( ...@@ -1733,7 +1733,7 @@ os_file_set_size(
} }
/* Print about progress for each 100 MB written */ /* Print about progress for each 100 MB written */
if ((current_size + n_bytes) / (ib_longlong)(100 * 1024 * 1024) if ((ib_longlong) (current_size + n_bytes) / (ib_longlong)(100 * 1024 * 1024)
!= current_size / (ib_longlong)(100 * 1024 * 1024)) { != current_size / (ib_longlong)(100 * 1024 * 1024)) {
fprintf(stderr, " %lu00", fprintf(stderr, " %lu00",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment