~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table.cc

  • Committer: Brian Aker
  • Date: 2008-08-12 19:47:25 UTC
  • Revision ID: brian@tangent.org-20080812194725-2dwdtjvppne1bunq
yet another fix for stdint....

Show diffs side-by-side

added added

removed removed

Lines of Context:
915
915
      TYPELIB *interval= share->intervals + interval_nr - 1;
916
916
      unhex_type2(interval);
917
917
    }
918
 
    
919
 
#ifndef TO_BE_DELETED_ON_PRODUCTION
920
 
    if (field_type == DRIZZLE_TYPE_NEWDECIMAL && !share->mysql_version)
921
 
    {
922
 
      /*
923
 
        Fix pack length of old decimal values from 5.0.3 -> 5.0.4
924
 
        The difference is that in the old version we stored precision
925
 
        in the .frm table while we now store the display_length
926
 
      */
927
 
      uint decimals= f_decimals(pack_flag);
928
 
      field_length= my_decimal_precision_to_length(field_length,
929
 
                                                   decimals,
930
 
                                                   f_is_dec(pack_flag) == 0);
931
 
      sql_print_error(_("Found incompatible DECIMAL field '%s' in %s; "
932
 
                      "Please do \"ALTER TABLE '%s' FORCE\" to fix it!"),
933
 
                      share->fieldnames.type_names[i], share->table_name.str,
934
 
                      share->table_name.str);
935
 
      push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
936
 
                          ER_CRASHED_ON_USAGE,
937
 
                          _("Found incompatible DECIMAL field '%s' in %s; "
938
 
                          "Please do \"ALTER TABLE '%s' FORCE\" to fix it!"),
939
 
                          share->fieldnames.type_names[i],
940
 
                          share->table_name.str,
941
 
                          share->table_name.str);
942
 
      share->crashed= 1;                        // Marker for CHECK TABLE
943
 
    }
944
 
#endif
945
918
 
946
919
    *field_ptr= reg_field=
947
920
      make_field(share, record+recpos,
1092
1065
        }
1093
1066
        if (field->key_length() != key_part->length)
1094
1067
        {
1095
 
#ifndef TO_BE_DELETED_ON_PRODUCTION
1096
 
          if (field->type() == DRIZZLE_TYPE_NEWDECIMAL)
1097
 
          {
1098
 
            /*
1099
 
              Fix a fatal error in decimal key handling that causes crashes
1100
 
              on Innodb. We fix it by reducing the key length so that
1101
 
              InnoDB never gets a too big key when searching.
1102
 
              This allows the end user to do an ALTER TABLE to fix the
1103
 
              error.
1104
 
            */
1105
 
            keyinfo->key_length-= (key_part->length - field->key_length());
1106
 
            key_part->store_length-= (uint16_t)(key_part->length -
1107
 
                                              field->key_length());
1108
 
            key_part->length= (uint16_t)field->key_length();
1109
 
            sql_print_error(_("Found wrong key definition in %s; "
1110
 
                            "Please do \"ALTER TABLE '%s' FORCE \" to fix it!"),
1111
 
                            share->table_name.str,
1112
 
                            share->table_name.str);
1113
 
            push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
1114
 
                                ER_CRASHED_ON_USAGE,
1115
 
                                _("Found wrong key definition in %s; "
1116
 
                                "Please do \"ALTER TABLE '%s' FORCE\" to fix "
1117
 
                                "it!"),
1118
 
                                share->table_name.str,
1119
 
                                share->table_name.str);
1120
 
            share->crashed= 1;                // Marker for CHECK TABLE
1121
 
            continue;
1122
 
          }
1123
 
#endif
1124
1068
          key_part->key_part_flag|= HA_PART_KEY_SEG;
1125
1069
        }
1126
1070
      }