~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/str/make_set.cc

  • Committer: Mark Atwood
  • Date: 2011-08-11 03:05:03 UTC
  • mfrom: (2385.1.12 refactor4)
  • Revision ID: me@mark.atwood.name-20110811030503-rp9xjihc5x3y0x4q
mergeĀ lp:~olafvdspek/drizzle/refactor4

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
 
20
#include <config.h>
21
21
 
22
22
#include <drizzled/function/str/make_set.h>
23
23
#include <drizzled/session.h>
24
24
 
25
 
namespace drizzled
26
 
{
 
25
namespace drizzled {
27
26
 
28
27
void Item_func_make_set::update_used_tables()
29
28
{
87
86
            result=res;                         // Use original string
88
87
          else
89
88
          {
90
 
            if (tmp_str.copy(*res))             // Don't use 'str'
91
 
              return &my_empty_string;
 
89
            tmp_str.copy(*res);
92
90
            result= &tmp_str;
93
91
          }
94
92
        }
96
94
        {
97
95
          if (result != &tmp_str)
98
96
          {                                     // Copy data to tmp_str
99
 
            if (tmp_str.alloc(result->length()+res->length()+1) ||
100
 
                tmp_str.copy(*result))
101
 
              return &my_empty_string;
 
97
      tmp_str.alloc(result->length()+res->length()+1);
 
98
            tmp_str.copy(*result);
102
99
            result= &tmp_str;
103
100
          }
104
 
          if (tmp_str.append(STRING_WITH_LEN(","), &my_charset_bin) || tmp_str.append(*res))
105
 
            return &my_empty_string;
 
101
          tmp_str.append(STRING_WITH_LEN(","));
 
102
    tmp_str.append(*res);
106
103
        }
107
104
      }
108
105
    }
116
113
  Item *new_item= item->transform(transformer, arg);
117
114
  if (!new_item)
118
115
    return 0;
119
 
 
120
 
  /*
121
 
    Session::change_item_tree() should be called only if the tree was
122
 
    really transformed, i.e. when a new item has been created.
123
 
    Otherwise we'll be allocating a lot of unnecessary memory for
124
 
    change records at each execution.
125
 
  */
126
 
  if (item != new_item)
127
 
    session.change_item_tree(&item, new_item);
128
 
 
 
116
  item= new_item;
129
117
  return Item_str_func::transform(transformer, arg);
130
118
}
131
119
 
132
120
 
133
 
void Item_func_make_set::print(String *str, enum_query_type query_type)
 
121
void Item_func_make_set::print(String *str)
134
122
{
135
123
  str->append(STRING_WITH_LEN("make_set("));
136
 
  item->print(str, query_type);
 
124
  item->print(str);
137
125
  if (arg_count)
138
126
  {
139
127
    str->append(',');
140
 
    print_args(str, 0, query_type);
 
128
    print_args(str, 0);
141
129
  }
142
130
  str->append(')');
143
131
}