~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

Merge refactored command line using for innodb

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, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
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(type::Time::MAX_STRING_LENGTH))
 
37
  if (str->alloc(MAX_DATE_STRING_REP_LENGTH))
38
38
  {
39
39
    null_value= true;
40
40
    return (String *) NULL;
41
41
  }
42
42
 
43
43
  /* Convert the Date to a string and return it */
44
 
  size_t new_length;
45
 
  new_length= temporal.to_string(str->c_ptr(), type::Time::MAX_STRING_LENGTH);
46
 
  assert(new_length < type::Time::MAX_STRING_LENGTH);
 
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);
47
47
  str->length(new_length);
48
48
  return str;
49
49
}