~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to drizzled/table_proto_write.cc

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-12-21 16:39:40 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20101221163940-c1pfo1jjvx7909xq
Tags: 2010.12.06-0ubuntu1
* New upstream release.
* Added libaio-dev build depend for InnoDB.
* Removed libpcre patch - applied upstream.

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 */
81
83
 
82
84
      if (field_arg->flags & NOT_NULL_FLAG)
83
85
      {
84
 
        message::Table::Field::FieldConstraints *constraints;
 
86
        attribute->mutable_constraints()->set_is_nullable(false);
 
87
      }
 
88
      else
 
89
      {
 
90
        attribute->mutable_constraints()->set_is_nullable(true);
 
91
      }
85
92
 
86
 
        constraints= attribute->mutable_constraints();
87
 
        constraints->set_is_nullable(false);
 
93
      if (field_arg->flags & UNSIGNED_FLAG and 
 
94
          (field_arg->sql_type == DRIZZLE_TYPE_LONGLONG or field_arg->sql_type == DRIZZLE_TYPE_LONG))
 
95
      {
 
96
        field_arg->sql_type= DRIZZLE_TYPE_LONGLONG;
 
97
        attribute->mutable_constraints()->set_is_unsigned(true);
88
98
      }
89
99
 
90
100
      attribute->set_name(field_arg->field_name);
102
112
      return -1;
103
113
    }
104
114
 
 
115
    if (field_arg->flags & UNSIGNED_FLAG and 
 
116
       (field_arg->sql_type == DRIZZLE_TYPE_LONGLONG or field_arg->sql_type == DRIZZLE_TYPE_LONG))
 
117
    {
 
118
      message::Table::Field::FieldConstraints *constraints= attribute->mutable_constraints();
 
119
 
 
120
      field_arg->sql_type= DRIZZLE_TYPE_LONGLONG;
 
121
      constraints->set_is_unsigned(true);
 
122
 
 
123
      if (field_arg->flags & NOT_NULL_FLAG)
 
124
      {
 
125
        constraints->set_is_nullable(false);
 
126
      }
 
127
      else
 
128
      {
 
129
        constraints->set_is_nullable(true);
 
130
      }
 
131
    }
 
132
 
105
133
    attribute->set_type(message::internalFieldTypeToFieldProtoType(field_arg->sql_type));
106
134
 
107
135
    switch (attribute->type()) {