~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/datetime.cc

  • Committer: lbieber
  • Date: 2010-10-05 21:14:30 UTC
  • mfrom: (1775.5.2 bug621331)
  • mto: This revision was merged to the branch mainline in revision 1814.
  • Revision ID: lbieber@orisndriz08-20101005211430-xmy19fcls25swctl
Merge Billy - fix bug 621331 - Replace use of stringstream with boost::lexical_cast

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;