~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/sql_select.cc

  • Committer: Patrick Galbraith
  • Date: 2008-07-28 01:47:41 UTC
  • mto: (212.1.8 codestyle)
  • mto: This revision was merged to the branch mainline in revision 217.
  • Revision ID: patg@ishvara-20080728014741-yoasv5trt1ef9rha
Renamed FIELD_TYPE to DRIZZLE_TYPE

Show diffs side-by-side

added added

removed removed

Lines of Context:
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() == FIELD_TYPE_NEWDATE) ||
10385
 
                (field->type() == FIELD_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() == FIELD_TYPE_VAR_STRING ||
10589
 
        org_field->type() == FIELD_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;
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()) == FIELD_TYPE_DATETIME ||
10657
 
        type == FIELD_TYPE_TIME || type == FIELD_TYPE_NEWDATE ||
10658
 
        type == FIELD_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 
10745
10745
Field *create_tmp_field_for_schema(THD *thd __attribute__((__unused__)),
10746
10746
                                   Item *item, TABLE *table)
10747
10747
{
10748
 
  if (item->field_type() == FIELD_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)
11157
11157
            blob_count++;
11158
11158
          }
11159
11159
          *(reg_field++)= new_field;
11160
 
          if (new_field->real_type() == FIELD_TYPE_STRING ||
11161
 
              new_field->real_type() == FIELD_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();
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() == FIELD_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
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() == FIELD_TYPE_BLOB || 
11585
 
          (*reg_field)->real_type() == FIELD_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
11588
      key_part_info->type=     (uint8_t) (*reg_field)->key_type();
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() == FIELD_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
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() == FIELD_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
      }
14222
14222
          frequent case?
14223
14223
        */
14224
14224
        if (field->binary() &&
14225
 
            field->real_type() != FIELD_TYPE_STRING &&
14226
 
            field->real_type() != FIELD_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);
16488
16488
    if (field)
16489
16489
    {
16490
16490
      enum_field_types type;
16491
 
      if ((type= field->type()) == FIELD_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 == FIELD_TYPE_VARCHAR || type == FIELD_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 == FIELD_TYPE_TIME ||
16521
 
            type == FIELD_TYPE_NEWDATE ||
16522
 
            type == FIELD_TYPE_DATETIME ||
16523
 
            type == FIELD_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
        }