~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/timestamp.cc

  • Committer: tdavies
  • Date: 2010-10-05 03:25:08 UTC
  • mto: (1816.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1817.
  • Revision ID: tdavies@molly-20101005032508-pd1cg5nmxziov9wv
change in file: ../drizzled/base.h. Converted C structs key_range and KEY_MULTI_RANGE to C++ classes

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
 
21
 
21
22
#include "config.h"
22
 
#include <boost/lexical_cast.hpp>
23
23
#include <drizzled/field/timestamp.h>
24
24
#include <drizzled/error.h>
25
25
#include <drizzled/tztime.h>
100
100
  {
101
101
    /* This timestamp has auto-update */
102
102
    share->setTimestampField(this);
103
 
    flags|= FUNCTION_DEFAULT_FLAG;
 
103
    flags|= TIMESTAMP_FLAG;
104
104
    if (unireg_check != TIMESTAMP_DN_FIELD)
105
105
      flags|= ON_UPDATE_NOW_FLAG;
106
106
  }
187
187
    std::stringstream ss;
188
188
    std::string tmp;
189
189
    ss.precision(18); /* 18 places should be fine for error display of double input. */
190
 
    ss << from; 
191
 
    ss >> tmp;
 
190
    ss << from; ss >> tmp;
192
191
 
193
192
    my_error(ER_INVALID_UNIX_TIMESTAMP_VALUE, MYF(ME_FATALERROR), tmp.c_str());
194
193
    return 2;
207
206
  Timestamp temporal;
208
207
  if (! temporal.from_int64_t(from))
209
208
  {
210
 
    /* Convert the integer to a string using boost::lexical_cast */
211
 
    std::string tmp(boost::lexical_cast<std::string>(from));
 
209
    /* Convert the integer to a string using stringstream */
 
210
    std::stringstream ss;
 
211
    std::string tmp;
 
212
    ss << from; ss >> tmp;
212
213
 
213
214
    my_error(ER_INVALID_UNIX_TIMESTAMP_VALUE, MYF(ME_FATALERROR), tmp.c_str());
214
215
    return 2;
233
234
  ASSERT_COLUMN_MARKED_FOR_READ;
234
235
 
235
236
#ifdef WORDS_BIGENDIAN
236
 
  if (getTable() && getTable()->getShare()->db_low_byte_first)
 
237
  if (getTable() && getTable()->s->db_low_byte_first)
237
238
    temp= uint8korr(ptr);
238
239
  else
239
240
#endif
258
259
  to= (char *) val_buffer->ptr();
259
260
 
260
261
#ifdef WORDS_BIGENDIAN
261
 
  if (getTable() && getTable()->getShare()->db_low_byte_first)
 
262
  if (getTable() && getTable()->s->db_low_byte_first)
262
263
    temp= uint8korr(ptr);
263
264
  else
264
265
#endif
282
283
  uint64_t temp;
283
284
 
284
285
#ifdef WORDS_BIGENDIAN
285
 
  if (getTable() && getTable()->getShare()->db_low_byte_first)
 
286
  if (getTable() && getTable()->s->db_low_byte_first)
286
287
    temp= uint8korr(ptr);
287
288
  else
288
289
#endif
315
316
{
316
317
  int64_t a,b;
317
318
#ifdef WORDS_BIGENDIAN
318
 
  if (getTable() && getTable()->getShare()->db_low_byte_first)
 
319
  if (getTable() && getTable()->s->db_low_byte_first)
319
320
  {
320
321
    a=sint8korr(a_ptr);
321
322
    b=sint8korr(b_ptr);
333
334
void Field_timestamp::sort_string(unsigned char *to,uint32_t )
334
335
{
335
336
#ifdef WORDS_BIGENDIAN
336
 
  if (!getTable() || !getTable()->getShare()->db_low_byte_first)
 
337
  if (!getTable() || !getTable()->s->db_low_byte_first)
337
338
  {
338
339
    to[0] = ptr[0];
339
340
    to[1] = ptr[1];
385
386
  if ((*null_value= is_null()))
386
387
    return 0;
387
388
#ifdef WORDS_BIGENDIAN
388
 
  if (getTable() && getTable()->getShare()->db_low_byte_first)
 
389
  if (getTable() && getTable()->s->db_low_byte_first)
389
390
    return sint8korr(ptr);
390
391
#endif
391
392
  int64_t tmp;
396
397
void Field_timestamp::store_timestamp(int64_t timestamp)
397
398
{
398
399
#ifdef WORDS_BIGENDIAN
399
 
  if (getTable() && getTable()->getShare()->db_low_byte_first)
 
400
  if (getTable() && getTable()->s->db_low_byte_first)
400
401
  {
401
402
    int8store(ptr, timestamp);
402
403
  }