~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/fdecimal.cc

  • Committer: Eric Herman
  • Date: 2008-12-06 19:42:46 UTC
  • mto: (656.1.6 devel)
  • mto: This revision was merged to the branch mainline in revision 665.
  • Revision ID: eric@mysql.com-20081206194246-5cdexuu81i366eek
removed trailing whitespace with simple script:

for file in $(find . -name "*.c") $(find . -name "*.cc") $(find . -name "*.h"); do ruby -pe 'gsub(/\s+$/, $/)' < $file > $file.out; mv $file.out $file; done;

Show diffs side-by-side

added added

removed removed

Lines of Context:
302
302
   Save the field metadata for new decimal fields.
303
303
 
304
304
   Saves the precision in the first byte and decimals() in the second
305
 
   byte of the field metadata array at index of *metadata_ptr and 
 
305
   byte of the field metadata array at index of *metadata_ptr and
306
306
   *(metadata_ptr + 1).
307
307
 
308
308
   @param   metadata_ptr   First byte of field metadata
318
318
 
319
319
 
320
320
/**
321
 
   Returns the number of bytes field uses in row-based replication 
 
321
   Returns the number of bytes field uses in row-based replication
322
322
   row packed size.
323
323
 
324
324
   This method is used in row-based replication to determine the number
332
332
uint32_t Field_new_decimal::pack_length_from_metadata(uint32_t field_metadata)
333
333
{
334
334
  uint32_t const source_precision= (field_metadata >> 8U) & 0x00ff;
335
 
  uint32_t const source_decimal= field_metadata & 0x00ff; 
336
 
  uint32_t const source_size= my_decimal_get_binary_size(source_precision, 
 
335
  uint32_t const source_decimal= field_metadata & 0x00ff;
 
336
  uint32_t const source_size= my_decimal_get_binary_size(source_precision,
337
337
                                                     source_decimal);
338
338
  return (source_size);
339
339
}
343
343
   Check to see if field size is compatible with destination.
344
344
 
345
345
   This method is used in row-based replication to verify that the slave's
346
 
   field size is less than or equal to the master's field size. The 
 
346
   field size is less than or equal to the master's field size. The
347
347
   encoded field metadata (from the master or source) is decoded and compared
348
 
   to the size of this field (the slave or destination). 
 
348
   to the size of this field (the slave or destination).
349
349
 
350
350
   @param   field_metadata   Encoded size in field metadata
351
351
 
356
356
{
357
357
  int compatible= 0;
358
358
  uint32_t const source_precision= (field_metadata >> 8U) & 0x00ff;
359
 
  uint32_t const source_decimal= field_metadata & 0x00ff; 
360
 
  uint32_t const source_size= my_decimal_get_binary_size(source_precision, 
 
359
  uint32_t const source_decimal= field_metadata & 0x00ff;
 
360
  uint32_t const source_size= my_decimal_get_binary_size(source_precision,
361
361
                                                     source_decimal);
362
362
  uint32_t const destination_size= row_pack_length();
363
363
  compatible= (source_size <= destination_size);
371
371
uint32_t Field_new_decimal::is_equal(Create_field *new_field)
372
372
{
373
373
  return ((new_field->sql_type == real_type()) &&
374
 
          ((new_field->flags & UNSIGNED_FLAG) == 
 
374
          ((new_field->flags & UNSIGNED_FLAG) ==
375
375
           (uint) (flags & UNSIGNED_FLAG)) &&
376
376
          ((new_field->flags & AUTO_INCREMENT_FLAG) ==
377
377
           (uint) (flags & AUTO_INCREMENT_FLAG)) &&
385
385
 
386
386
   This method is used to unpack a decimal or numeric field from a master
387
387
   whose size of the field is less than that of the slave.
388
 
  
 
388
 
389
389
   @param   to         Destination of the data
390
390
   @param   from       Source of the data
391
391
   @param   param_data Precision (upper) and decimal (lower) values