~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/timestamp.cc

  • Committer: Brian Aker
  • Date: 2009-08-21 18:46:31 UTC
  • mto: This revision was merged to the branch mainline in revision 1123.
  • Revision ID: brian@gaz-20090821184631-e11gja79070fvhk4
Cleanup around page checksum removal

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* - mode: c++ c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
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 MySQL
 
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
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#ifdef USE_PRAGMA_IMPLEMENTATION
22
 
#pragma implementation                          // gcc: Class implementation
23
 
#endif
24
21
 
25
22
#include <drizzled/server_includes.h>
26
23
#include <drizzled/field/timestamp.h>
 
24
#include <drizzled/error.h>
 
25
#include <drizzled/tztime.h>
 
26
#include <drizzled/table.h>
 
27
#include <drizzled/session.h>
 
28
 
 
29
#include "drizzled/temporal.h"
 
30
 
27
31
 
28
32
/**
29
 
  TIMESTAMP type holds datetime values in range from 1970-01-01 00:00:01 UTC to 
30
 
  2038-01-01 00:00:00 UTC stored as number of seconds since Unix 
 
33
  TIMESTAMP type holds datetime values in range from 1970-01-01 00:00:01 UTC to
 
34
  2038-01-01 00:00:00 UTC stored as number of seconds since Unix
31
35
  Epoch in UTC.
32
 
  
33
 
  Up to one of timestamps columns in the table can be automatically 
 
36
 
 
37
  Up to one of timestamps columns in the table can be automatically
34
38
  set on row update and/or have NOW() as default value.
35
 
  TABLE::timestamp_field points to Field object for such timestamp with 
 
39
  TABLE::timestamp_field points to Field object for such timestamp with
36
40
  auto-set-on-update. TABLE::time_stamp holds offset in record + 1 for this
37
41
  field, and is used by handler code which performs updates required.
38
 
  
 
42
 
39
43
  Actually SQL-99 says that we should allow niladic functions (like NOW())
40
 
  as defaults for any field. Current limitations (only NOW() and only 
41
 
  for one TIMESTAMP field) are because of restricted binary .frm format 
 
44
  as defaults for any field. Current limitations (only NOW() and only
 
45
  for one TIMESTAMP field) are because of restricted binary .frm format
42
46
  and should go away in the future.
43
 
  
 
47
 
44
48
  Also because of this limitation of binary .frm format we use 5 different
45
49
  unireg_check values with TIMESTAMP field to distinguish various cases of
46
50
  DEFAULT or ON UPDATE values. These values are:
47
 
  
 
51
 
48
52
  TIMESTAMP_OLD_FIELD - old timestamp, if there was not any fields with
49
 
    auto-set-on-update (or now() as default) in this table before, then this 
50
 
    field has NOW() as default and is updated when row changes, else it is 
 
53
    auto-set-on-update (or now() as default) in this table before, then this
 
54
    field has NOW() as default and is updated when row changes, else it is
51
55
    field which has 0 as default value and is not automatically updated.
52
56
  TIMESTAMP_DN_FIELD - field with NOW() as default but not set on update
53
57
    automatically (TIMESTAMP DEFAULT NOW())
54
 
  TIMESTAMP_UN_FIELD - field which is set on update automatically but has not 
55
 
    NOW() as default (but it may has 0 or some other const timestamp as 
 
58
  TIMESTAMP_UN_FIELD - field which is set on update automatically but has not
 
59
    NOW() as default (but it may has 0 or some other const timestamp as
56
60
    default) (TIMESTAMP ON UPDATE NOW()).
57
 
  TIMESTAMP_DNUN_FIELD - field which has now() as default and is auto-set on 
 
61
  TIMESTAMP_DNUN_FIELD - field which has now() as default and is auto-set on
58
62
    update. (TIMESTAMP DEFAULT NOW() ON UPDATE NOW())
59
 
  NONE - field which is not auto-set on update with some other than NOW() 
 
63
  NONE - field which is not auto-set on update with some other than NOW()
60
64
    default value (TIMESTAMP DEFAULT 0).
61
65
 
62
 
  Note that TIMESTAMP_OLD_FIELDs are never created explicitly now, they are 
63
 
  left only for preserving ability to read old tables. Such fields replaced 
64
 
  with their newer analogs in CREATE TABLE and in SHOW CREATE TABLE. This is 
65
 
  because we want to prefer NONE unireg_check before TIMESTAMP_OLD_FIELD for 
66
 
  "TIMESTAMP DEFAULT 'Const'" field. (Old timestamps allowed such 
67
 
  specification too but ignored default value for first timestamp, which of 
 
66
  Note that TIMESTAMP_OLD_FIELDs are never created explicitly now, they are
 
67
  left only for preserving ability to read old tables. Such fields replaced
 
68
  with their newer analogs in CREATE TABLE and in SHOW CREATE TABLE. This is
 
69
  because we want to prefer NONE unireg_check before TIMESTAMP_OLD_FIELD for
 
70
  "TIMESTAMP DEFAULT 'Const'" field. (Old timestamps allowed such
 
71
  specification too but ignored default value for first timestamp, which of
68
72
  course is non-standard.) In most cases user won't notice any change, only
69
73
  exception is different behavior of old/new timestamps during ALTER TABLE.
70
74
 */
71
 
 
72
75
Field_timestamp::Field_timestamp(unsigned char *ptr_arg,
73
 
                                 uint32_t len_arg __attribute__((unused)),
 
76
                                 uint32_t ,
74
77
                                 unsigned char *null_ptr_arg, unsigned char null_bit_arg,
75
78
                                 enum utype unireg_check_arg,
76
79
                                 const char *field_name_arg,
77
 
                                 TABLE_SHARE *share,
 
80
                                 TableShare *share,
78
81
                                 const CHARSET_INFO * const cs)
79
 
  :Field_str(ptr_arg, MAX_DATETIME_WIDTH, null_ptr_arg, null_bit_arg,
 
82
  :Field_str(ptr_arg,
 
83
             drizzled::DateTime::MAX_STRING_LENGTH - 1 /* no \0 */,
 
84
             null_ptr_arg, null_bit_arg,
80
85
             unireg_check_arg, field_name_arg, cs)
81
86
{
82
87
  /* For 4.0 MYD and 4.0 InnoDB compatibility */
91
96
  }
92
97
}
93
98
 
94
 
 
95
99
Field_timestamp::Field_timestamp(bool maybe_null_arg,
96
100
                                 const char *field_name_arg,
97
101
                                 const CHARSET_INFO * const cs)
98
 
  :Field_str((unsigned char*) 0, MAX_DATETIME_WIDTH,
 
102
  :Field_str((unsigned char*) 0,
 
103
             drizzled::DateTime::MAX_STRING_LENGTH - 1 /* no \0 */,
99
104
             maybe_null_arg ? (unsigned char*) "": 0, 0,
100
105
             NONE, field_name_arg, cs)
101
106
{
105
110
      flags|= ON_UPDATE_NOW_FLAG;
106
111
}
107
112
 
108
 
 
109
113
/**
110
114
  Get auto-set type for TIMESTAMP field.
111
115
 
140
144
  }
141
145
}
142
146
 
143
 
 
144
147
int Field_timestamp::store(const char *from,
145
148
                           uint32_t len,
146
 
                           const CHARSET_INFO * const cs __attribute__((unused)))
147
 
{
148
 
  DRIZZLE_TIME l_time;
149
 
  my_time_t tmp= 0;
150
 
  int error;
151
 
  bool have_smth_to_conv;
152
 
  bool in_dst_time_gap;
153
 
  THD *thd= table ? table->in_use : current_thd;
154
 
 
155
 
  /* We don't want to store invalid or fuzzy datetime values in TIMESTAMP */
156
 
  have_smth_to_conv= (str_to_datetime(from, len, &l_time, 1, &error) >
157
 
                      DRIZZLE_TIMESTAMP_ERROR);
158
 
 
159
 
  if (error || !have_smth_to_conv)
160
 
  {
161
 
    error= 1;
162
 
    set_datetime_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED,
163
 
                         from, len, DRIZZLE_TIMESTAMP_DATETIME, 1);
164
 
  }
165
 
 
166
 
  /* Only convert a correct date (not a zero date) */
167
 
  if (have_smth_to_conv && l_time.month)
168
 
  {
169
 
    if (!(tmp= TIME_to_timestamp(thd, &l_time, &in_dst_time_gap)))
170
 
    {
171
 
      set_datetime_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN,
172
 
                           ER_WARN_DATA_OUT_OF_RANGE,
173
 
                           from, len, DRIZZLE_TIMESTAMP_DATETIME, !error);
174
 
      error= 1;
175
 
    }
176
 
    else if (in_dst_time_gap)
177
 
    {
178
 
      set_datetime_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN,
179
 
                           ER_WARN_INVALID_TIMESTAMP,
180
 
                           from, len, DRIZZLE_TIMESTAMP_DATETIME, !error);
181
 
      error= 1;
182
 
    }
183
 
  }
184
 
  store_timestamp(tmp);
185
 
  return error;
186
 
}
187
 
 
188
 
 
189
 
int Field_timestamp::store(double nr)
190
 
{
191
 
  int error= 0;
192
 
  if (nr < 0 || nr > 99991231235959.0)
193
 
  {
194
 
    set_datetime_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN,
195
 
                         ER_WARN_DATA_OUT_OF_RANGE,
196
 
                         nr, DRIZZLE_TIMESTAMP_DATETIME);
197
 
    nr= 0;                                      // Avoid overflow on buff
198
 
    error= 1;
199
 
  }
200
 
  error|= Field_timestamp::store((int64_t) rint(nr), false);
201
 
  return error;
202
 
}
203
 
 
204
 
 
205
 
int Field_timestamp::store(int64_t nr,
206
 
                           bool unsigned_val __attribute__((unused)))
207
 
{
208
 
  DRIZZLE_TIME l_time;
209
 
  my_time_t timestamp= 0;
210
 
  int error;
211
 
  bool in_dst_time_gap;
212
 
  THD *thd= table ? table->in_use : current_thd;
213
 
 
214
 
  /* We don't want to store invalid or fuzzy datetime values in TIMESTAMP */
215
 
  int64_t tmp= number_to_datetime(nr, &l_time, (thd->variables.sql_mode &
216
 
                                                 MODE_NO_ZERO_DATE), &error);
217
 
  if (tmp == INT64_C(-1))
218
 
  {
219
 
    error= 2;
220
 
  }
221
 
 
222
 
  if (!error && tmp)
223
 
  {
224
 
    if (!(timestamp= TIME_to_timestamp(thd, &l_time, &in_dst_time_gap)))
225
 
    {
226
 
      set_datetime_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN,
227
 
                           ER_WARN_DATA_OUT_OF_RANGE,
228
 
                           nr, DRIZZLE_TIMESTAMP_DATETIME, 1);
229
 
      error= 1;
230
 
    }
231
 
    if (in_dst_time_gap)
232
 
    {
233
 
      set_datetime_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN,
234
 
                           ER_WARN_INVALID_TIMESTAMP,
235
 
                           nr, DRIZZLE_TIMESTAMP_DATETIME, 1);
236
 
      error= 1;
237
 
    }
238
 
  } else if (error)
239
 
    set_datetime_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN,
240
 
                         ER_WARN_DATA_TRUNCATED,
241
 
                         nr, DRIZZLE_TIMESTAMP_DATETIME, 1);
242
 
 
243
 
  store_timestamp(timestamp);
244
 
  return error;
 
149
                           const CHARSET_INFO * const )
 
150
{
 
151
  drizzled::Timestamp temporal;
 
152
 
 
153
  ASSERT_COLUMN_MARKED_FOR_WRITE;
 
154
 
 
155
  if (! temporal.from_string(from, (size_t) len))
 
156
  {
 
157
    my_error(ER_INVALID_UNIX_TIMESTAMP_VALUE, MYF(ME_FATALERROR), from);
 
158
    return 1;
 
159
  }
 
160
 
 
161
  time_t tmp;
 
162
  temporal.to_time_t(&tmp);
 
163
 
 
164
  store_timestamp(tmp);
 
165
  return 0;
 
166
}
 
167
 
 
168
int Field_timestamp::store(double from)
 
169
{
 
170
  ASSERT_COLUMN_MARKED_FOR_WRITE;
 
171
 
 
172
  if (from < 0 || from > 99991231235959.0)
 
173
  {
 
174
    /* Convert the double to a string using stringstream */
 
175
    std::stringstream ss;
 
176
    std::string tmp;
 
177
    ss.precision(18); /* 18 places should be fine for error display of double input. */
 
178
    ss << from; ss >> tmp;
 
179
 
 
180
    my_error(ER_INVALID_UNIX_TIMESTAMP_VALUE, MYF(ME_FATALERROR), tmp.c_str());
 
181
    return 2;
 
182
  }
 
183
  return Field_timestamp::store((int64_t) rint(from), false);
 
184
}
 
185
 
 
186
int Field_timestamp::store(int64_t from, bool)
 
187
{
 
188
  ASSERT_COLUMN_MARKED_FOR_WRITE;
 
189
 
 
190
  /* 
 
191
   * Try to create a DateTime from the supplied integer.  Throw an error
 
192
   * if unable to create a valid DateTime.  
 
193
   */
 
194
  drizzled::Timestamp temporal;
 
195
  if (! temporal.from_int64_t(from))
 
196
  {
 
197
    /* Convert the integer to a string using stringstream */
 
198
    std::stringstream ss;
 
199
    std::string tmp;
 
200
    ss << from; ss >> tmp;
 
201
 
 
202
    my_error(ER_INVALID_UNIX_TIMESTAMP_VALUE, MYF(ME_FATALERROR), tmp.c_str());
 
203
    return 2;
 
204
  }
 
205
 
 
206
  time_t tmp;
 
207
  temporal.to_time_t(&tmp);
 
208
 
 
209
  store_timestamp(tmp);
 
210
  return 0;
245
211
}
246
212
 
247
213
double Field_timestamp::val_real(void)
252
218
int64_t Field_timestamp::val_int(void)
253
219
{
254
220
  uint32_t temp;
255
 
  DRIZZLE_TIME time_tmp;
256
 
  THD  *thd= table ? table->in_use : current_thd;
257
 
 
258
 
  thd->time_zone_used= 1;
 
221
 
 
222
  ASSERT_COLUMN_MARKED_FOR_READ;
 
223
 
259
224
#ifdef WORDS_BIGENDIAN
260
225
  if (table && table->s->db_low_byte_first)
261
 
    temp=uint4korr(ptr);
 
226
    temp= uint4korr(ptr);
262
227
  else
263
228
#endif
264
 
    longget(temp,ptr);
265
 
 
266
 
  if (temp == 0L)                               // No time
267
 
    return(0);                                  /* purecov: inspected */
268
 
  
269
 
  thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp, (my_time_t)temp);
270
 
  
271
 
  return time_tmp.year * INT64_C(10000000000) +
272
 
         time_tmp.month * INT64_C(100000000) +
273
 
         time_tmp.day * 1000000 + time_tmp.hour * 10000 +
274
 
         time_tmp.minute * 100 + time_tmp.second;
 
229
    longget(temp, ptr);
 
230
 
 
231
  drizzled::Timestamp temporal;
 
232
  (void) temporal.from_time_t((time_t) temp);
 
233
 
 
234
  /* We must convert into a "timestamp-formatted integer" ... */
 
235
  int64_t result;
 
236
  temporal.to_int64_t(&result);
 
237
  return result;
275
238
}
276
239
 
277
 
 
278
 
String *Field_timestamp::val_str(String *val_buffer, String *val_ptr)
 
240
String *Field_timestamp::val_str(String *val_buffer, String *)
279
241
{
280
 
  uint32_t temp, temp2;
281
 
  DRIZZLE_TIME time_tmp;
282
 
  THD *thd= table ? table->in_use : current_thd;
 
242
  uint32_t temp;
283
243
  char *to;
284
 
 
285
 
  val_buffer->alloc(field_length+1);
286
 
  to= (char*) val_buffer->ptr();
287
 
  val_buffer->length(field_length);
288
 
 
289
 
  thd->time_zone_used= 1;
 
244
  int to_len= field_length + 1;
 
245
 
 
246
  val_buffer->alloc(to_len);
 
247
  to= (char *) val_buffer->ptr();
 
248
 
290
249
#ifdef WORDS_BIGENDIAN
291
250
  if (table && table->s->db_low_byte_first)
292
 
    temp=uint4korr(ptr);
 
251
    temp= uint4korr(ptr);
293
252
  else
294
253
#endif
295
 
    longget(temp,ptr);
296
 
 
297
 
  if (temp == 0L)
298
 
  {                                   /* Zero time is "000000" */
299
 
    val_ptr->set(STRING_WITH_LEN("0000-00-00 00:00:00"), &my_charset_bin);
300
 
    return val_ptr;
301
 
  }
302
 
  val_buffer->set_charset(&my_charset_bin);     // Safety
303
 
  
304
 
  thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp,(my_time_t)temp);
305
 
 
306
 
  temp= time_tmp.year % 100;
307
 
  if (temp < YY_PART_YEAR - 1)
308
 
  {
309
 
    *to++= '2';
310
 
    *to++= '0';
311
 
  }
312
 
  else
313
 
  {
314
 
    *to++= '1';
315
 
    *to++= '9';
316
 
  }
317
 
  temp2=temp/10; temp=temp-temp2*10;
318
 
  *to++= (char) ('0'+(char) (temp2));
319
 
  *to++= (char) ('0'+(char) (temp));
320
 
  *to++= '-';
321
 
  temp=time_tmp.month;
322
 
  temp2=temp/10; temp=temp-temp2*10;
323
 
  *to++= (char) ('0'+(char) (temp2));
324
 
  *to++= (char) ('0'+(char) (temp));
325
 
  *to++= '-';
326
 
  temp=time_tmp.day;
327
 
  temp2=temp/10; temp=temp-temp2*10;
328
 
  *to++= (char) ('0'+(char) (temp2));
329
 
  *to++= (char) ('0'+(char) (temp));
330
 
  *to++= ' ';
331
 
  temp=time_tmp.hour;
332
 
  temp2=temp/10; temp=temp-temp2*10;
333
 
  *to++= (char) ('0'+(char) (temp2));
334
 
  *to++= (char) ('0'+(char) (temp));
335
 
  *to++= ':';
336
 
  temp=time_tmp.minute;
337
 
  temp2=temp/10; temp=temp-temp2*10;
338
 
  *to++= (char) ('0'+(char) (temp2));
339
 
  *to++= (char) ('0'+(char) (temp));
340
 
  *to++= ':';
341
 
  temp=time_tmp.second;
342
 
  temp2=temp/10; temp=temp-temp2*10;
343
 
  *to++= (char) ('0'+(char) (temp2));
344
 
  *to++= (char) ('0'+(char) (temp));
345
 
  *to= 0;
 
254
    longget(temp, ptr);
 
255
 
 
256
  val_buffer->set_charset(&my_charset_bin);     /* Safety */
 
257
 
 
258
  drizzled::Timestamp temporal;
 
259
  (void) temporal.from_time_t((time_t) temp);
 
260
 
 
261
  int rlen;
 
262
  rlen= temporal.to_string(to, to_len);
 
263
  assert(rlen < to_len);
 
264
 
 
265
  val_buffer->length(rlen);
346
266
  return val_buffer;
347
267
}
348
268
 
349
 
 
350
 
bool Field_timestamp::get_date(DRIZZLE_TIME *ltime, uint32_t fuzzydate)
 
269
bool Field_timestamp::get_date(DRIZZLE_TIME *ltime, uint32_t)
351
270
{
352
 
  long temp;
353
 
  THD *thd= table ? table->in_use : current_thd;
354
 
  thd->time_zone_used= 1;
 
271
  uint32_t temp;
 
272
 
355
273
#ifdef WORDS_BIGENDIAN
356
274
  if (table && table->s->db_low_byte_first)
357
 
    temp=uint4korr(ptr);
 
275
    temp= uint4korr(ptr);
358
276
  else
359
277
#endif
360
 
    longget(temp,ptr);
361
 
  if (temp == 0L)
362
 
  {                                   /* Zero time is "000000" */
363
 
    if (fuzzydate & TIME_NO_ZERO_DATE)
364
 
      return 1;
365
 
    memset(ltime, 0, sizeof(*ltime));
366
 
  }
367
 
  else
368
 
  {
369
 
    thd->variables.time_zone->gmt_sec_to_TIME(ltime, (my_time_t)temp);
370
 
  }
 
278
    longget(temp, ptr);
 
279
  
 
280
  memset(ltime, 0, sizeof(*ltime));
 
281
 
 
282
  drizzled::Timestamp temporal;
 
283
  (void) temporal.from_time_t((time_t) temp);
 
284
 
 
285
  /* @TODO Goodbye the below code when DRIZZLE_TIME is finally gone.. */
 
286
 
 
287
  ltime->time_type= DRIZZLE_TIMESTAMP_DATETIME;
 
288
  ltime->year= temporal.years();
 
289
  ltime->month= temporal.months();
 
290
  ltime->day= temporal.days();
 
291
  ltime->hour= temporal.hours();
 
292
  ltime->minute= temporal.minutes();
 
293
  ltime->second= temporal.seconds();
 
294
 
371
295
  return 0;
372
296
}
373
297
 
376
300
  return Field_timestamp::get_date(ltime,0);
377
301
}
378
302
 
379
 
 
380
 
bool Field_timestamp::send_binary(Protocol *protocol)
381
 
{
382
 
  DRIZZLE_TIME tm;
383
 
  Field_timestamp::get_date(&tm, 0);
384
 
  return protocol->store(&tm);
385
 
}
386
 
 
387
 
 
388
303
int Field_timestamp::cmp(const unsigned char *a_ptr, const unsigned char *b_ptr)
389
304
{
390
305
  int32_t a,b;
404
319
}
405
320
 
406
321
 
407
 
void Field_timestamp::sort_string(unsigned char *to,uint32_t length __attribute__((unused)))
 
322
void Field_timestamp::sort_string(unsigned char *to,uint32_t )
408
323
{
409
324
#ifdef WORDS_BIGENDIAN
410
325
  if (!table || !table->s->db_low_byte_first)
424
339
  }
425
340
}
426
341
 
427
 
 
428
342
void Field_timestamp::sql_type(String &res) const
429
343
{
430
344
  res.set_ascii(STRING_WITH_LEN("timestamp"));
431
345
}
432
346
 
433
 
 
434
347
void Field_timestamp::set_time()
435
348
{
436
 
  THD *thd= table ? table->in_use : current_thd;
437
 
  long tmp= (long) thd->query_start();
 
349
  Session *session= table ? table->in_use : current_session;
 
350
  long tmp= (long) session->query_start();
438
351
  set_notnull();
439
352
  store_timestamp(tmp);
440
353
}
441
354
 
 
355
void Field_timestamp::set_default()
 
356
{
 
357
  if (table->timestamp_field == this &&
 
358
      unireg_check != TIMESTAMP_UN_FIELD)
 
359
    set_time();
 
360
  else
 
361
    Field::set_default();
 
362
}
 
363
 
 
364
long Field_timestamp::get_timestamp(bool *null_value)
 
365
{
 
366
  if ((*null_value= is_null()))
 
367
    return 0;
 
368
#ifdef WORDS_BIGENDIAN
 
369
  if (table && table->s->db_low_byte_first)
 
370
    return sint4korr(ptr);
 
371
#endif
 
372
  long tmp;
 
373
  longget(tmp,ptr);
 
374
  return tmp;
 
375
}
 
376
 
 
377
void Field_timestamp::store_timestamp(time_t timestamp)
 
378
{
 
379
#ifdef WORDS_BIGENDIAN
 
380
  if (table && table->s->db_low_byte_first)
 
381
  {
 
382
    int4store(ptr,timestamp);
 
383
  }
 
384
  else
 
385
#endif
 
386
    longstore(ptr,(uint32_t) timestamp);
 
387
}