~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_select.cc

  • Committer: Brian Aker
  • Date: 2008-07-31 19:40:12 UTC
  • Revision ID: brian@tangent.org-20080731194012-oat11oy5vombrb1b
First pass of CHAR removal.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11157
11157
            blob_count++;
11158
11158
          }
11159
11159
          *(reg_field++)= new_field;
11160
 
          if (new_field->real_type() == DRIZZLE_TYPE_STRING ||
11161
 
              new_field->real_type() == DRIZZLE_TYPE_VARCHAR)
 
11160
          if (new_field->real_type() == DRIZZLE_TYPE_VARCHAR)
11162
11161
          {
11163
11162
            string_count++;
11164
11163
            string_total_length+= new_field->pack_length();
11406
11405
    recinfo->length=length;
11407
11406
    if (field->flags & BLOB_FLAG)
11408
11407
      recinfo->type= (int) FIELD_BLOB;
11409
 
    else if (use_packed_rows &&
11410
 
             field->real_type() == DRIZZLE_TYPE_STRING &&
11411
 
             length >= MIN_STRING_LENGTH_TO_PACK_ROWS)
11412
 
      recinfo->type=FIELD_SKIP_ENDSPACE;
11413
11408
    else
11414
11409
      recinfo->type=FIELD_NORMAL;
11415
11410
    if (!--hidden_field_count)
11547
11542
      key_part_info->null_bit=0;
11548
11543
      key_part_info->offset=hidden_null_pack_length;
11549
11544
      key_part_info->length=null_pack_length;
11550
 
      key_part_info->field= new Field_string(table->record[0],
11551
 
                                             (uint32_t) key_part_info->length,
11552
 
                                             (uchar*) 0,
11553
 
                                             (uint) 0,
11554
 
                                             Field::NONE,
11555
 
                                             NullS, &my_charset_bin);
 
11545
      key_part_info->field= new Field_varstring(table->record[0],
 
11546
                                                (uint32_t) key_part_info->length,
 
11547
                                                0,
 
11548
                                                (uchar*) 0,
 
11549
                                                (uint) 0,
 
11550
                                                Field::NONE,
 
11551
                                                NullS, 
 
11552
                                                table->s,
 
11553
                                                &my_charset_bin);
11556
11554
      if (!key_part_info->field)
11557
11555
        goto err;
11558
11556
      key_part_info->field->init(table);
11671
11669
  uint *blob_field;
11672
11670
  MI_COLUMNDEF *recinfo, *start_recinfo;
11673
11671
  bool using_unique_constraint=false;
11674
 
  bool use_packed_rows= false;
11675
11672
  Field *field, *key_field;
11676
11673
  uint blob_count, null_pack_length, null_count;
11677
11674
  uchar *null_flags;
11758
11755
  /* Create the field */
11759
11756
  {
11760
11757
    /*
11761
 
      For the sake of uniformity, always use Field_varstring (altough we could
11762
 
      use Field_string for shorter keys)
 
11758
      For the sake of uniformity, always use Field_varstring.
11763
11759
    */
11764
11760
    field= new Field_varstring(uniq_tuple_length_arg, false, "rowids", share,
11765
11761
                               &my_charset_bin);
11857
11853
    recinfo->length=length;
11858
11854
    if (field->flags & BLOB_FLAG)
11859
11855
      recinfo->type= (int) FIELD_BLOB;
11860
 
    else if (use_packed_rows &&
11861
 
             field->real_type() == DRIZZLE_TYPE_STRING &&
11862
 
             length >= MIN_STRING_LENGTH_TO_PACK_ROWS)
11863
 
      recinfo->type=FIELD_SKIP_ENDSPACE;
11864
11856
    else
11865
11857
      recinfo->type=FIELD_NORMAL;
11866
11858
 
12178
12170
      else
12179
12171
      {
12180
12172
        seg->type= keyinfo->key_part[i].type;
12181
 
        /* Tell handler if it can do suffic space compression */
12182
 
        if (field->real_type() == DRIZZLE_TYPE_STRING &&
12183
 
            keyinfo->key_part[i].length > 4)
12184
 
          seg->flag|= HA_SPACE_PACK;
12185
12173
      }
12186
12174
      if (!(field->flags & NOT_NULL_FLAG))
12187
12175
      {
14222
14210
          frequent case?
14223
14211
        */
14224
14212
        if (field->binary() &&
14225
 
            field->real_type() != DRIZZLE_TYPE_STRING &&
14226
14213
            field->real_type() != DRIZZLE_TYPE_VARCHAR &&
14227
14214
            field->decimals() == 0)
14228
14215
        {
16728
16715
        /*
16729
16716
          We need to allocate one extra byte for null handling and
16730
16717
          another extra byte to not get warnings from purify in
16731
 
          Field_string::val_int
 
16718
          Field_varstring::val_int
16732
16719
        */
16733
16720
        if (!(tmp= (uchar*) sql_alloc(field->pack_length()+2)))
16734
16721
          goto err;