~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_table.cc

  • Committer: Stewart Smith
  • Date: 2009-06-25 05:49:42 UTC
  • mto: (1089.11.1 basic-discovery)
  • mto: This revision was merged to the branch mainline in revision 1102.
  • Revision ID: stewart@flamingspork.com-20090625054942-xr1p83d2q1i1q0fo
start passing down table proto to createTable. This enables future code cleanup, including fixing ARCHIVE embedding table definition and table proto in parser

Show diffs side-by-side

added added

removed removed

Lines of Context:
2603
2603
    @retval       1                        error
2604
2604
*/
2605
2605
bool mysql_create_like_schema_frm(Session* session, TableList* schema_table,
2606
 
                                  char *dst_path, HA_CREATE_INFO *create_info)
 
2606
                                  char *dst_path, HA_CREATE_INFO *create_info,
 
2607
                                  drizzled::message::Table* table_proto)
2607
2608
{
2608
2609
  HA_CREATE_INFO local_create_info;
2609
2610
  Alter_info alter_info;
2628
2629
    return true;
2629
2630
 
2630
2631
  local_create_info.max_rows= 0;
2631
 
  drizzled::message::Table table_proto;
2632
 
  table_proto.set_name("system_stupid_i_s_fix_nonsense");
 
2632
 
 
2633
  table_proto->set_name("system_stupid_i_s_fix_nonsense");
2633
2634
  if(tmp_table)
2634
 
    table_proto.set_type(drizzled::message::Table::TEMPORARY);
 
2635
    table_proto->set_type(drizzled::message::Table::TEMPORARY);
2635
2636
  else
2636
 
    table_proto.set_type(drizzled::message::Table::STANDARD);
 
2637
    table_proto->set_type(drizzled::message::Table::STANDARD);
2637
2638
 
2638
2639
  {
2639
2640
    drizzled::message::Table::StorageEngine *protoengine;
2640
 
    protoengine= table_proto.mutable_engine();
 
2641
    protoengine= table_proto->mutable_engine();
2641
2642
 
2642
2643
    StorageEngine *engine= local_create_info.db_type;
2643
2644
 
2645
2646
  }
2646
2647
 
2647
2648
  if (rea_create_table(session, dst_path, "system_tmp", "system_stupid_i_s_fix_nonsense",
2648
 
                       &table_proto,
 
2649
                       table_proto,
2649
2650
                       &local_create_info, alter_info.create_list,
2650
2651
                       keys, schema_table->table->s->key_info,
2651
2652
                       true))
2680
2681
  int  err;
2681
2682
  bool res= true;
2682
2683
  uint32_t not_used;
 
2684
  drizzled::message::Table src_proto;
2683
2685
 
2684
2686
  /*
2685
2687
    By opening source table we guarantee that it exists and no concurrent
2734
2736
  pthread_mutex_lock(&LOCK_open); /* We lock for CREATE TABLE LIKE to copy table definition */
2735
2737
  if (src_table->schema_table)
2736
2738
  {
2737
 
    if (mysql_create_like_schema_frm(session, src_table, dst_path, create_info))
 
2739
    if (mysql_create_like_schema_frm(session, src_table, dst_path, create_info,
 
2740
                                     &src_proto))
2738
2741
    {
2739
2742
      pthread_mutex_unlock(&LOCK_open);
2740
2743
      goto err;
2753
2756
      pthread_mutex_unlock(&LOCK_open);
2754
2757
      goto err;
2755
2758
    }
 
2759
    drizzle_read_table_proto(dst_path, &src_proto);
2756
2760
  }
2757
2761
 
2758
2762
  /*
2761
2765
    and temporary tables).
2762
2766
  */
2763
2767
 
2764
 
  err= ha_create_table(session, dst_path, db, table_name, create_info, 1);
 
2768
  err= ha_create_table(session, dst_path, db, table_name, create_info, 1,
 
2769
                       &src_proto);
2765
2770
  pthread_mutex_unlock(&LOCK_open);
2766
2771
 
2767
2772
  if (create_info->options & HA_LEX_CREATE_TMP_TABLE)