~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/table.cc

Resolving conflicts for a few files regarding FALSE=>false

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
 
135
135
TABLE_CATEGORY get_table_category(const LEX_STRING *db, const LEX_STRING *name)
136
136
{
137
 
  DBUG_ASSERT(db != NULL);
138
 
  DBUG_ASSERT(name != NULL);
 
137
  assert(db != NULL);
 
138
  assert(name != NULL);
139
139
 
140
140
  if ((db->length == INFORMATION_SCHEMA_NAME.length) &&
141
141
      (my_strcasecmp(system_charset_info,
306
306
void free_table_share(TABLE_SHARE *share)
307
307
{
308
308
  MEM_ROOT mem_root;
309
 
  DBUG_ASSERT(share->ref_count == 0);
 
309
  assert(share->ref_count == 0);
310
310
 
311
311
  /*
312
312
    If someone is waiting for this to be deleted, inform it about this.
454
454
      The following is a safety test and should never fail
455
455
      as the old file name should never be longer than the new one.
456
456
    */
457
 
    DBUG_ASSERT(length <= share->normalized_path.length);
 
457
    assert(length <= share->normalized_path.length);
458
458
    /*
459
459
      If the old and the new names have the same length,
460
460
      then table name does not have tricky characters,
580
580
    share->frm_version= FRM_VER_TRUE_VARCHAR;
581
581
 
582
582
  legacy_db_type= (enum legacy_db_type) (uint) *(head+3);
583
 
  DBUG_ASSERT(share->db_plugin == NULL);
 
583
  assert(share->db_plugin == NULL);
584
584
  /*
585
585
    if the storage engine is dynamic, no point in resolving it by its
586
586
    dynamically allocated legacy_db_type. We will resolve it later by name.
718
718
                                         keyinfo->comment.length);
719
719
      strpos+= 2 + keyinfo->comment.length;
720
720
    } 
721
 
    DBUG_ASSERT(test(keyinfo->flags & HA_USES_COMMENT) == 
 
721
    assert(test(keyinfo->flags & HA_USES_COMMENT) == 
722
722
               (keyinfo->comment.length > 0));
723
723
  }
724
724
 
824
824
      }
825
825
      next_chunk+= 2 + share->comment.length;
826
826
    }
827
 
    DBUG_ASSERT (next_chunk <= buff_end);
 
827
    assert(next_chunk <= buff_end);
828
828
    if (share->mysql_version >= MYSQL_VERSION_TABLESPACE_IN_FRM_CGE)
829
829
    {
830
830
      /*
1451
1451
  Field **field_ptr;
1452
1452
 
1453
1453
  /* Parsing of partitioning information from .frm needs thd->lex set up. */
1454
 
  DBUG_ASSERT(thd->lex->is_lex_started);
 
1454
  assert(thd->lex->is_lex_started);
1455
1455
 
1456
1456
  error= 1;
1457
1457
  bzero((char*) outparam, sizeof(*outparam));
1478
1478
  }
1479
1479
  else
1480
1480
  {
1481
 
    DBUG_ASSERT(!db_stat);
 
1481
    assert(!db_stat);
1482
1482
  }
1483
1483
 
1484
1484
  error= 4;
2168
2168
    int2store(fileinfo+6,IO_SIZE);              /* Next block starts here */
2169
2169
    for (i= 0; i < keys; i++)
2170
2170
    {
2171
 
      DBUG_ASSERT(test(key_info[i].flags & HA_USES_COMMENT) == 
 
2171
      assert(test(key_info[i].flags & HA_USES_COMMENT) == 
2172
2172
                 (key_info[i].comment.length > 0));
2173
2173
      if (key_info[i].flags & HA_USES_COMMENT)
2174
2174
        key_comment_total_bytes += 2 + key_info[i].comment.length;
2345
2345
                       key_part_map keypart_map)
2346
2346
{
2347
2347
  /* works only with key prefixes */
2348
 
  DBUG_ASSERT(((keypart_map + 1) & keypart_map) == 0);
 
2348
  assert(((keypart_map + 1) & keypart_map) == 0);
2349
2349
 
2350
2350
  KEY *key_info= table->s->key_info+key;
2351
2351
  KEY_PART_INFO *key_part= key_info->key_part;
2445
2445
      This assert is to catch use of this byte if we decide to
2446
2446
      use non-utf8 as system_character_set.
2447
2447
    */
2448
 
    DBUG_ASSERT(*name != NAMES_SEP_CHAR);
 
2448
    assert(*name != NAMES_SEP_CHAR);
2449
2449
    name++;
2450
2450
    name_length++;
2451
2451
  }
2643
2643
  for (Field **ptr= field; *ptr; ptr++)
2644
2644
  {
2645
2645
    Item_field *item_field= (Item_field*) it++;
2646
 
    DBUG_ASSERT(item_field != 0);
 
2646
    assert(item_field != 0);
2647
2647
    item_field->reset_field(*ptr);
2648
2648
  }
2649
2649
}
2811
2811
 
2812
2812
  if (is_leaf_for_name_resolution())
2813
2813
    return this;
2814
 
  DBUG_ASSERT(nested_join);
 
2814
  assert(nested_join);
2815
2815
 
2816
2816
  for (cur_nested_join= nested_join;
2817
2817
       cur_nested_join;
2868
2868
 
2869
2869
  if (is_leaf_for_name_resolution())
2870
2870
    return this;
2871
 
  DBUG_ASSERT(nested_join);
 
2871
  assert(nested_join);
2872
2872
 
2873
2873
  for (cur_nested_join= nested_join;
2874
2874
       cur_nested_join;
2898
2898
Natural_join_column::Natural_join_column(Field_translator *field_param,
2899
2899
                                         TABLE_LIST *tab)
2900
2900
{
2901
 
  DBUG_ASSERT(tab->field_translation);
 
2901
  assert(tab->field_translation);
2902
2902
  view_field= field_param;
2903
2903
  table_field= NULL;
2904
2904
  table_ref= tab;
2909
2909
Natural_join_column::Natural_join_column(Field *field_param,
2910
2910
                                         TABLE_LIST *tab)
2911
2911
{
2912
 
  DBUG_ASSERT(tab->table == field_param->table);
 
2912
  assert(tab->table == field_param->table);
2913
2913
  table_field= field_param;
2914
2914
  view_field= NULL;
2915
2915
  table_ref= tab;
2921
2921
{
2922
2922
  if (view_field)
2923
2923
  {
2924
 
    DBUG_ASSERT(table_field == NULL);
 
2924
    assert(table_field == NULL);
2925
2925
    return view_field->name;
2926
2926
  }
2927
2927
 
2933
2933
{
2934
2934
  if (view_field)
2935
2935
  {
2936
 
    DBUG_ASSERT(table_field == NULL);
 
2936
    assert(table_field == NULL);
2937
2937
    return create_view_field(thd, table_ref, &view_field->item,
2938
2938
                             view_field->name);
2939
2939
  }
2945
2945
{
2946
2946
  if (view_field)
2947
2947
  {
2948
 
    DBUG_ASSERT(table_field == NULL);
 
2948
    assert(table_field == NULL);
2949
2949
    return NULL;
2950
2950
  }
2951
2951
  return table_field;
2954
2954
 
2955
2955
const char *Natural_join_column::table_name()
2956
2956
{
2957
 
  DBUG_ASSERT(table_ref);
 
2957
  assert(table_ref);
2958
2958
  return table_ref->alias;
2959
2959
}
2960
2960
 
2966
2966
    ensure consistency. An exception are I_S schema tables, which
2967
2967
    are inconsistent in this respect.
2968
2968
  */
2969
 
  DBUG_ASSERT(!strcmp(table_ref->db,
 
2969
  assert(!strcmp(table_ref->db,
2970
2970
                      table_ref->table->s->db.str) ||
2971
2971
              (table_ref->schema_table &&
2972
2972
               table_ref->table->s->db.str[0] == 0));
2976
2976
 
2977
2977
void Field_iterator_view::set(TABLE_LIST *table)
2978
2978
{
2979
 
  DBUG_ASSERT(table->field_translation);
 
2979
  assert(table->field_translation);
2980
2980
  view= table;
2981
2981
  ptr= table->field_translation;
2982
2982
  array_end= table->field_translation_end;
3027
3027
      ('mysql_schema_table' function). So we can return directly the
3028
3028
      field. This case happens only for 'show & where' commands.
3029
3029
    */
3030
 
    DBUG_ASSERT(field && field->fixed);
 
3030
    assert(field && field->fixed);
3031
3031
    return(field);
3032
3032
  }
3033
3033
 
3037
3037
 
3038
3038
void Field_iterator_natural_join::set(TABLE_LIST *table_ref)
3039
3039
{
3040
 
  DBUG_ASSERT(table_ref->join_columns);
 
3040
  assert(table_ref->join_columns);
3041
3041
  column_ref_it.init(*(table_ref->join_columns));
3042
3042
  cur_column_ref= column_ref_it++;
3043
3043
}
3046
3046
void Field_iterator_natural_join::next()
3047
3047
{
3048
3048
  cur_column_ref= column_ref_it++;
3049
 
  DBUG_ASSERT(!cur_column_ref || ! cur_column_ref->table_field ||
 
3049
  assert(!cur_column_ref || ! cur_column_ref->table_field ||
3050
3050
              cur_column_ref->table_ref->table ==
3051
3051
              cur_column_ref->table_field->table);
3052
3052
}
3064
3064
  if (table_ref->is_join_columns_complete)
3065
3065
  {
3066
3066
    /* Necesary, but insufficient conditions. */
3067
 
    DBUG_ASSERT(table_ref->is_natural_join ||
 
3067
    assert(table_ref->is_natural_join ||
3068
3068
                table_ref->nested_join ||
3069
3069
                table_ref->join_columns &&
3070
3070
                /* This is a merge view. */
3081
3081
  /* This is a base table or stored view. */
3082
3082
  else
3083
3083
  {
3084
 
    DBUG_ASSERT(table_ref->table);
 
3084
    assert(table_ref->table);
3085
3085
    field_it= &table_field_it;
3086
3086
  }
3087
3087
  field_it->set(table_ref);
3091
3091
 
3092
3092
void Field_iterator_table_ref::set(TABLE_LIST *table)
3093
3093
{
3094
 
  DBUG_ASSERT(table);
 
3094
  assert(table);
3095
3095
  first_leaf= table->first_leaf_for_name_resolution();
3096
3096
  last_leaf=  table->last_leaf_for_name_resolution();
3097
 
  DBUG_ASSERT(first_leaf && last_leaf);
 
3097
  assert(first_leaf && last_leaf);
3098
3098
  table_ref= first_leaf;
3099
3099
  set_field_iterator();
3100
3100
}
3111
3111
  if (field_it->end_of_fields() && table_ref != last_leaf)
3112
3112
  {
3113
3113
    table_ref= table_ref->next_name_resolution_table;
3114
 
    DBUG_ASSERT(table_ref);
 
3114
    assert(table_ref);
3115
3115
    set_field_iterator();
3116
3116
  }
3117
3117
}
3122
3122
  if (table_ref->is_natural_join)
3123
3123
    return natural_join_it.column_ref()->table_name();
3124
3124
 
3125
 
  DBUG_ASSERT(!strcmp(table_ref->table_name,
 
3125
  assert(!strcmp(table_ref->table_name,
3126
3126
                      table_ref->table->s->table_name.str));
3127
3127
  return table_ref->table_name;
3128
3128
}
3138
3138
    ensure consistency. An exception are I_S schema tables, which
3139
3139
    are inconsistent in this respect.
3140
3140
  */
3141
 
  DBUG_ASSERT(!strcmp(table_ref->db, table_ref->table->s->db.str) ||
 
3141
  assert(!strcmp(table_ref->db, table_ref->table->s->db.str) ||
3142
3142
              (table_ref->schema_table &&
3143
3143
               table_ref->table->s->db.str[0] == 0));
3144
3144
 
3214
3214
      already created via one of the two constructor calls above. In this case
3215
3215
      we just return the already created column reference.
3216
3216
    */
3217
 
    DBUG_ASSERT(table_ref->is_join_columns_complete);
 
3217
    assert(table_ref->is_join_columns_complete);
3218
3218
    is_created= FALSE;
3219
3219
    nj_col= natural_join_it.column_ref();
3220
 
    DBUG_ASSERT(nj_col);
 
3220
    assert(nj_col);
3221
3221
  }
3222
 
  DBUG_ASSERT(!nj_col->table_field ||
 
3222
  assert(!nj_col->table_field ||
3223
3223
              nj_col->table_ref->table == nj_col->table_field->table);
3224
3224
 
3225
3225
  /*
3230
3230
  if (is_created)
3231
3231
  {
3232
3232
    /* Make sure not all columns were materialized. */
3233
 
    DBUG_ASSERT(!add_table_ref->is_join_columns_complete);
 
3233
    assert(!add_table_ref->is_join_columns_complete);
3234
3234
    if (!add_table_ref->join_columns)
3235
3235
    {
3236
3236
      /* Create a list of natural join columns on demand. */
3276
3276
{
3277
3277
  Natural_join_column *nj_col;
3278
3278
 
3279
 
  DBUG_ASSERT(field_it == &natural_join_it);
 
3279
  assert(field_it == &natural_join_it);
3280
3280
  /*
3281
3281
    The field belongs to a NATURAL join, therefore the column reference was
3282
3282
    already created via one of the two constructor calls above. In this case
3283
3283
    we just return the already created column reference.
3284
3284
  */
3285
3285
  nj_col= natural_join_it.column_ref();
3286
 
  DBUG_ASSERT(nj_col &&
 
3286
  assert(nj_col &&
3287
3287
              (!nj_col->table_field ||
3288
3288
               nj_col->table_ref->table == nj_col->table_field->table));
3289
3289
  return nj_col;
3399
3399
 
3400
3400
void st_table::mark_auto_increment_column()
3401
3401
{
3402
 
  DBUG_ASSERT(found_next_number_field);
 
3402
  assert(found_next_number_field);
3403
3403
  /*
3404
3404
    We must set bit in read set as update_auto_increment() is using the
3405
3405
    store() to check overflow of auto_increment values