~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_table.cc

  • Committer: Brian Aker
  • Date: 2011-01-07 21:56:29 UTC
  • mto: This revision was merged to the branch mainline in revision 2064.
  • Revision ID: brian@tangent.org-20110107215629-zopacn4wh1mbstum
Remove need for committed type for microtime in proto.

Show diffs side-by-side

added added

removed removed

Lines of Context:
544
544
  KeyInfo               *key_info;
545
545
  KeyPartInfo *key_part_info;
546
546
  int           timestamps= 0, timestamps_with_niladic= 0;
547
 
  int           field_no,dup_no;
 
547
  int           dup_no;
548
548
  int           select_field_pos,auto_increment=0;
549
549
  List_iterator<CreateField> it(alter_info->create_list);
550
550
  List_iterator<CreateField> it2(alter_info->create_list);
556
556
  null_fields=blob_columns=0;
557
557
  max_key_length= engine->max_key_length();
558
558
 
559
 
  for (field_no=0; (sql_field=it++) ; field_no++)
 
559
  for (int32_t field_no=0; (sql_field=it++) ; field_no++)
560
560
  {
561
561
    const CHARSET_INFO *save_cs;
562
562
 
566
566
      executing a prepared statement for the second time.
567
567
    */
568
568
    sql_field->length= sql_field->char_length;
 
569
 
569
570
    if (!sql_field->charset)
570
571
      sql_field->charset= create_info->default_table_charset;
 
572
 
571
573
    /*
572
574
      table_charset is set in ALTER Table if we want change character set
573
575
      for all varchar/char columns.
765
767
    if (not create_proto.engine().name().compare("MyISAM") &&
766
768
        ((sql_field->flags & BLOB_FLAG) ||
767
769
         (sql_field->sql_type == DRIZZLE_TYPE_VARCHAR)))
 
770
    {
768
771
      (*db_options)|= HA_OPTION_PACK_RECORD;
 
772
    }
 
773
 
769
774
    it2.rewind();
770
775
  }
771
776
 
989
994
             my_strcasecmp(system_charset_info,
990
995
                           column->field_name.str,
991
996
                           sql_field->field_name))
 
997
      {
992
998
        field++;
 
999
      }
 
1000
 
993
1001
      if (!sql_field)
994
1002
      {
995
1003
        my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), column->field_name.str);
996
1004
        return(true);
997
1005
      }
 
1006
 
998
1007
      while ((dup_column= cols2++) != column)
999
1008
      {
1000
1009
        if (!my_strcasecmp(system_charset_info,
1027
1036
            return true;
1028
1037
          }
1029
1038
        }
 
1039
 
1030
1040
        if (! (sql_field->flags & NOT_NULL_FLAG))
1031
1041
        {
1032
1042
          if (key->type == Key::PRIMARY)
1053
1063
            }
1054
1064
          }
1055
1065
        }
 
1066
 
1056
1067
        if (MTYP_TYPENR(sql_field->unireg_check) == Field::NEXT_NUMBER)
1057
1068
        {
1058
1069
          if (column_nr == 0 || (engine->check_flag(HTON_BIT_AUTO_PART_KEY)))
1177
1188
        key_info->name=(char*) key_name;
1178
1189
      }
1179
1190
    }
 
1191
 
1180
1192
    if (!key_info->name || check_column_name(key_info->name))
1181
1193
    {
1182
1194
      my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key_info->name);
1183
1195
      return(true);
1184
1196
    }
 
1197
 
1185
1198
    if (!(key_info->flags & HA_NULL_PART_KEY))
 
1199
    {
1186
1200
      unique_key=1;
 
1201
    }
 
1202
 
1187
1203
    key_info->key_length=(uint16_t) key_length;
 
1204
 
1188
1205
    if (key_length > max_key_length)
1189
1206
    {
1190
1207
      my_error(ER_TOO_LONG_KEY,MYF(0),max_key_length);
1191
1208
      return(true);
1192
1209
    }
 
1210
 
1193
1211
    key_info++;
1194
1212
  }
 
1213
 
1195
1214
  if (!unique_key && !primary_key &&
1196
1215
      (engine->check_flag(HTON_BIT_REQUIRE_PRIMARY_KEY)))
1197
1216
  {
1198
1217
    my_message(ER_REQUIRES_PRIMARY_KEY, ER(ER_REQUIRES_PRIMARY_KEY), MYF(0));
1199
1218
    return(true);
1200
1219
  }
 
1220
 
1201
1221
  if (auto_increment > 0)
1202
1222
  {
1203
1223
    my_message(ER_WRONG_AUTO_KEY, ER(ER_WRONG_AUTO_KEY), MYF(0));