~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table.cc

  • Committer: Brian Aker
  • Date: 2009-11-11 15:49:59 UTC
  • mto: This revision was merged to the branch mainline in revision 1212.
  • Revision ID: brian@gaz-20091111154959-jqu64e48gp9ig3tp
Updating with my change to to DECIMAL from NEWDECIMAL and Stewart's update
for protobuf to correctly store DECIMAL

Show diffs side-by-side

added added

removed removed

Lines of Context:
161
161
    field_type= DRIZZLE_TYPE_VARCHAR;
162
162
    break;
163
163
  case message::Table::Field::DECIMAL:
164
 
    field_type= DRIZZLE_TYPE_NEWDECIMAL;
 
164
    field_type= DRIZZLE_TYPE_DECIMAL;
165
165
    break;
166
166
  case message::Table::Field::ENUM:
167
167
    field_type= DRIZZLE_TYPE_ENUM;
231
231
                                    system_charset_info);
232
232
    }
233
233
    break;
234
 
  case DRIZZLE_TYPE_NEWDECIMAL:
 
234
  case DRIZZLE_TYPE_DECIMAL:
235
235
    default_item= new Item_decimal(default_value->c_str(),
236
236
                                   default_value->length(),
237
237
                                   system_charset_info);
525
525
        interval_parts+= field_options.field_value_size();
526
526
      }
527
527
      break;
528
 
    case DRIZZLE_TYPE_NEWDECIMAL:
 
528
    case DRIZZLE_TYPE_DECIMAL:
529
529
      {
530
530
        message::Table::Field::NumericFieldOptions fo= pfield.numeric_options();
531
531
 
775
775
    }
776
776
 
777
777
    uint8_t decimals= 0;
778
 
    if (field_type == DRIZZLE_TYPE_NEWDECIMAL
 
778
    if (field_type == DRIZZLE_TYPE_DECIMAL
779
779
        || field_type == DRIZZLE_TYPE_DOUBLE)
780
780
    {
781
781
      message::Table::Field::NumericFieldOptions fo= pfield.numeric_options();
820
820
    temp_table.s->db_low_byte_first= 1; //Cursor->low_byte_first();
821
821
    temp_table.s->blob_ptr_size= portable_sizeof_char_ptr;
822
822
 
 
823
    uint32_t field_length;
 
824
 
 
825
    switch (field_type)
 
826
    {
 
827
    case DRIZZLE_TYPE_DOUBLE:
 
828
    {
 
829
      message::Table::Field::NumericFieldOptions fo= pfield.numeric_options();
 
830
      if (!fo.has_precision() && !fo.has_scale())
 
831
      {
 
832
        field_length= DBL_DIG+7;
 
833
      }
 
834
      else
 
835
      {
 
836
        field_length= fo.precision();
 
837
      }
 
838
      if (field_length < decimals &&
 
839
          decimals != NOT_FIXED_DEC)
 
840
      {
 
841
        my_error(ER_M_BIGGER_THAN_D, MYF(0), pfield.name().c_str());
 
842
        error= 1;
 
843
        goto err;
 
844
      }
 
845
      break;
 
846
    }
 
847
    case DRIZZLE_TYPE_DECIMAL:
 
848
    {
 
849
      message::Table::Field::NumericFieldOptions fo= pfield.numeric_options();
 
850
 
 
851
      field_length= my_decimal_precision_to_length(fo.precision(), fo.scale(),
 
852
                                                   false);
 
853
      break;
 
854
    }
 
855
    default:
 
856
      field_length= pfield.options().length();
 
857
      break;
 
858
    }
 
859
 
823
860
    Field* f= make_field(share,
824
861
                         &share->mem_root,
825
862
                         record + field_offsets[fieldnr] + data_offset,
826
 
                         pfield.options().length(),
 
863
                         field_length,
827
864
                         pfield.has_constraints() && pfield.constraints().is_nullable() ? true : false,
828
865
                         null_pos,
829
866
                         null_bit_pos,