~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/timestamp.cc

Merge Stewart

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
                                 const char *field_name_arg,
80
80
                                 TableShare *share,
81
81
                                 const CHARSET_INFO * const cs)
82
 
  :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,
83
85
             unireg_check_arg, field_name_arg, cs)
84
86
{
85
87
  /* For 4.0 MYD and 4.0 InnoDB compatibility */
97
99
Field_timestamp::Field_timestamp(bool maybe_null_arg,
98
100
                                 const char *field_name_arg,
99
101
                                 const CHARSET_INFO * const cs)
100
 
  :Field_str((unsigned char*) 0, MAX_DATETIME_WIDTH,
 
102
  :Field_str((unsigned char*) 0,
 
103
             drizzled::DateTime::MAX_STRING_LENGTH - 1 /* no \0 */,
101
104
             maybe_null_arg ? (unsigned char*) "": 0, 0,
102
105
             NONE, field_name_arg, cs)
103
106
{
230
233
{
231
234
  uint32_t temp;
232
235
  char *to;
 
236
  int to_len= field_length + 1;
233
237
 
234
 
  val_buffer->alloc(field_length + 1);
 
238
  val_buffer->alloc(to_len);
235
239
  to= (char *) val_buffer->ptr();
236
240
 
237
241
#ifdef WORDS_BIGENDIAN
245
249
 
246
250
  drizzled::Timestamp temporal;
247
251
  (void) temporal.from_time_t((time_t) temp);
248
 
  size_t to_len;
249
 
 
250
 
  temporal.to_string(to, &to_len);
251
 
  val_buffer->length((uint32_t) to_len);
 
252
 
 
253
  int rlen;
 
254
  rlen= temporal.to_string(to, to_len);
 
255
  assert(rlen < to_len);
 
256
 
 
257
  val_buffer->length(rlen);
252
258
  return val_buffer;
253
259
}
254
260