~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/microtime.cc

  • Committer: Brian Aker
  • Date: 2011-01-04 06:04:30 UTC
  • mto: (2057.2.1 clean)
  • mto: This revision was merged to the branch mainline in revision 2064.
  • Revision ID: brian@tangent.org-20110104060430-arffzxxmxhhtiy23
Basic support added for microstamp as alias to epoch

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
{
60
60
}
61
61
 
62
 
/**
63
 
  Get auto-set type for TIMESTAMP field.
64
 
 
65
 
  Returns value indicating during which operations this TIMESTAMP field
66
 
  should be auto-set to current timestamp.
67
 
*/
68
 
timestamp_auto_set_type Microtime::get_auto_set_type() const
69
 
{
70
 
  switch (unireg_check)
71
 
  {
72
 
  case TIMESTAMP_DN_FIELD:
73
 
    return TIMESTAMP_AUTO_SET_ON_INSERT;
74
 
  case TIMESTAMP_UN_FIELD:
75
 
    return TIMESTAMP_AUTO_SET_ON_UPDATE;
76
 
  case TIMESTAMP_OLD_FIELD:
77
 
    /*
78
 
      Although we can have several such columns in legacy tables this
79
 
      function should be called only for first of them (i.e. the one
80
 
      having auto-set property).
81
 
    */
82
 
    assert(getTable()->timestamp_field == this);
83
 
    /* Fall-through */
84
 
  case TIMESTAMP_DNUN_FIELD:
85
 
    return TIMESTAMP_AUTO_SET_ON_BOTH;
86
 
  default:
87
 
    /*
88
 
      Normally this function should not be called for TIMESTAMPs without
89
 
      auto-set property.
90
 
    */
91
 
    assert(0);
92
 
    return TIMESTAMP_NO_AUTO_SET;
93
 
  }
94
 
}
95
 
 
96
62
int Microtime::store(const char *from,
97
63
                 uint32_t len,
98
64
                 const CHARSET_INFO * const )
261
227
 
262
228
void Microtime::sql_type(String &res) const
263
229
{
264
 
  res.set_ascii(STRING_WITH_LEN("microtime"));
 
230
  res.set_ascii(STRING_WITH_LEN("microsecond timestamp"));
265
231
}
266
232
 
267
233
void Microtime::set_time()