~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/str.cc

  • Committer: Brian Aker
  • Date: 2009-01-28 19:37:25 UTC
  • mfrom: (779.3.11 devel)
  • Revision ID: brian@tangent.org-20090128193725-pz7g7dnp2dx0863e
Merge from Monty.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include <drizzled/session.h>
27
27
 
28
28
 
29
 
Field_str::Field_str(unsigned char *ptr_arg,uint32_t len_arg, unsigned char *null_ptr_arg,
 
29
Field_str::Field_str(unsigned char *ptr_arg,uint32_t len_arg,
 
30
                     unsigned char *null_ptr_arg,
30
31
                     unsigned char null_bit_arg, utype unireg_check_arg,
31
 
                     const char *field_name_arg, const CHARSET_INFO * const charset_arg)
 
32
                     const char *field_name_arg,
 
33
                     const CHARSET_INFO * const charset_arg)
32
34
  :Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
33
35
         unireg_check_arg, field_name_arg)
34
36
{
102
104
 
103
105
/* If one of the fields is binary and the other one isn't return 1 else 0 */
104
106
 
105
 
bool Field_str::compare_str_field_flags(Create_field *new_field, uint32_t flag_arg)
 
107
bool Field_str::compare_str_field_flags(Create_field *new_field_ptr,
 
108
                                        uint32_t flag_arg)
106
109
{
107
 
  return (((new_field->flags & (BINCMP_FLAG | BINARY_FLAG)) &&
 
110
  return (((new_field_ptr->flags & (BINCMP_FLAG | BINARY_FLAG)) &&
108
111
          !(flag_arg & (BINCMP_FLAG | BINARY_FLAG))) ||
109
 
         (!(new_field->flags & (BINCMP_FLAG | BINARY_FLAG)) &&
 
112
         (!(new_field_ptr->flags & (BINCMP_FLAG | BINARY_FLAG)) &&
110
113
          (flag_arg & (BINCMP_FLAG | BINARY_FLAG))));
111
114
}
112
115
 
113
116
 
114
 
uint32_t Field_str::is_equal(Create_field *new_field)
 
117
uint32_t Field_str::is_equal(Create_field *new_field_ptr)
115
118
{
116
 
  if (compare_str_field_flags(new_field, flags))
 
119
  if (compare_str_field_flags(new_field_ptr, flags))
117
120
    return 0;
118
121
 
119
 
  return ((new_field->sql_type == real_type()) &&
120
 
          new_field->charset == field_charset &&
121
 
          new_field->length == max_display_length());
 
122
  return ((new_field_ptr->sql_type == real_type()) &&
 
123
          new_field_ptr->charset == field_charset &&
 
124
          new_field_ptr->length == max_display_length());
122
125
}
123
126
 
124
127