List:Commits« Previous MessageNext Message »
From:Sergei Golubchik Date:November 12 2007 6:22pm
Subject:Re: bk commit into 5.1 tree (gluh:1.2605) BUG#25629
View as plain text  
Hi!

On Nov 09, gluh@stripped wrote:
> ChangeSet@stripped, 2007-11-09 09:09:39+04:00, gluh@stripped +3 -0
>   Bug#25629 CREATE TABLE LIKE does not work with INFORMATION_SCHEMA
>   added new func mysql_create_like_schema_frm() which creates frm file
>   based on I_S table

hm, frankly, I wouldn't bother trying to support CREATE TABLE LIKE for
INFORMATION_SCHEMA tables.
 
>   sql/sql_table.cc@stripped, 2007-11-09 09:09:37+04:00, gluh@stripped +58 -1
>     Bug#25629 CREATE TABLE LIKE does not work with INFORMATION_SCHEMA
>     added new func mysql_create_like_schema_frm() which creates frm
>     file based on I_S table
> 
> diff -Nrup a/sql/sql_table.cc b/sql/sql_table.cc
> --- a/sql/sql_table.cc	2007-10-23 13:33:18 +05:00
> +++ b/sql/sql_table.cc	2007-11-09 09:09:37 +04:00
> @@ -4517,6 +4517,55 @@ bool mysql_preload_keys(THD* thd, TABLE_
>  }
>  
> +
> +/**
> +  @brief          Create frm file based on I_S table
> +
> +  @param[in]      thd                      thread handler
> +  @param[in]      schema_table             I_S table           
> +  @param[in]      dst_path                 path where frm should be created
> +  @param[in]      create_info              Create info
> +
> +  @return         Operation status
> +    @retval       0                        success
> +    @retval       1                        error
> +*/
> +
> +
> +bool mysql_create_like_schema_frm(THD* thd, TABLE_LIST* schema_table,
> +                                  char *dst_path, HA_CREATE_INFO *create_info)
> +{
> +  HA_CREATE_INFO local_create_info;
> +  Alter_info alter_info;
> +  bool tmp_table= (create_info->options & HA_LEX_CREATE_TMP_TABLE);
> +  uint keys= schema_table->table->s->keys;
> +  uint db_options= 0;
> +  DBUG_ENTER("mysql_create_like_schema_frm");
> +
> +  bzero((char*) &local_create_info, sizeof(local_create_info));
> +  local_create_info.db_type= schema_table->table->s->db_type();
> +  local_create_info.row_type= schema_table->table->s->row_type;
> +  local_create_info.default_table_charset=default_charset_info;
> +  alter_info.flags= (ALTER_CHANGE_COLUMN | ALTER_RECREATE);
> +  schema_table->table->use_all_columns();
> +  if (mysql_prepare_alter_table(thd, schema_table->table,
> +                                &local_create_info, &alter_info))
> +    DBUG_RETURN(1);
> +  if (mysql_prepare_create_table(thd, &local_create_info, &alter_info,
> +                                 tmp_table, &db_options,
> +                                 schema_table->table->file,
> +                                 &schema_table->table->s->key_info,
> &keys, 0))
> +    DBUG_RETURN(1);

why do you need prepare_alter and prepare_create ?
to get alter_info and local_create_info structures filled ?

let's discuss it on irc...

> +  local_create_info.max_rows= 0;
> +  if (mysql_create_frm(thd, dst_path, NullS, NullS,
> +                       &local_create_info, alter_info.create_list,
> +                       keys, schema_table->table->s->key_info,
> +                       schema_table->table->file))
> +    DBUG_RETURN(1);
> +  DBUG_RETURN(0);
> +}

Regards / Mit vielen Grüssen,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  Principal Software Developer
/_/  /_/\_, /___/\___\_\___/  MySQL GmbH, Dachauer Str. 37, D-80335 München
       <___/                  Geschäftsführer: Kaj Arnö - HRB
München 162140
Thread
bk commit into 5.1 tree (gluh:1.2605) BUG#25629gluh9 Nov
  • Re: bk commit into 5.1 tree (gluh:1.2605) BUG#25629Sergei Golubchik12 Nov
  • Re: bk commit into 5.1 tree (gluh:1.2605) BUG#25629Sergei Golubchik19 Nov