~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2010-01-22 00:53:13 UTC
  • Revision ID: brian@gaz-20100122005313-jmizcbcdi1lt4tcx
Revert db patch.

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>
21
 
#include <boost/lexical_cast.hpp>
22
 
#include <drizzled/function/time/from_days.h>
23
 
#include <drizzled/error.h>
24
 
#include <drizzled/temporal.h>
 
20
#include "config.h"
 
21
#include "drizzled/function/time/from_days.h"
 
22
#include "drizzled/error.h"
 
23
#include "drizzled/temporal.h"
25
24
 
26
25
#include <sstream>
27
26
#include <string>
28
27
 
29
 
namespace drizzled
30
 
{
31
 
 
32
28
/**
33
29
 * Interpret the first argument as a Julian Day Number and fill
34
30
 * our supplied temporal object.
35
31
 */
36
 
bool Item_func_from_days::get_temporal(Date &to)
 
32
bool Item_func_from_days::get_temporal(drizzled::Date &to)
37
33
{
38
34
  assert(fixed);
39
35
 
55
51
  if (! to.from_julian_day_number(int_value))
56
52
  {
57
53
    /* Bad input, throw an error */
58
 
    std::string tmp(boost::lexical_cast<std::string>(int_value));
 
54
    std::stringstream ss;
 
55
    std::string tmp;
 
56
    ss << int_value; ss >> tmp;
59
57
 
60
58
    my_error(ER_ARGUMENT_OUT_OF_RANGE, MYF(ME_FATALERROR), tmp.c_str(), func_name());
61
59
    return false;
62
60
  }
63
61
  return true;
64
62
}
65
 
 
66
 
} /* namespace drizzled */