~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_proto_write.cc

  • Committer: Brian Aker
  • Date: 2010-12-20 10:21:10 UTC
  • mto: This revision was merged to the branch mainline in revision 2016.
  • Revision ID: brian@tangent.org-20101220102110-60oh6zarw5n9nhah
Fixing up a, somewhat, hidden unsigned type to solve a few issues around
numbers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
       filled out Field messages */
74
74
 
75
75
    if (use_existing_fields)
 
76
    {
76
77
      attribute= table_proto.mutable_field(field_number++);
 
78
    }
77
79
    else
78
80
    {
79
81
      /* Other code paths still have to fill out the proto */
102
104
      return -1;
103
105
    }
104
106
 
 
107
    if (field_arg->flags & UNSIGNED_FLAG and 
 
108
       (field_arg->sql_type == DRIZZLE_TYPE_LONGLONG or field_arg->sql_type == DRIZZLE_TYPE_LONG))
 
109
    {
 
110
      message::Table::Field::FieldConstraints *constraints= attribute->mutable_constraints();
 
111
 
 
112
      field_arg->sql_type= DRIZZLE_TYPE_LONGLONG;
 
113
      constraints->set_is_unsigned(true);
 
114
 
 
115
      if (field_arg->flags & NOT_NULL_FLAG)
 
116
      {
 
117
        constraints->set_is_nullable(false);
 
118
      }
 
119
      else
 
120
      {
 
121
        constraints->set_is_nullable(true);
 
122
      }
 
123
    }
 
124
 
105
125
    attribute->set_type(message::internalFieldTypeToFieldProtoType(field_arg->sql_type));
106
126
 
107
127
    switch (attribute->type()) {
183
203
      break;
184
204
    }
185
205
 
 
206
    std::cerr << " Look at " << message::type(use_existing_fields) << " " << message::type(parser_type) << " " << message::type(attribute->type()) << "\n";
186
207
    assert (!use_existing_fields || parser_type == attribute->type());
187
208
 
188
209
#ifdef NOTDONE