~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/time/date_format.cc

  • Committer: Brian Aker
  • Date: 2010-12-18 07:46:49 UTC
  • mto: (2015.1.1 clean)
  • mto: This revision was merged to the branch mainline in revision 2018.
  • Revision ID: brian@tangent.org-20101218074649-0zz1lf2tbhopfugm
Adding in time type.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
*/
37
37
 
38
38
static bool make_date_time(String *format, DRIZZLE_TIME *l_time,
39
 
                    enum enum_drizzle_timestamp_type type, String *str)
 
39
                           enum enum_drizzle_timestamp_type type, String *str)
40
40
{
41
41
  char intbuff[15];
42
42
  uint32_t hours_i;
399
399
  {
400
400
    String *res;
401
401
    if (!(res=args[0]->val_str(str)) ||
402
 
        (str_to_time_with_warn(res->ptr(), res->length(), &l_time)))
 
402
        (str_to_time_with_warn(res->ptr(), res->length(), &l_time)))
403
403
      goto null_date;
404
404
 
405
405
    l_time.year=l_time.month=l_time.day=0;
419
419
 
420
420
  if (format == str)
421
421
    str= &value;                                // Save result here
 
422
 
422
423
  if (str->alloc(size))
423
424
    goto null_date;
424
425
 
425
426
  /* Create the result string */
426
427
  str->set_charset(collation.collation);
427
 
  if (!make_date_time(format, &l_time,
428
 
                      is_time_format ? DRIZZLE_TIMESTAMP_TIME :
429
 
                                       DRIZZLE_TIMESTAMP_DATE,
430
 
                      str))
 
428
  if (not make_date_time(format, &l_time,
 
429
                         is_time_format ? DRIZZLE_TIMESTAMP_TIME :
 
430
                         DRIZZLE_TIMESTAMP_DATE,
 
431
                         str))
431
432
    return str;
432
433
 
433
434
null_date:
434
435
  null_value=1;
 
436
 
435
437
  return 0;
436
438
}
437
439