~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_proto.cc

  • Committer: patrick crews
  • Date: 2011-03-15 12:12:09 UTC
  • mfrom: (1099.4.216 drizzle)
  • Revision ID: gleebix@gmail.com-20110315121209-8g2tkf31w0rx9ter
Tags: 2011.03.12
Updated translations

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include <string>
31
31
#include <fstream>
32
32
#include <fcntl.h>
33
 
#include <drizzled/message/schema.pb.h>
34
 
#include <drizzled/message/table.pb.h>
 
33
#include <drizzled/message/schema.h>
 
34
#include <drizzled/message/table.h>
35
35
#include <google/protobuf/io/zero_copy_stream.h>
36
36
#include <google/protobuf/io/zero_copy_stream_impl.h>
37
37
#include <google/protobuf/message.h>
45
45
 
46
46
namespace drizzled {
47
47
 
48
 
bool fill_table_proto(message::Table &table_proto,
 
48
static
 
49
bool fill_table_proto(identifier::Table::const_reference identifier,
 
50
                      message::Table &table_proto,
49
51
                      List<CreateField> &create_fields,
50
52
                      HA_CREATE_INFO *create_info,
51
53
                      uint32_t keys,
55
57
  List<CreateField>::iterator it(create_fields.begin());
56
58
  message::Table::TableOptions *table_options= table_proto.mutable_options();
57
59
 
58
 
  if (create_fields.elements > MAX_FIELDS)
 
60
  if (create_fields.size() > MAX_FIELDS)
59
61
  {
60
62
    my_error(ER_TOO_MANY_FIELDS, MYF(0), ER(ER_TOO_MANY_FIELDS));
61
63
    return true;
64
66
  assert(strcmp(table_proto.engine().name().c_str(),
65
67
                create_info->db_type->getName().c_str())==0);
66
68
 
 
69
  message::schema::shared_ptr schema_message= plugin::StorageEngine::getSchemaDefinition(identifier);
 
70
 
 
71
  if (schema_message and not message::is_replicated(*schema_message))
 
72
  {
 
73
    message::set_is_replicated(table_proto, false);
 
74
  }
 
75
 
67
76
  int field_number= 0;
68
77
  bool use_existing_fields= table_proto.field_size() > 0;
69
78
  while ((field_arg= it++))
583
592
                      uint32_t keys, KeyInfo *key_info)
584
593
{
585
594
  assert(table_proto.has_name());
586
 
  if (fill_table_proto(table_proto, create_fields, create_info,
 
595
 
 
596
  if (fill_table_proto(identifier,
 
597
                       table_proto, create_fields, create_info,
587
598
                       keys, key_info))
588
599
  {
589
600
    return false;