~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/join.cc

  • Committer: Brian Aker
  • Date: 2010-12-16 02:16:37 UTC
  • mto: This revision was merged to the branch mainline in revision 1999.
  • Revision ID: brian@tangent.org-20101216021637-owmmneuy57ddhcn3
uuid type code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3016
3016
      case REAL_RESULT:
3017
3017
        key_length+= sizeof(double);
3018
3018
        break;
3019
 
 
3020
3019
      case INT_RESULT:
3021
3020
        key_length+= sizeof(int64_t);
3022
3021
        break;
3023
 
 
3024
3022
      case DECIMAL_RESULT:
3025
3023
        key_length+= my_decimal_get_binary_size(group_item->max_length -
3026
3024
                                                (group_item->decimals ? 1 : 0),
3027
3025
                                                group_item->decimals);
3028
3026
        break;
3029
 
 
3030
3027
      case STRING_RESULT:
3031
 
        {
3032
 
          enum enum_field_types type= group_item->field_type();
 
3028
      {
 
3029
        enum enum_field_types type= group_item->field_type();
 
3030
        /*
 
3031
          As items represented as DATE/TIME fields in the group buffer
 
3032
          have STRING_RESULT result type, we increase the length
 
3033
          by 8 as maximum pack length of such fields.
 
3034
        */
 
3035
        if (type == DRIZZLE_TYPE_DATE ||
 
3036
            type == DRIZZLE_TYPE_DATETIME ||
 
3037
            type == DRIZZLE_TYPE_TIMESTAMP)
 
3038
        {
 
3039
          key_length+= 8;
 
3040
        }
 
3041
        else
 
3042
        {
3033
3043
          /*
3034
 
            As items represented as DATE/TIME fields in the group buffer
3035
 
            have STRING_RESULT result type, we increase the length
3036
 
            by 8 as maximum pack length of such fields.
 
3044
            Group strings are taken as varstrings and require an length field.
 
3045
            A field is not yet created by create_tmp_field()
 
3046
            and the sizes should match up.
3037
3047
          */
3038
 
          if (type == DRIZZLE_TYPE_DATE ||
3039
 
              type == DRIZZLE_TYPE_DATETIME ||
3040
 
              type == DRIZZLE_TYPE_TIMESTAMP)
3041
 
          {
3042
 
            key_length+= 8;
3043
 
          }
3044
 
          else
3045
 
          {
3046
 
            /*
3047
 
              Group strings are taken as varstrings and require an length field.
3048
 
              A field is not yet created by create_tmp_field()
3049
 
              and the sizes should match up.
3050
 
            */
3051
 
            key_length+= group_item->max_length + HA_KEY_BLOB_LENGTH;
3052
 
          }
3053
 
          break;
 
3048
          key_length+= group_item->max_length + HA_KEY_BLOB_LENGTH;
3054
3049
        }
3055
 
 
3056
 
      case ROW_RESULT:
 
3050
        break;
 
3051
      }
 
3052
      default:
3057
3053
        /* This case should never be choosen */
3058
3054
        assert(0);
3059
3055
        my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATALERROR));
3060
3056
      }
3061
3057
    }
3062
 
 
3063
3058
    parts++;
3064
 
 
3065
3059
    if (group_item->maybe_null)
3066
3060
      null_parts++;
3067
3061
  }
3068
 
 
3069
3062
  join->tmp_table_param.group_length=key_length+null_parts;
3070
3063
  join->tmp_table_param.group_parts=parts;
3071
3064
  join->tmp_table_param.group_null_parts=null_parts;