~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/create_field.cc

  • Committer: Brian Aker
  • Date: 2011-01-05 17:49:11 UTC
  • mfrom: (2046.2.3 timestamp)
  • mto: This revision was merged to the branch mainline in revision 2064.
  • Revision ID: brian@tangent.org-20110105174911-144g51mjy00bqldp
Update microtime code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
  if (!(flags & (NO_DEFAULT_VALUE_FLAG)) &&
103
103
      !(flags & AUTO_INCREMENT_FLAG) &&
104
104
      old_field->ptr && orig_field &&
105
 
      (sql_type != DRIZZLE_TYPE_TIMESTAMP ||                /* set def only if */
 
105
      (not old_field->is_timestamp() ||                /* set def only if */
106
106
       old_field->getTable()->timestamp_field != old_field ||  /* timestamp field */
107
107
       unireg_check == Field::TIMESTAMP_UN_FIELD))        /* has default val */
108
108
  {
227
227
    it is NOT NULL, not an AUTO_INCREMENT field and not a TIMESTAMP.
228
228
  */
229
229
  if (!fld_default_value && !(fld_type_modifier & AUTO_INCREMENT_FLAG) &&
230
 
      (fld_type_modifier & NOT_NULL_FLAG) && fld_type != DRIZZLE_TYPE_TIMESTAMP)
 
230
      (fld_type_modifier & NOT_NULL_FLAG) && (fld_type != DRIZZLE_TYPE_TIMESTAMP and fld_type != DRIZZLE_TYPE_MICROTIME))
 
231
  {
231
232
    flags|= NO_DEFAULT_VALUE_FLAG;
 
233
  }
232
234
 
233
235
  if (fld_length && !(length= (uint32_t) atoi(fld_length)))
234
236
    fld_length= 0;
300
302
        return(true);
301
303
      }
302
304
      break;
 
305
    case DRIZZLE_TYPE_MICROTIME:
303
306
    case DRIZZLE_TYPE_TIMESTAMP:
304
 
      if (!fld_length)
 
307
      if (not fld_length)
305
308
      {
306
 
        length= DateTime::MAX_STRING_LENGTH;
 
309
        length= MicroTimestamp::MAX_STRING_LENGTH;
307
310
      }
308
311
 
309
312
      /* This assert() should be correct due to absence of length
310
313
         specifiers for timestamp. Previous manipulation also wasn't
311
314
         ever called (from examining lcov)
312
315
      */
313
 
      assert(length == (uint32_t)DateTime::MAX_STRING_LENGTH);
 
316
      assert(length == (uint32_t)MicroTimestamp::MAX_STRING_LENGTH);
314
317
 
315
318
      flags|= UNSIGNED_FLAG;
316
319
      if (fld_default_value)
328
331
          def= 0;
329
332
        }
330
333
        else
 
334
        {
331
335
          unireg_check= (fld_on_update_value ? Field::TIMESTAMP_UN_FIELD:
332
 
                                              Field::NONE);
 
336
                         Field::NONE);
 
337
        }
333
338
      }
334
339
      else
335
340
      {