~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/datetime.cc

  • Committer: David Shrewsbury
  • Date: 2010-10-05 20:38:57 UTC
  • mto: (1814.1.4 build)
  • mto: This revision was merged to the branch mainline in revision 1816.
  • Revision ID: shrewsbury.dave@gmail.com-20101005203857-v2xvi0zblliyxxf8
Add options to proto files for use when generating Java source files.

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>
23
22
#include "drizzled/field/datetime.h"
24
23
#include "drizzled/error.h"
25
24
#include "drizzled/table.h"
61
60
  temporal.to_int64_t(&int_value);
62
61
 
63
62
#ifdef WORDS_BIGENDIAN
64
 
  if (getTable() && getTable()->getShare()->db_low_byte_first)
 
63
  if (getTable() && getTable()->s->db_low_byte_first)
65
64
  {
66
65
    int8store(ptr, int_value);
67
66
  }
76
75
  ASSERT_COLUMN_MARKED_FOR_WRITE;
77
76
  if (from < 0.0 || from > 99991231235959.0)
78
77
  {
79
 
    /* Convert the double to a string using boost::lexical_cast */
80
 
    std::string tmp(boost::lexical_cast<std::string>(from));
 
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;
81
83
 
82
84
    my_error(ER_INVALID_DATETIME_VALUE, MYF(ME_FATALERROR), tmp.c_str());
83
85
    return 2;
95
97
  DateTime temporal;
96
98
  if (! temporal.from_int64_t(from))
97
99
  {
98
 
    /* Convert the integer to a string using boost::lexical_cast */
99
 
    std::string tmp(boost::lexical_cast<std::string>(from));
 
100
    /* Convert the integer to a string using stringstream */
 
101
    std::stringstream ss;
 
102
    std::string tmp;
 
103
    ss << from; ss >> tmp;
100
104
 
101
105
    my_error(ER_INVALID_DATETIME_VALUE, MYF(ME_FATALERROR), tmp.c_str());
102
106
    return 2;
111
115
  temporal.to_int64_t(&int_value);
112
116
 
113
117
#ifdef WORDS_BIGENDIAN
114
 
  if (getTable() && getTable()->getShare()->db_low_byte_first)
 
118
  if (getTable() && getTable()->s->db_low_byte_first)
115
119
  {
116
120
    int8store(ptr, int_value);
117
121
  }
147
151
  temporal.to_int64_t(&int_value);
148
152
 
149
153
#ifdef WORDS_BIGENDIAN
150
 
  if (getTable() && getTable()->getShare()->db_low_byte_first)
 
154
  if (getTable() && getTable()->s->db_low_byte_first)
151
155
  {
152
156
    int8store(ptr, int_value);
153
157
  }
169
173
  ASSERT_COLUMN_MARKED_FOR_READ;
170
174
 
171
175
#ifdef WORDS_BIGENDIAN
172
 
  if (getTable() && getTable()->getShare()->db_low_byte_first)
 
176
  if (getTable() && getTable()->s->db_low_byte_first)
173
177
    j=sint8korr(ptr);
174
178
  else
175
179
#endif
188
192
  ASSERT_COLUMN_MARKED_FOR_READ;
189
193
 
190
194
#ifdef WORDS_BIGENDIAN
191
 
  if (getTable() && getTable()->getShare()->db_low_byte_first)
 
195
  if (getTable() && getTable()->s->db_low_byte_first)
192
196
    tmp=sint8korr(ptr);
193
197
  else
194
198
#endif
244
248
{
245
249
  int64_t a,b;
246
250
#ifdef WORDS_BIGENDIAN
247
 
  if (getTable() && getTable()->getShare()->db_low_byte_first)
 
251
  if (getTable() && getTable()->s->db_low_byte_first)
248
252
  {
249
253
    a=sint8korr(a_ptr);
250
254
    b=sint8korr(b_ptr);
262
266
void Field_datetime::sort_string(unsigned char *to,uint32_t )
263
267
{
264
268
#ifdef WORDS_BIGENDIAN
265
 
  if (!getTable() || !getTable()->getShare()->db_low_byte_first)
 
269
  if (!getTable() || !getTable()->s->db_low_byte_first)
266
270
  {
267
271
    to[0] = ptr[0];
268
272
    to[1] = ptr[1];