~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_select.cc

Merged build changes from Antony.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include "mysql_priv.h"
32
32
#include "sql_select.h"
33
33
 
34
 
#include <m_ctype.h>
35
 
#include <my_bit.h>
36
 
#include <hash.h>
 
34
#include <mysys/my_bit.h>
 
35
#include <mysys/hash.h>
37
36
 
38
37
const char *join_type_str[]={ "UNKNOWN","system","const","eq_ref","ref",
39
38
                              "MAYBE_REF","ALL","range","index",
3477
3476
    table->quick_keys.clear_all();
3478
3477
    table->reginfo.join_tab=s;
3479
3478
    table->reginfo.not_exists_optimize=0;
3480
 
    bzero((char*) table->const_key_parts, sizeof(key_part_map)*table->s->keys);
 
3479
    memset((char*) table->const_key_parts, 0,
 
3480
           sizeof(key_part_map)*table->s->keys);
3481
3481
    all_table_map|= table->map;
3482
3482
    s->join=join;
3483
3483
    s->info=0;                                  // For describe
4587
4587
static bool
4588
4588
update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
4589
4589
                    uint tables, COND *cond,
4590
 
                    COND_EQUAL *cond_equal __attribute__((__unused__)),
 
4590
                    COND_EQUAL *cond_equal __attribute__((unused)),
4591
4591
                    table_map normal_tables, SELECT_LEX *select_lex,
4592
4592
                    SARGABLE_PARAM **sargables)
4593
4593
{
4693
4693
    my_qsort(keyuse->buffer,keyuse->elements,sizeof(KEYUSE),
4694
4694
          (qsort_cmp) sort_keyuse);
4695
4695
 
4696
 
    bzero((char*) &key_end,sizeof(key_end));    /* Add for easy testing */
 
4696
    memset((char*) &key_end, 0, sizeof(key_end)); /* Add for easy testing */
4697
4697
    VOID(insert_dynamic(keyuse,(uchar*) &key_end));
4698
4698
 
4699
4699
    use=save_pos=dynamic_element(keyuse,0,KEYUSE*);
4937
4937
                 table_map remaining_tables,
4938
4938
                 uint      idx,
4939
4939
                 double    record_count,
4940
 
                 double    read_time __attribute__((__unused__)))
 
4940
                 double    read_time __attribute__((unused)))
4941
4941
{
4942
4942
  KEYUSE *best_key=         0;
4943
4943
  uint best_max_key_part=   0;
6246
6246
  Find how much space the prevous read not const tables takes in cache.
6247
6247
*/
6248
6248
 
6249
 
static void calc_used_field_length(THD *thd __attribute__((__unused__)),
 
6249
static void calc_used_field_length(THD *thd __attribute__((unused)),
6250
6250
                                   JOIN_TAB *join_tab)
6251
6251
{
6252
6252
  uint null_fields,blobs,fields,rec_length;
6698
6698
  join_tab->ref.key_parts= 0;
6699
6699
  join_tab->flush_weedout_table= join_tab->check_weed_out_table= NULL;
6700
6700
  join_tab->do_firstmatch= NULL;
6701
 
  bzero((char*) &join_tab->read_record,sizeof(join_tab->read_record));
 
6701
  memset((char*) &join_tab->read_record, 0, sizeof(join_tab->read_record));
6702
6702
  tmp_table->status=0;
6703
6703
  tmp_table->null_row=0;
6704
6704
  return(false);
9392
9392
    }
9393
9393
    if (cond->type() == Item::COND_ITEM &&
9394
9394
        !((Item_cond*)cond)->argument_list()->elements)
9395
 
      cond= new Item_int((int32)cond->val_bool());
 
9395
      cond= new Item_int((int32_t)cond->val_bool());
9396
9396
 
9397
9397
  }
9398
9398
  else if (cond->type() == Item::FUNC_ITEM && 
10381
10381
        thd->substitute_null_with_insert_id= false;
10382
10382
      }
10383
10383
      /* fix to replace 'NULL' dates with '0' (shreeve@uci.edu) */
10384
 
      else if (((field->type() == MYSQL_TYPE_NEWDATE) ||
10385
 
                (field->type() == MYSQL_TYPE_DATETIME)) &&
 
10384
      else if (((field->type() == DRIZZLE_TYPE_NEWDATE) ||
 
10385
                (field->type() == DRIZZLE_TYPE_DATETIME)) &&
10386
10386
                (field->flags & NOT_NULL_FLAG) &&
10387
10387
               !field->table->maybe_null)
10388
10388
      {
10585
10585
    new_field->flags|= (org_field->flags & NO_DEFAULT_VALUE_FLAG);
10586
10586
    if (org_field->maybe_null() || (item && item->maybe_null))
10587
10587
      new_field->flags&= ~NOT_NULL_FLAG;        // Because of outer join
10588
 
    if (org_field->type() == MYSQL_TYPE_VAR_STRING ||
10589
 
        org_field->type() == MYSQL_TYPE_VARCHAR)
 
10588
    if (org_field->type() == DRIZZLE_TYPE_VAR_STRING ||
 
10589
        org_field->type() == DRIZZLE_TYPE_VARCHAR)
10590
10590
      table->s->db_create_options|= HA_OPTION_PACK_RECORD;
10591
 
    else if (org_field->type() == FIELD_TYPE_DOUBLE)
 
10591
    else if (org_field->type() == DRIZZLE_TYPE_DOUBLE)
10592
10592
      ((Field_double *) new_field)->not_fixed= true;
10593
10593
  }
10594
10594
  return new_field;
10618
10618
    new_created field
10619
10619
*/
10620
10620
 
10621
 
static Field *create_tmp_field_from_item(THD *thd __attribute__((__unused__)),
 
10621
static Field *create_tmp_field_from_item(THD *thd __attribute__((unused)),
10622
10622
                                         Item *item, TABLE *table,
10623
10623
                                         Item ***copy_func, bool modify_item,
10624
10624
                                         uint convert_blob_length)
10653
10653
      DATE/TIME fields have STRING_RESULT result type. 
10654
10654
      To preserve type they needed to be handled separately.
10655
10655
    */
10656
 
    if ((type= item->field_type()) == MYSQL_TYPE_DATETIME ||
10657
 
        type == MYSQL_TYPE_TIME || type == MYSQL_TYPE_NEWDATE ||
10658
 
        type == MYSQL_TYPE_TIMESTAMP)
 
10656
    if ((type= item->field_type()) == DRIZZLE_TYPE_DATETIME ||
 
10657
        type == DRIZZLE_TYPE_TIME || type == DRIZZLE_TYPE_NEWDATE ||
 
10658
        type == DRIZZLE_TYPE_TIMESTAMP)
10659
10659
      new_field= item->tmp_table_field_from_field_type(table, 1);
10660
10660
    /* 
10661
10661
      Make sure that the blob fits into a Field_varstring which has 
10673
10673
    break;
10674
10674
  case DECIMAL_RESULT:
10675
10675
  {
10676
 
    uint8 dec= item->decimals;
10677
 
    uint8 intg= ((Item_decimal *) item)->decimal_precision() - dec;
10678
 
    uint32 len= item->max_length;
 
10676
    uint8_t dec= item->decimals;
 
10677
    uint8_t intg= ((Item_decimal *) item)->decimal_precision() - dec;
 
10678
    uint32_t len= item->max_length;
10679
10679
 
10680
10680
    /*
10681
10681
      Trying to put too many digits overall in a DECIMAL(prec,dec)
10742
10742
    new_created field
10743
10743
*/
10744
10744
 
10745
 
Field *create_tmp_field_for_schema(THD *thd __attribute__((__unused__)),
 
10745
Field *create_tmp_field_for_schema(THD *thd __attribute__((unused)),
10746
10746
                                   Item *item, TABLE *table)
10747
10747
{
10748
 
  if (item->field_type() == MYSQL_TYPE_VARCHAR)
 
10748
  if (item->field_type() == DRIZZLE_TYPE_VARCHAR)
10749
10749
  {
10750
10750
    Field *field;
10751
10751
    if (item->max_length > MAX_FIELD_VARCHARLENGTH)
10796
10796
                        Item ***copy_func, Field **from_field,
10797
10797
                        Field **default_field,
10798
10798
                        bool group, bool modify_item,
10799
 
                        bool table_cant_handle_bit_fields __attribute__((__unused__)),
 
10799
                        bool table_cant_handle_bit_fields __attribute__((unused)),
10800
10800
                        bool make_copy_field,
10801
10801
                        uint convert_blob_length)
10802
10802
{
11068
11068
  strmov(tmpname,path);
11069
11069
  /* make table according to fields */
11070
11070
 
11071
 
  bzero((char*) table,sizeof(*table));
11072
 
  bzero((char*) reg_field,sizeof(Field*)*(field_count+1));
11073
 
  bzero((char*) default_field, sizeof(Field*) * (field_count));
11074
 
  bzero((char*) from_field,sizeof(Field*)*field_count);
 
11071
  memset((char*) table, 0, sizeof(*table));
 
11072
  memset((char*) reg_field, 0, sizeof(Field*)*(field_count+1));
 
11073
  memset((char*) default_field, 0, sizeof(Field*) * (field_count));
 
11074
  memset((char*) from_field, 0, sizeof(Field*)*field_count);
11075
11075
 
11076
11076
  table->mem_root= own_root;
11077
11077
  mem_root_save= thd->mem_root;
11157
11157
            blob_count++;
11158
11158
          }
11159
11159
          *(reg_field++)= new_field;
11160
 
          if (new_field->real_type() == MYSQL_TYPE_STRING ||
11161
 
              new_field->real_type() == MYSQL_TYPE_VARCHAR)
 
11160
          if (new_field->real_type() == DRIZZLE_TYPE_STRING ||
 
11161
              new_field->real_type() == DRIZZLE_TYPE_VARCHAR)
11162
11162
          {
11163
11163
            string_count++;
11164
11164
            string_total_length+= new_field->pack_length();
11322
11322
  pos=table->record[0]+ null_pack_length;
11323
11323
  if (null_pack_length)
11324
11324
  {
11325
 
    bzero((uchar*) recinfo,sizeof(*recinfo));
 
11325
    memset((uchar*) recinfo, 0, sizeof(*recinfo));
11326
11326
    recinfo->type=FIELD_NORMAL;
11327
11327
    recinfo->length=null_pack_length;
11328
11328
    recinfo++;
11329
 
    bfill(null_flags,null_pack_length,255);     // Set null fields
 
11329
    memset(null_flags, 255, null_pack_length);  // Set null fields
11330
11330
 
11331
11331
    table->null_flags= (uchar*) table->record[0];
11332
11332
    share->null_fields= null_count+ hidden_null_count;
11338
11338
  {
11339
11339
    Field *field= *reg_field;
11340
11340
    uint length;
11341
 
    bzero((uchar*) recinfo,sizeof(*recinfo));
 
11341
    memset((uchar*) recinfo, 0, sizeof(*recinfo));
11342
11342
 
11343
11343
    if (!(field->flags & NOT_NULL_FLAG))
11344
11344
    {
11352
11352
        recinfo->length=1;
11353
11353
        recinfo->type=FIELD_NORMAL;
11354
11354
        recinfo++;
11355
 
        bzero((uchar*) recinfo,sizeof(*recinfo));
 
11355
        memset((uchar*) recinfo, 0, sizeof(*recinfo));
11356
11356
      }
11357
11357
      else
11358
11358
      {
11407
11407
    if (field->flags & BLOB_FLAG)
11408
11408
      recinfo->type= (int) FIELD_BLOB;
11409
11409
    else if (use_packed_rows &&
11410
 
             field->real_type() == MYSQL_TYPE_STRING &&
 
11410
             field->real_type() == DRIZZLE_TYPE_STRING &&
11411
11411
             length >= MIN_STRING_LENGTH_TO_PACK_ROWS)
11412
11412
      recinfo->type=FIELD_SKIP_ENDSPACE;
11413
11413
    else
11463
11463
      key_part_info->null_bit=0;
11464
11464
      key_part_info->field=  field;
11465
11465
      key_part_info->offset= field->offset(table->record[0]);
11466
 
      key_part_info->length= (uint16) field->key_length();
11467
 
      key_part_info->type=   (uint8) field->key_type();
 
11466
      key_part_info->length= (uint16_t) field->key_length();
 
11467
      key_part_info->type=   (uint8_t) field->key_type();
11468
11468
      key_part_info->key_type =
11469
11469
        ((ha_base_keytype) key_part_info->type == HA_KEYTYPE_TEXT ||
11470
11470
         (ha_base_keytype) key_part_info->type == HA_KEYTYPE_VARTEXT1 ||
11528
11528
          alloc_root(&table->mem_root,
11529
11529
                     keyinfo->key_parts * sizeof(KEY_PART_INFO))))
11530
11530
      goto err;
11531
 
    bzero((void*) key_part_info, keyinfo->key_parts * sizeof(KEY_PART_INFO));
 
11531
    memset(key_part_info, 0, keyinfo->key_parts * sizeof(KEY_PART_INFO));
11532
11532
    table->key_info=keyinfo;
11533
11533
    keyinfo->key_part=key_part_info;
11534
11534
    keyinfo->flags=HA_NOSAME | HA_NULL_ARE_EQUAL;
11535
 
    keyinfo->key_length=(uint16) reclength;
 
11535
    keyinfo->key_length=(uint16_t) reclength;
11536
11536
    keyinfo->name= (char*) "distinct_key";
11537
11537
    keyinfo->algorithm= HA_KEY_ALG_UNDEF;
11538
11538
    keyinfo->rec_per_key=0;
11548
11548
      key_part_info->offset=hidden_null_pack_length;
11549
11549
      key_part_info->length=null_pack_length;
11550
11550
      key_part_info->field= new Field_string(table->record[0],
11551
 
                                             (uint32) key_part_info->length,
 
11551
                                             (uint32_t) key_part_info->length,
11552
11552
                                             (uchar*) 0,
11553
11553
                                             (uint) 0,
11554
11554
                                             Field::NONE,
11568
11568
      key_part_info->null_bit=0;
11569
11569
      key_part_info->field=    *reg_field;
11570
11570
      key_part_info->offset=   (*reg_field)->offset(table->record[0]);
11571
 
      key_part_info->length=   (uint16) (*reg_field)->pack_length();
 
11571
      key_part_info->length=   (uint16_t) (*reg_field)->pack_length();
11572
11572
      /* TODO:
11573
11573
        The below method of computing the key format length of the
11574
11574
        key part is a copy/paste from opt_range.cc, and table.cc.
11581
11581
 
11582
11582
      if ((*reg_field)->real_maybe_null())
11583
11583
        key_part_info->store_length+= HA_KEY_NULL_LENGTH;
11584
 
      if ((*reg_field)->type() == MYSQL_TYPE_BLOB || 
11585
 
          (*reg_field)->real_type() == MYSQL_TYPE_VARCHAR)
 
11584
      if ((*reg_field)->type() == DRIZZLE_TYPE_BLOB || 
 
11585
          (*reg_field)->real_type() == DRIZZLE_TYPE_VARCHAR)
11586
11586
        key_part_info->store_length+= HA_KEY_BLOB_LENGTH;
11587
11587
 
11588
 
      key_part_info->type=     (uint8) (*reg_field)->key_type();
 
11588
      key_part_info->type=     (uint8_t) (*reg_field)->key_type();
11589
11589
      key_part_info->key_type =
11590
11590
        ((ha_base_keytype) key_part_info->type == HA_KEYTYPE_TEXT ||
11591
11591
         (ha_base_keytype) key_part_info->type == HA_KEYTYPE_VARTEXT1 ||
11724
11724
  
11725
11725
 
11726
11726
  /* STEP 4: Create TABLE description */
11727
 
  bzero((char*) table,sizeof(*table));
11728
 
  bzero((char*) reg_field,sizeof(Field*)*2);
 
11727
  memset((char*) table, 0, sizeof(*table));
 
11728
  memset((char*) reg_field, 0, sizeof(Field*)*2);
11729
11729
 
11730
11730
  table->mem_root= own_root;
11731
11731
  mem_root_save= thd->mem_root;
11824
11824
  pos=table->record[0]+ null_pack_length;
11825
11825
  if (null_pack_length)
11826
11826
  {
11827
 
    bzero((uchar*) recinfo,sizeof(*recinfo));
 
11827
    memset((uchar*) recinfo, 0, sizeof(*recinfo));
11828
11828
    recinfo->type=FIELD_NORMAL;
11829
11829
    recinfo->length=null_pack_length;
11830
11830
    recinfo++;
11831
 
    bfill(null_flags,null_pack_length,255);     // Set null fields
 
11831
    memset(null_flags, 255, null_pack_length);  // Set null fields
11832
11832
 
11833
11833
    table->null_flags= (uchar*) table->record[0];
11834
11834
    share->null_fields= null_count;
11839
11839
  {
11840
11840
    //Field *field= *reg_field;
11841
11841
    uint length;
11842
 
    bzero((uchar*) recinfo,sizeof(*recinfo));
 
11842
    memset((uchar*) recinfo, 0, sizeof(*recinfo));
11843
11843
    field->move_field(pos,(uchar*) 0,0);
11844
11844
 
11845
11845
    field->reset();
11848
11848
      'offset' fields generated by initalize_tables
11849
11849
    */
11850
11850
    // Initialize the table field:
11851
 
    bzero(field->ptr, field->pack_length());
 
11851
    memset(field->ptr, 0, field->pack_length());
11852
11852
 
11853
11853
    length=field->pack_length();
11854
11854
    pos+= length;
11858
11858
    if (field->flags & BLOB_FLAG)
11859
11859
      recinfo->type= (int) FIELD_BLOB;
11860
11860
    else if (use_packed_rows &&
11861
 
             field->real_type() == MYSQL_TYPE_STRING &&
 
11861
             field->real_type() == DRIZZLE_TYPE_STRING &&
11862
11862
             length >= MIN_STRING_LENGTH_TO_PACK_ROWS)
11863
11863
      recinfo->type=FIELD_SKIP_ENDSPACE;
11864
11864
    else
11898
11898
      key_part_info->null_bit=0;
11899
11899
      key_part_info->field=  field;
11900
11900
      key_part_info->offset= field->offset(table->record[0]);
11901
 
      key_part_info->length= (uint16) field->key_length();
11902
 
      key_part_info->type=   (uint8) field->key_type();
 
11901
      key_part_info->length= (uint16_t) field->key_length();
 
11902
      key_part_info->type=   (uint8_t) field->key_type();
11903
11903
      key_part_info->key_type = FIELDFLAG_BINARY;
11904
11904
      if (!using_unique_constraint)
11905
11905
      {
11983
11983
                        NullS))
11984
11984
    return 0;
11985
11985
 
11986
 
  bzero(table, sizeof(*table));
11987
 
  bzero(share, sizeof(*share));
 
11986
  memset(table, 0, sizeof(*table));
 
11987
  memset(share, 0, sizeof(*share));
11988
11988
  table->field= field;
11989
11989
  table->s= share;
11990
11990
  share->blob_field= blob_field;
12130
12130
    if (!seg)
12131
12131
      goto err;
12132
12132
 
12133
 
    bzero(seg, sizeof(*seg) * keyinfo->key_parts);
 
12133
    memset(seg, 0, sizeof(*seg) * keyinfo->key_parts);
12134
12134
    if (keyinfo->key_length >= table->file->max_key_length() ||
12135
12135
        keyinfo->key_parts > table->file->max_key_parts() ||
12136
12136
        share->uniques)
12139
12139
      share->keys=    0;
12140
12140
      share->uniques= 1;
12141
12141
      using_unique_constraint=1;
12142
 
      bzero((char*) &uniquedef,sizeof(uniquedef));
 
12142
      memset((char*) &uniquedef, 0, sizeof(uniquedef));
12143
12143
      uniquedef.keysegs=keyinfo->key_parts;
12144
12144
      uniquedef.seg=seg;
12145
12145
      uniquedef.null_are_equal=1;
12146
12146
 
12147
12147
      /* Create extra column for hash value */
12148
 
      bzero((uchar*) *recinfo,sizeof(**recinfo));
 
12148
      memset((uchar*) *recinfo, 0, sizeof(**recinfo));
12149
12149
      (*recinfo)->type= FIELD_CHECK;
12150
12150
      (*recinfo)->length=MI_UNIQUE_HASH_LENGTH;
12151
12151
      (*recinfo)++;
12154
12154
    else
12155
12155
    {
12156
12156
      /* Create an unique key */
12157
 
      bzero((char*) &keydef,sizeof(keydef));
 
12157
      memset((char*) &keydef, 0, sizeof(keydef));
12158
12158
      keydef.flag=HA_NOSAME | HA_BINARY_PACK_KEY | HA_PACK_KEY;
12159
12159
      keydef.keysegs=  keyinfo->key_parts;
12160
12160
      keydef.seg= seg;
12171
12171
        seg->type=
12172
12172
        ((keyinfo->key_part[i].key_type & FIELDFLAG_BINARY) ?
12173
12173
         HA_KEYTYPE_VARBINARY2 : HA_KEYTYPE_VARTEXT2);
12174
 
        seg->bit_start= (uint8)(field->pack_length() - share->blob_ptr_size);
 
12174
        seg->bit_start= (uint8_t)(field->pack_length() - share->blob_ptr_size);
12175
12175
        seg->flag= HA_BLOB_PART;
12176
12176
        seg->length=0;                  // Whole blob in unique constraint
12177
12177
      }
12179
12179
      {
12180
12180
        seg->type= keyinfo->key_part[i].type;
12181
12181
        /* Tell handler if it can do suffic space compression */
12182
 
        if (field->real_type() == MYSQL_TYPE_STRING &&
 
12182
        if (field->real_type() == DRIZZLE_TYPE_STRING &&
12183
12183
            keyinfo->key_part[i].length > 4)
12184
12184
          seg->flag|= HA_SPACE_PACK;
12185
12185
      }
12198
12198
    }
12199
12199
  }
12200
12200
  MI_CREATE_INFO create_info;
12201
 
  bzero((char*) &create_info,sizeof(create_info));
 
12201
  memset((char*) &create_info, 0, sizeof(create_info));
12202
12202
 
12203
12203
  if ((options & (OPTION_BIG_TABLES | SELECT_SMALL_RESULT)) ==
12204
12204
      OPTION_BIG_TABLES)
12811
12811
  // 2. Zero the null bytes 
12812
12812
  if (sjtbl->null_bytes)
12813
12813
  {
12814
 
    bzero(ptr, sjtbl->null_bytes);
 
12814
    memset(ptr, 0, sjtbl->null_bytes);
12815
12815
    ptr += sjtbl->null_bytes; 
12816
12816
  }
12817
12817
 
12823
12823
    {
12824
12824
      /* It's a NULL-complemented row */
12825
12825
      *(nulls_ptr + tab->null_byte) |= tab->null_bit;
12826
 
      bzero(ptr + tab->rowid_offset, h->ref_length);
 
12826
      memset(ptr + tab->rowid_offset, 0, h->ref_length);
12827
12827
    }
12828
12828
    else
12829
12829
    {
14222
14222
          frequent case?
14223
14223
        */
14224
14224
        if (field->binary() &&
14225
 
            field->real_type() != MYSQL_TYPE_STRING &&
14226
 
            field->real_type() != MYSQL_TYPE_VARCHAR &&
 
14225
            field->real_type() != DRIZZLE_TYPE_STRING &&
 
14226
            field->real_type() != DRIZZLE_TYPE_VARCHAR &&
14227
14227
            field->decimals() == 0)
14228
14228
        {
14229
14229
          return !store_val_in_field(field, right_item, CHECK_FIELD_WARN);
16304
16304
static ORDER *
16305
16305
create_distinct_group(THD *thd, Item **ref_pointer_array,
16306
16306
                      ORDER *order_list, List<Item> &fields,
16307
 
                      List<Item> &all_fields __attribute__((__unused__)),
 
16307
                      List<Item> &all_fields __attribute__((unused)),
16308
16308
                      bool *all_order_by_fields_used)
16309
16309
{
16310
16310
  List_iterator<Item> li(fields);
16488
16488
    if (field)
16489
16489
    {
16490
16490
      enum_field_types type;
16491
 
      if ((type= field->type()) == MYSQL_TYPE_BLOB)
 
16491
      if ((type= field->type()) == DRIZZLE_TYPE_BLOB)
16492
16492
        key_length+=MAX_BLOB_WIDTH;             // Can't be used as a key
16493
 
      else if (type == MYSQL_TYPE_VARCHAR || type == MYSQL_TYPE_VAR_STRING)
 
16493
      else if (type == DRIZZLE_TYPE_VARCHAR || type == DRIZZLE_TYPE_VAR_STRING)
16494
16494
        key_length+= field->field_length + HA_KEY_BLOB_LENGTH;
16495
16495
      else
16496
16496
        key_length+= field->pack_length();
16517
16517
          have STRING_RESULT result type, we increase the length 
16518
16518
          by 8 as maximum pack length of such fields.
16519
16519
        */
16520
 
        if (type == MYSQL_TYPE_TIME ||
16521
 
            type == MYSQL_TYPE_NEWDATE ||
16522
 
            type == MYSQL_TYPE_DATETIME ||
16523
 
            type == MYSQL_TYPE_TIMESTAMP)
 
16520
        if (type == DRIZZLE_TYPE_TIME ||
 
16521
            type == DRIZZLE_TYPE_NEWDATE ||
 
16522
            type == DRIZZLE_TYPE_DATETIME ||
 
16523
            type == DRIZZLE_TYPE_TIMESTAMP)
16524
16524
        {
16525
16525
          key_length+= 8;
16526
16526
        }
17189
17189
  @param select   pointer to st_select_lex which subselects joins we will free
17190
17190
*/
17191
17191
 
17192
 
void free_underlaid_joins(THD *thd __attribute__((__unused__)),
 
17192
void free_underlaid_joins(THD *thd __attribute__((unused)),
17193
17193
                          SELECT_LEX *select)
17194
17194
{
17195
17195
  for (SELECT_LEX_UNIT *unit= select->first_inner_unit();
17661
17661
  */
17662
17662
  if (message)
17663
17663
  {
17664
 
    item_list.push_back(new Item_int((int32)
 
17664
    item_list.push_back(new Item_int((int32_t)
17665
17665
                                     join->select_lex->select_number));
17666
17666
    item_list.push_back(new Item_string(join->select_lex->type,
17667
17667
                                        strlen(join->select_lex->type), cs));
17765
17765
      quick_type= -1;
17766
17766
      item_list.empty();
17767
17767
      /* id */
17768
 
      item_list.push_back(new Item_uint((uint32)
 
17768
      item_list.push_back(new Item_uint((uint32_t)
17769
17769
                                       join->select_lex->select_number));
17770
17770
      /* select_type */
17771
17771
      item_list.push_back(new Item_string(join->select_lex->type,
17950
17950
          extra.append(STRING_WITH_LEN("; Full scan on NULL key"));
17951
17951
        /* Skip initial "; "*/
17952
17952
        const char *str= extra.ptr();
17953
 
        uint32 len= extra.length();
 
17953
        uint32_t len= extra.length();
17954
17954
        if (len)
17955
17955
        {
17956
17956
          str += 2;
18095
18095
 
18096
18096
        /* Skip initial "; "*/
18097
18097
        const char *str= extra.ptr();
18098
 
        uint32 len= extra.length();
 
18098
        uint32_t len= extra.length();
18099
18099
        if (len)
18100
18100
        {
18101
18101
          str += 2;
18130
18130
       sl= sl->next_select())
18131
18131
  {
18132
18132
    // drop UNCACHEABLE_EXPLAIN, because it is for internal usage only
18133
 
    uint8 uncacheable= (sl->uncacheable & ~UNCACHEABLE_EXPLAIN);
 
18133
    uint8_t uncacheable= (sl->uncacheable & ~UNCACHEABLE_EXPLAIN);
18134
18134
    sl->type= (((&thd->lex->select_lex)==sl)?
18135
18135
               (sl->first_inner_unit() || sl->next_select() ? 
18136
18136
                "PRIMARY" : "SIMPLE"):
18218
18218
static void print_join(THD *thd,
18219
18219
                       String *str,
18220
18220
                       List<TABLE_LIST> *tables,
18221
 
                       enum_query_type query_type __attribute__((__unused__)))
 
18221
                       enum_query_type query_type __attribute__((unused)))
18222
18222
{
18223
18223
  /* List is reversed => we should reverse it before using */
18224
18224
  List_iterator_fast<TABLE_LIST> ti(*tables);