~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/create_field.cc

  • Committer: Stewart Smith
  • Date: 2010-11-03 03:27:09 UTC
  • mto: (1902.1.1 build) (1910.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1903.
  • Revision ID: stewart@flamingspork.com-20101103032709-oyvfrc6eb8fzj0mr
fix docs warning: docs/unlock.rst:2: (WARNING/2) Title underline too short.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
#include "drizzled/field/datetime.h"
45
45
#include "drizzled/field/varstring.h"
46
46
#include "drizzled/temporal.h"
 
47
#include "drizzled/item/string.h"
47
48
 
48
49
#include <algorithm>
49
50
 
69
70
 
70
71
  /* Fix if the original table had 4 byte pointer blobs */
71
72
  if (flags & BLOB_FLAG)
72
 
    pack_length= (pack_length - old_field->table->s->blob_ptr_size + portable_sizeof_char_ptr);
 
73
    pack_length= (pack_length - old_field->getTable()->getShare()->blob_ptr_size + portable_sizeof_char_ptr);
73
74
 
74
75
  switch (sql_type) 
75
76
  {
94
95
  def= 0;
95
96
  char_length= length;
96
97
 
97
 
  if (!(flags & (NO_DEFAULT_VALUE_FLAG )) &&
 
98
  if (!(flags & (NO_DEFAULT_VALUE_FLAG)) &&
 
99
      !(flags & AUTO_INCREMENT_FLAG) &&
98
100
      old_field->ptr && orig_field &&
99
101
      (sql_type != DRIZZLE_TYPE_TIMESTAMP ||                /* set def only if */
100
 
       old_field->table->timestamp_field != old_field ||  /* timestamp field */
 
102
       old_field->getTable()->timestamp_field != old_field ||  /* timestamp field */
101
103
       unireg_check == Field::TIMESTAMP_UN_FIELD))        /* has default val */
102
104
  {
103
105
    ptrdiff_t diff;
104
106
 
105
107
    /* Get the value from default_values */
106
 
    diff= (ptrdiff_t) (orig_field->table->s->default_values - orig_field->table->record[0]);
 
108
    diff= (ptrdiff_t) (orig_field->getTable()->getDefaultValues() - orig_field->getTable()->getInsertRecord());
107
109
    orig_field->move_field_offset(diff);        // Points now at default_values
108
110
    if (! orig_field->is_real_null())
109
111
    {
113
115
      pos= (char*) memory::sql_strmake(res->ptr(), res->length());
114
116
      def= new Item_string(pos, res->length(), charset);
115
117
    }
116
 
    orig_field->move_field_offset(-diff);       // Back to record[0]
 
118
    orig_field->move_field_offset(-diff);       // Back to getInsertRecord()
117
119
  }
118
120
}
119
121
 
164
166
  interval= 0;
165
167
  charset= &my_charset_bin;
166
168
  decimals= decimals_arg & FIELDFLAG_MAX_DEC;
167
 
  pack_flag= 0;
168
169
 
169
170
  if (! maybe_null)
170
171
    flags= NOT_NULL_FLAG;
355
356
    case DRIZZLE_TYPE_ENUM:
356
357
      {
357
358
        /* Should be safe. */
358
 
        pack_length= get_enum_pack_length(fld_interval_list->elements);
 
359
        pack_length= 4;
359
360
 
360
361
        List_iterator<String> it(*fld_interval_list);
361
362
        String *tmp;