~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/timestamp.cc

Merge Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
#include "drizzled/temporal.h"
34
34
 
 
35
namespace drizzled
 
36
{
 
37
 
35
38
/**
36
39
  TIMESTAMP type holds datetime values in range from 1970-01-01 00:00:01 UTC to
37
40
  2038-01-01 00:00:00 UTC stored as number of seconds since Unix
84
87
                                 TableShare *share,
85
88
                                 const CHARSET_INFO * const cs)
86
89
  :Field_str(ptr_arg,
87
 
             drizzled::DateTime::MAX_STRING_LENGTH - 1 /* no \0 */,
 
90
             DateTime::MAX_STRING_LENGTH - 1 /* no \0 */,
88
91
             null_ptr_arg,
89
92
             null_bit_arg,
90
93
             field_name_arg,
107
110
                                 const char *field_name_arg,
108
111
                                 const CHARSET_INFO * const cs)
109
112
  :Field_str((unsigned char*) NULL,
110
 
             drizzled::DateTime::MAX_STRING_LENGTH - 1 /* no \0 */,
 
113
             DateTime::MAX_STRING_LENGTH - 1 /* no \0 */,
111
114
             maybe_null_arg ? (unsigned char*) "": 0,
112
115
             0,
113
116
             field_name_arg,
157
160
                           uint32_t len,
158
161
                           const CHARSET_INFO * const )
159
162
{
160
 
  drizzled::Timestamp temporal;
 
163
  Timestamp temporal;
161
164
 
162
165
  ASSERT_COLUMN_MARKED_FOR_WRITE;
163
166
 
200
203
   * Try to create a DateTime from the supplied integer.  Throw an error
201
204
   * if unable to create a valid DateTime.  
202
205
   */
203
 
  drizzled::Timestamp temporal;
 
206
  Timestamp temporal;
204
207
  if (! temporal.from_int64_t(from))
205
208
  {
206
209
    /* Convert the integer to a string using stringstream */
237
240
#endif
238
241
    longget(temp, ptr);
239
242
 
240
 
  drizzled::Timestamp temporal;
 
243
  Timestamp temporal;
241
244
  (void) temporal.from_time_t((time_t) temp);
242
245
 
243
246
  /* We must convert into a "timestamp-formatted integer" ... */
264
267
 
265
268
  val_buffer->set_charset(&my_charset_bin);     /* Safety */
266
269
 
267
 
  drizzled::Timestamp temporal;
 
270
  Timestamp temporal;
268
271
  (void) temporal.from_time_t((time_t) temp);
269
272
 
270
273
  int rlen;
288
291
  
289
292
  memset(ltime, 0, sizeof(*ltime));
290
293
 
291
 
  drizzled::Timestamp temporal;
 
294
  Timestamp temporal;
292
295
  (void) temporal.from_time_t((time_t) temp);
293
296
 
294
297
  /* @TODO Goodbye the below code when DRIZZLE_TIME is finally gone.. */
394
397
#endif
395
398
    longstore(ptr,(uint32_t) timestamp);
396
399
}
 
400
 
 
401
} /* namespace drizzled */