~stewart/drizzle/haildb-2.3-athens-updates

« back to all changes in this revision

Viewing changes to drizzled/field/datetime.cc

  • Committer: lbieber
  • Date: 2010-10-05 22:23:12 UTC
  • mfrom: (1813.1.4 build)
  • Revision ID: lbieber@orisndriz08-20101005222312-weuq0ardk3gcryau
Merge Travis - 621861 - convert structs to classes
Merge Billy - 621331 - Replace use of stringstream with boost::lexical_cast
Merge Travis - 621861 = To change C structs to C++ classes in Drizzle
Merge Andrew - fix bug 653300 - Syntax error on inport of a SQL file produced by drizzledump

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 */
20
20
 
21
21
#include "config.h"
 
22
#include <boost/lexical_cast.hpp>
22
23
#include "drizzled/field/datetime.h"
23
24
#include "drizzled/error.h"
24
25
#include "drizzled/table.h"
75
76
  ASSERT_COLUMN_MARKED_FOR_WRITE;
76
77
  if (from < 0.0 || from > 99991231235959.0)
77
78
  {
78
 
    /* Convert the double to a string using stringstream */
79
 
    std::stringstream ss;
80
 
    std::string tmp;
81
 
    ss.precision(18); /* 18 places should be fine for error display of double input. */
82
 
    ss << from; ss >> tmp;
 
79
    /* Convert the double to a string using boost::lexical_cast */
 
80
    std::string tmp(boost::lexical_cast<std::string>(from));
83
81
 
84
82
    my_error(ER_INVALID_DATETIME_VALUE, MYF(ME_FATALERROR), tmp.c_str());
85
83
    return 2;
97
95
  DateTime temporal;
98
96
  if (! temporal.from_int64_t(from))
99
97
  {
100
 
    /* Convert the integer to a string using stringstream */
101
 
    std::stringstream ss;
102
 
    std::string tmp;
103
 
    ss << from; ss >> tmp;
 
98
    /* Convert the integer to a string using boost::lexical_cast */
 
99
    std::string tmp(boost::lexical_cast<std::string>(from));
104
100
 
105
101
    my_error(ER_INVALID_DATETIME_VALUE, MYF(ME_FATALERROR), tmp.c_str());
106
102
    return 2;