~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item.cc

  • Committer: Padraig
  • Date: 2009-02-13 08:26:21 UTC
  • mto: (873.2.28 devel)
  • mto: This revision was merged to the branch mainline in revision 885.
  • Revision ID: posulliv@linux-lap-20090213082621-510acwp4j58z3qzc
Updated the fix for Bug#319796.

After chatting with Monty, we came to the conclusion that there is not much
of a need for enforcing a limit on the column alias length. Thus, we removed
the check that the length is less than MAX_ALIAS_LENGTH in Item::set_name.

We also removed all references to MAX_ALIAS_NAME in the code. It was only
used as fixed-length buffer in a few utility functions as a temporary place
for performing lower-case operations. We replaced these lower-case
  operations with the transform operations and used std::string's instead of
fixed-length buffers.

Thus, we were able to resolve this bug by actually removing some code :)

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
#include <drizzled/field/timestamp.h>
52
52
#include <drizzled/field/datetime.h>
53
53
#include <drizzled/field/varstring.h>
54
 
#include <mystrings/utf8.h>
55
54
 
56
55
 
57
56
#if defined(CMATH_NAMESPACE)
524
523
  {
525
524
    size_t res_length;
526
525
    name= sql_strmake_with_convert(str, name_length= length, cs,
527
 
                                   MAX_ALIAS_NAME, system_charset_info,
 
526
                                   length, system_charset_info,
528
527
                                   &res_length);
529
528
  }
530
529
  else
531
 
  {
532
 
    if (U8_IS_LEAD(*(uint8_t*)str)) 
533
 
    {
534
 
      /* get the length of UTF8 str in characters */
535
 
      uint32_t num_chars= 0;
536
 
      for (uint32_t i= 0; str[i]; i++)
537
 
      {
538
 
        if (!U8_IS_TRAIL(str[i]))
539
 
          num_chars++;
540
 
      }
541
 
      name= sql_strmake(str, (num_chars > MAX_ALIAS_NAME) ? MAX_ALIAS_NAME : length);
542
 
    }
543
 
    else
544
 
    {
545
 
      name= sql_strmake(str, (name_length= cmin(length,(unsigned int)MAX_ALIAS_NAME)));
546
 
    }
547
 
  }
 
530
      name= sql_strmake(str, length);
548
531
}
549
532
 
550
533