~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/dtcollation.cc

Remove dead memset call.

Show diffs side-by-side

added added

removed removed

Lines of Context:
232
232
                       Item **args, uint32_t nargs, uint32_t flags,
233
233
                       int item_sep)
234
234
{
235
 
  Item **arg, *safe_args[2];
236
 
 
237
 
  memset(safe_args, 0, sizeof(safe_args));
238
 
 
239
235
  if (agg_item_collations(coll, fname, args, nargs, flags, item_sep))
240
236
    return true;
241
237
 
242
 
  /*
243
 
    For better error reporting: save the first and the second argument.
244
 
    We need this only if the the number of args is 3 or 2:
245
 
    - for a longer argument list, "Illegal mix of collations"
246
 
      doesn't display each argument's characteristics.
247
 
    - if nargs is 1, then this error cannot happen.
248
 
  */
249
 
  if (nargs >=2 && nargs <= 3)
250
 
  {
251
 
    safe_args[0]= args[0];
252
 
    safe_args[1]= args[item_sep];
253
 
  }
254
 
 
255
 
  Session *session= current_session;
256
 
  bool res= false;
257
 
  uint32_t i;
258
 
 
259
 
  for (i= 0, arg= args; i < nargs; i++, arg+= item_sep)
260
 
  {
261
 
    Item* conv;
262
 
    uint32_t dummy_offset;
263
 
    if (!String::needs_conversion(0, (*arg)->collation.collation,
264
 
                                  coll.collation,
265
 
                                  &dummy_offset))
266
 
      continue;
267
 
 
268
 
    if (!(conv= (*arg)->safe_charset_converter(coll.collation)))
269
 
    {
270
 
      if (nargs >=2 && nargs <= 3)
271
 
      {
272
 
        /* restore the original arguments for better error message */
273
 
        args[0]= safe_args[0];
274
 
        args[item_sep]= safe_args[1];
275
 
      }
276
 
      my_coll_agg_error(args, nargs, fname, item_sep);
277
 
      res= true;
278
 
      break; // we cannot return here, we need to restore "arena".
279
 
    }
280
 
    if ((*arg)->type() == Item::FIELD_ITEM)
281
 
      ((Item_field *)(*arg))->no_const_subst= 1;
282
 
    /*
283
 
      If in statement prepare, then we create a converter for two
284
 
      constant items, do it once and then reuse it.
285
 
      If we're in execution of a prepared statement, arena is NULL,
286
 
      and the conv was created in runtime memory. This can be
287
 
      the case only if the argument is a parameter marker ('?'),
288
 
      because for all true constants the charset converter has already
289
 
      been created in prepare. In this case register the change for
290
 
      rollback.
291
 
    */
292
 
    session->change_item_tree(arg, conv);
293
 
    /*
294
 
      We do not check conv->fixed, because Item_func_conv_charset which can
295
 
      be return by safe_charset_converter can't be fixed at creation
296
 
    */
297
 
    conv->fix_fields(session, arg);
298
 
  }
299
 
 
300
 
  return res;
 
238
  return false;
301
239
}
302
240
 
303
241