~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_table.cc

  • Committer: Brian Aker
  • Date: 2010-05-15 01:19:45 UTC
  • Revision ID: brian@gaz-20100515011945-uxhf94vi0tzm0vq6
Rename of KEY to KeyInfo

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
 
57
57
extern pid_t current_pid;
58
58
 
59
 
bool is_primary_key(KEY *key_info)
 
59
bool is_primary_key(KeyInfo *key_info)
60
60
{
61
61
  static const char * primary_key_name="PRIMARY";
62
62
  return (strcmp(key_info->name, primary_key_name)==0);
71
71
    return NULL;
72
72
}
73
73
 
74
 
static bool check_if_keyname_exists(const char *name,KEY *start, KEY *end);
75
 
static char *make_unique_key_name(const char *field_name,KEY *start,KEY *end);
 
74
static bool check_if_keyname_exists(const char *name,KeyInfo *start, KeyInfo *end);
 
75
static char *make_unique_key_name(const char *field_name,KeyInfo *start,KeyInfo *end);
76
76
 
77
77
static bool prepare_blob_field(Session *session, CreateField *sql_field);
78
78
 
343
343
  PRIMARY keys are prioritized.
344
344
*/
345
345
 
346
 
static int sort_keys(KEY *a, KEY *b)
 
346
static int sort_keys(KeyInfo *a, KeyInfo *b)
347
347
{
348
348
  ulong a_flags= a->flags, b_flags= b->flags;
349
349
 
543
543
                                      AlterInfo *alter_info,
544
544
                                      bool tmp_table,
545
545
                                      uint32_t *db_options,
546
 
                                      KEY **key_info_buffer,
 
546
                                      KeyInfo **key_info_buffer,
547
547
                                      uint32_t *key_count,
548
548
                                      int select_field_count)
549
549
{
551
551
  CreateField   *sql_field,*dup_field;
552
552
  uint          field,null_fields,blob_columns,max_key_length;
553
553
  ulong         record_offset= 0;
554
 
  KEY           *key_info;
 
554
  KeyInfo               *key_info;
555
555
  KeyPartInfo *key_part_info;
556
556
  int           timestamps= 0, timestamps_with_niladic= 0;
557
557
  int           field_no,dup_no;
910
910
    return(true);
911
911
  }
912
912
 
913
 
  (*key_info_buffer)= key_info= (KEY*) memory::sql_calloc(sizeof(KEY) * (*key_count));
 
913
  (*key_info_buffer)= key_info= (KeyInfo*) memory::sql_calloc(sizeof(KeyInfo) * (*key_count));
914
914
  key_part_info=(KeyPartInfo*) memory::sql_calloc(sizeof(KeyPartInfo)*key_parts);
915
915
  if (!*key_info_buffer || ! key_part_info)
916
916
    return(true);                               // Out of memory
1202
1202
    return(true);
1203
1203
  }
1204
1204
  /* Sort keys in optimized order */
1205
 
  internal::my_qsort((unsigned char*) *key_info_buffer, *key_count, sizeof(KEY),
 
1205
  internal::my_qsort((unsigned char*) *key_info_buffer, *key_count, sizeof(KeyInfo),
1206
1206
                     (qsort_cmp) sort_keys);
1207
1207
 
1208
1208
  /* Check fields. */
1285
1285
                                bool internal_tmp_table,
1286
1286
                                uint db_options,
1287
1287
                                uint key_count,
1288
 
                                KEY *key_info_buffer)
 
1288
                                KeyInfo *key_info_buffer)
1289
1289
{
1290
1290
  bool error= true;
1291
1291
 
1416
1416
                                bool is_if_not_exists)
1417
1417
{
1418
1418
  uint          db_options, key_count;
1419
 
  KEY           *key_info_buffer;
 
1419
  KeyInfo               *key_info_buffer;
1420
1420
  bool          error= true;
1421
1421
  TableShare share;
1422
1422
 
1558
1558
**/
1559
1559
 
1560
1560
static bool
1561
 
check_if_keyname_exists(const char *name, KEY *start, KEY *end)
 
1561
check_if_keyname_exists(const char *name, KeyInfo *start, KeyInfo *end)
1562
1562
{
1563
 
  for (KEY *key=start ; key != end ; key++)
 
1563
  for (KeyInfo *key=start ; key != end ; key++)
1564
1564
    if (!my_strcasecmp(system_charset_info,name,key->name))
1565
1565
      return 1;
1566
1566
  return 0;
1568
1568
 
1569
1569
 
1570
1570
static char *
1571
 
make_unique_key_name(const char *field_name,KEY *start,KEY *end)
 
1571
make_unique_key_name(const char *field_name,KeyInfo *start,KeyInfo *end)
1572
1572
{
1573
1573
  char buff[MAX_FIELD_NAME],*buff_end;
1574
1574