~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_table.cc

  • Committer: Jay Pipes
  • Date: 2009-02-04 15:44:25 UTC
  • mfrom: (829 drizzle)
  • mto: This revision was merged to the branch mainline in revision 830.
  • Revision ID: jpipes@serialcoder-20090204154425-th8xfk2ujz2y8xwg
Merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
                          HA_CREATE_INFO *create_info,
79
79
                          Alter_info *alter_info);
80
80
 
 
81
static void set_table_default_charset(Session *session,
 
82
                                      HA_CREATE_INFO *create_info, char *db)
 
83
{
 
84
  /*
 
85
    If the table character set was not given explicitly,
 
86
    let's fetch the database default character set and
 
87
    apply it to the table.
 
88
  */
 
89
  if (!create_info->default_table_charset)
 
90
  {
 
91
    HA_CREATE_INFO db_info;
 
92
 
 
93
    load_db_opt_by_name(session, db, &db_info);
 
94
 
 
95
    create_info->default_table_charset= db_info.default_table_charset;
 
96
  }
 
97
}
 
98
 
81
99
/*
82
100
  Translate a file name to a table name (WL #1324).
83
101
 
1639
1657
  return(false);
1640
1658
}
1641
1659
 
1642
 
 
1643
 
/*
1644
 
  Set table default charset, if not set
1645
 
 
1646
 
  SYNOPSIS
1647
 
    set_table_default_charset()
1648
 
    create_info        Table create information
1649
 
 
1650
 
  DESCRIPTION
1651
 
    If the table character set was not given explicitely,
1652
 
    let's fetch the database default character set and
1653
 
    apply it to the table.
1654
 
*/
1655
 
 
1656
 
static void set_table_default_charset(Session *session,
1657
 
                                      HA_CREATE_INFO *create_info, char *db)
1658
 
{
1659
 
  /*
1660
 
    If the table character set was not given explicitly,
1661
 
    let's fetch the database default character set and
1662
 
    apply it to the table.
1663
 
  */
1664
 
  if (!create_info->default_table_charset)
1665
 
  {
1666
 
    HA_CREATE_INFO db_info;
1667
 
 
1668
 
    load_db_opt_by_name(session, db, &db_info);
1669
 
 
1670
 
    create_info->default_table_charset= db_info.default_table_charset;
1671
 
  }
1672
 
}
1673
 
 
1674
 
 
1675
1660
/*
1676
1661
  Extend long VARCHAR fields to blob & prepare field if it's a blob
1677
1662
 
3008
2993
      goto err;
3009
2994
    }
3010
2995
  }
3011
 
  else if (my_copy(src_path, dst_path, MYF(MY_DONT_OVERWRITE_FILE)))
 
2996
  else
3012
2997
  {
3013
 
    if (my_errno == ENOENT)
3014
 
      my_error(ER_BAD_DB_ERROR,MYF(0),db);
3015
 
    else
3016
 
      my_error(ER_CANT_CREATE_FILE,MYF(0),dst_path,my_errno);
3017
 
    pthread_mutex_unlock(&LOCK_open);
3018
 
    goto err;
 
2998
    int frmcopyr= my_copy(src_path, dst_path, MYF(MY_DONT_OVERWRITE_FILE));
 
2999
 
 
3000
    string dfesrc(src_path);
 
3001
    string dfedst(dst_path);
 
3002
 
 
3003
    dfesrc.replace(dfesrc.find(".frm"), 4, ".dfe" );
 
3004
    dfedst.replace(dfedst.find(".frm"), 4, ".dfe" );
 
3005
 
 
3006
    int dfecopyr= my_copy(dfesrc.c_str(), dfedst.c_str(),
 
3007
                          MYF(MY_DONT_OVERWRITE_FILE));
 
3008
 
 
3009
    if(frmcopyr || dfecopyr) // FIXME: should handle only one fail.
 
3010
    {
 
3011
      if (my_errno == ENOENT)
 
3012
        my_error(ER_BAD_DB_ERROR,MYF(0),db);
 
3013
      else
 
3014
        my_error(ER_CANT_CREATE_FILE,MYF(0),dst_path,my_errno);
 
3015
      pthread_mutex_unlock(&LOCK_open);
 
3016
      goto err;
 
3017
    }
3019
3018
  }
3020
3019
 
3021
3020
  /*
4669
4668
 
4670
4669
  set_table_default_charset(session, create_info, db);
4671
4670
 
4672
 
 
4673
4671
  if (session->variables.old_alter_table
4674
4672
      || (table->s->db_type() != create_info->db_type)
4675
4673
     )