~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_proto_write.cc

  • Committer: Stewart Smith
  • Date: 2009-05-19 04:22:01 UTC
  • mto: (991.1.9 for-brian)
  • mto: This revision was merged to the branch mainline in revision 1033.
  • Revision ID: stewart@flamingspork.com-20090519042201-gwp8gqfknmypbhfi
Put table_name into table proto in parser, and use that when creating table proto file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
 
70
70
  engine->set_name(create_info->db_type->getName());
71
71
 
72
 
  table_proto->set_name(table_name);
 
72
  assert(strcmp(table_proto->name().c_str(),table_name)==0);
73
73
  table_proto->set_type(drizzled::message::Table::STANDARD);
74
74
 
75
75
  while ((field_arg= it++))
584
584
static int create_table_proto_file(const char *file_name,
585
585
                                   const char *db,
586
586
                                   const char *table_name,
 
587
                                   drizzled::message::Table *table_proto,
587
588
                                   HA_CREATE_INFO *create_info,
588
589
                                   List<Create_field> &create_fields,
589
590
                                   uint32_t keys,
590
591
                                   KEY *key_info)
591
592
{
592
 
  drizzled::message::Table table_proto;
593
593
  string new_path(file_name);
594
594
  string file_ext = ".dfe";
595
595
 
596
 
  if(fill_table_proto(&table_proto, table_name, create_fields, create_info,
 
596
  if(fill_table_proto(table_proto, table_name, create_fields, create_info,
597
597
                      keys, key_info))
598
598
    return -1;
599
599
 
613
613
  google::protobuf::io::ZeroCopyOutputStream* output=
614
614
    new google::protobuf::io::FileOutputStream(fd);
615
615
 
616
 
  if (!table_proto.SerializeToZeroCopyStream(output))
 
616
  if (!table_proto->SerializeToZeroCopyStream(output))
617
617
  {
618
618
    delete output;
619
619
    close(fd);
648
648
 
649
649
int rea_create_table(Session *session, const char *path,
650
650
                     const char *db, const char *table_name,
 
651
                     drizzled::message::Table *table_proto,
651
652
                     HA_CREATE_INFO *create_info,
652
653
                     List<Create_field> &create_fields,
653
654
                     uint32_t keys, KEY *key_info, handler *file,
659
660
  /* For is_like we return once the file has been created */
660
661
  if (is_like)
661
662
  {
662
 
    if (create_table_proto_file(path, db, table_name, create_info,
 
663
    if (create_table_proto_file(path, db, table_name, table_proto,
 
664
                                create_info,
663
665
                                create_fields, keys, key_info)!=0)
664
666
      return 1;
665
667
 
668
670
  /* Here we need to build the full frm from the path */
669
671
  else
670
672
  {
671
 
    if (create_table_proto_file(path, db, table_name, create_info,
 
673
    if (create_table_proto_file(path, db, table_name, table_proto,
 
674
                                create_info,
672
675
                                create_fields, keys, key_info))
673
676
      return 1;
674
677
  }