~posulliv/drizzle/optimizer-style-cleanup

« back to all changes in this revision

Viewing changes to drizzled/field/decimal.cc

  • Committer: Padraig O'Sullivan
  • Date: 2010-03-15 14:05:26 UTC
  • mfrom: (1237.9.99 staging)
  • Revision ID: osullivan.padraig@gmail.com-20100315140526-opbgwdwn6tfecdkq
MergeĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
356
356
}
357
357
 
358
358
 
359
 
/**
360
 
  Check to see if field size is compatible with destination.
361
 
 
362
 
  This method is used in row-based replication to verify that the slave's
363
 
  field size is less than or equal to the master's field size. The
364
 
  encoded field metadata (from the master or source) is decoded and compared
365
 
  to the size of this field (the slave or destination).
366
 
 
367
 
  @param   field_metadata   Encoded size in field metadata
368
 
 
369
 
  @retval 0 if this field's size is < the source field's size
370
 
  @retval 1 if this field's size is >= the source field's size
371
 
*/
372
 
int Field_decimal::compatible_field_size(uint32_t field_metadata)
373
 
{
374
 
  int compatible= 0;
375
 
  uint32_t const source_precision= (field_metadata >> 8U) & 0x00ff;
376
 
  uint32_t const source_decimal= field_metadata & 0x00ff;
377
 
  uint32_t const source_size= my_decimal_get_binary_size(source_precision,
378
 
                                                         source_decimal);
379
 
  uint32_t const destination_size= row_pack_length();
380
 
  compatible= (source_size <= destination_size);
381
 
  if (compatible)
382
 
    compatible= (source_precision <= precision) &&
383
 
      (source_decimal <= decimals());
384
 
  return (compatible);
385
 
}
386
 
 
387
 
 
388
359
uint32_t Field_decimal::is_equal(CreateField *new_field_ptr)
389
360
{
390
361
  return ((new_field_ptr->sql_type == real_type()) &&