35
35
uint types, char **names);
36
36
static uint find_field(Field **fields, uchar *record, uint start, uint length);
38
/**************************************************************************
39
Object_creation_ctx implementation.
40
**************************************************************************/
42
Object_creation_ctx *Object_creation_ctx::set_n_backup(THD *thd)
44
Object_creation_ctx *backup_ctx;
46
backup_ctx= create_backup_ctx(thd);
52
void Object_creation_ctx::restore_env(THD *thd, Object_creation_ctx *backup_ctx)
57
backup_ctx->change_env(thd);
62
/**************************************************************************
63
Default_object_creation_ctx implementation.
64
**************************************************************************/
66
Default_object_creation_ctx::Default_object_creation_ctx(THD *thd)
67
: m_client_cs(thd->variables.character_set_client),
68
m_connection_cl(thd->variables.collation_connection)
71
Default_object_creation_ctx::Default_object_creation_ctx(
72
const CHARSET_INFO * const client_cs, const CHARSET_INFO * const connection_cl)
73
: m_client_cs(client_cs),
74
m_connection_cl(connection_cl)
78
Default_object_creation_ctx::create_backup_ctx(THD *thd) const
80
return new Default_object_creation_ctx(thd);
83
void Default_object_creation_ctx::change_env(THD *thd) const
85
thd->variables.character_set_client= m_client_cs;
86
thd->variables.collation_connection= m_connection_cl;
88
thd->update_charset();
91
38
/*************************************************************************/
93
40
/* Get column name from column hash */
968
915
TYPELIB *interval= share->intervals + interval_nr - 1;
969
916
unhex_type2(interval);
972
#ifndef TO_BE_DELETED_ON_PRODUCTION
973
if (field_type == DRIZZLE_TYPE_NEWDECIMAL && !share->mysql_version)
976
Fix pack length of old decimal values from 5.0.3 -> 5.0.4
977
The difference is that in the old version we stored precision
978
in the .frm table while we now store the display_length
980
uint decimals= f_decimals(pack_flag);
981
field_length= my_decimal_precision_to_length(field_length,
983
f_is_dec(pack_flag) == 0);
984
sql_print_error(_("Found incompatible DECIMAL field '%s' in %s; "
985
"Please do \"ALTER TABLE '%s' FORCE\" to fix it!"),
986
share->fieldnames.type_names[i], share->table_name.str,
987
share->table_name.str);
988
push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
990
_("Found incompatible DECIMAL field '%s' in %s; "
991
"Please do \"ALTER TABLE '%s' FORCE\" to fix it!"),
992
share->fieldnames.type_names[i],
993
share->table_name.str,
994
share->table_name.str);
995
share->crashed= 1; // Marker for CHECK TABLE
999
919
*field_ptr= reg_field=
1000
920
make_field(share, record+recpos,
1146
1066
if (field->key_length() != key_part->length)
1148
#ifndef TO_BE_DELETED_ON_PRODUCTION
1149
if (field->type() == DRIZZLE_TYPE_NEWDECIMAL)
1152
Fix a fatal error in decimal key handling that causes crashes
1153
on Innodb. We fix it by reducing the key length so that
1154
InnoDB never gets a too big key when searching.
1155
This allows the end user to do an ALTER TABLE to fix the
1158
keyinfo->key_length-= (key_part->length - field->key_length());
1159
key_part->store_length-= (uint16_t)(key_part->length -
1160
field->key_length());
1161
key_part->length= (uint16_t)field->key_length();
1162
sql_print_error(_("Found wrong key definition in %s; "
1163
"Please do \"ALTER TABLE '%s' FORCE \" to fix it!"),
1164
share->table_name.str,
1165
share->table_name.str);
1166
push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
1167
ER_CRASHED_ON_USAGE,
1168
_("Found wrong key definition in %s; "
1169
"Please do \"ALTER TABLE '%s' FORCE\" to fix "
1171
share->table_name.str,
1172
share->table_name.str);
1173
share->crashed= 1; // Marker for CHECK TABLE
1177
1068
key_part->key_part_flag|= HA_PART_KEY_SEG;