~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Olaf van der Spek
  • Date: 2011-04-20 09:27:49 UTC
  • mto: This revision was merged to the branch mainline in revision 2285.
  • Revision ID: olafvdspek@gmail.com-20110420092749-hw1q9rfj1pumc2no
Session Cache

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
 
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
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
 
#include "drizzled/function/time/date.h"
23
 
#include "drizzled/temporal.h"
 
22
#include <drizzled/function/time/date.h>
 
23
#include <drizzled/temporal.h>
24
24
 
25
25
namespace drizzled
26
26
{
34
34
  if (! get_temporal(temporal))
35
35
    return (String *) NULL; /* get_temporal throws error. */
36
36
 
37
 
  if (str->alloc(MAX_DATE_STRING_REP_LENGTH))
38
 
  {
39
 
    null_value= true;
40
 
    return (String *) NULL;
41
 
  }
 
37
  str->alloc(type::Time::MAX_STRING_LENGTH);
42
38
 
43
39
  /* Convert the Date to a string and return it */
44
 
  int new_length;
45
 
  new_length= temporal.to_string(str->c_ptr(), MAX_DATE_STRING_REP_LENGTH);
46
 
  assert(new_length < MAX_DATE_STRING_REP_LENGTH);
 
40
  size_t new_length;
 
41
  new_length= temporal.to_string(str->c_ptr(), type::Time::MAX_STRING_LENGTH);
 
42
  assert(new_length < type::Time::MAX_STRING_LENGTH);
47
43
  str->length(new_length);
48
44
  return str;
49
45
}