~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_table.cc

  • Committer: Brian Aker
  • Date: 2008-11-16 02:03:36 UTC
  • mfrom: (584.2.8 drizzle-nofrm)
  • Revision ID: brian@tangent.org-20081116020336-89horp2vrgqoqv0f
Merge stewert

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
  uint32_t errors;
68
68
  uint32_t res;
69
69
 
70
 
  if (!memcmp(from, tmp_file_prefix, tmp_file_prefix_length))
 
70
  if (!memcmp(from, TMP_FILE_PREFIX, TMP_FILE_PREFIX_LENGTH))
71
71
  {
72
72
    /* Temporary table name. */
73
73
    res= (my_stpncpy(to, from, to_length) - to);
211
211
 
212
212
  char *p= my_stpncpy(buff, drizzle_tmpdir, bufflen);
213
213
  snprintf(p, bufflen - (p - buff), "/%s%lx_%"PRIx64"_%x%s",
214
 
              tmp_file_prefix, current_pid,
215
 
              session->thread_id, session->tmp_table++, reg_ext);
 
214
           TMP_FILE_PREFIX, current_pid,
 
215
           session->thread_id, session->tmp_table++, reg_ext);
216
216
 
217
217
  if (lower_case_table_names)
218
218
  {
501
501
      if (!error || error == ENOENT || error == HA_ERR_NO_SUCH_TABLE)
502
502
      {
503
503
        int new_error;
 
504
 
 
505
        /* for some weird-ass reason, we ignore the return code here
 
506
           and things work. */
 
507
        delete_table_proto_file(path);
 
508
 
504
509
        /* Delete the table definition file */
505
510
        my_stpcpy(end,reg_ext);
506
511
        if (!(new_error=my_delete(path,MYF(MY_WME))))
615
620
                                         db, table_name, reg_ext, flags);
616
621
  if (my_delete(path,MYF(0)))
617
622
    error= 1; /* purecov: inspected */
 
623
 
618
624
  path[path_length - reg_ext_length]= '\0'; // Remove reg_ext
 
625
 
 
626
  error|= delete_table_proto_file(path);
 
627
 
619
628
  return(ha_delete_table(current_session, base, path, db, table_name, 0) ||
620
629
              error);
621
630
}
2108
2117
      if (file)
2109
2118
        file->ha_rename_table(to_base, from_base);
2110
2119
    }
 
2120
 
 
2121
    if(!(flags & NO_FRM_RENAME)
 
2122
       && rename_table_proto_file(from_base, to_base))
 
2123
    {
 
2124
      error= errno;
 
2125
      rename_file_ext(to, from, reg_ext);
 
2126
      if (file)
 
2127
        file->ha_rename_table(to_base, from_base);
 
2128
    }
2111
2129
  }
2112
2130
  delete file;
2113
2131
  if (error == HA_ERR_WRONG_COMMAND)
3754
3772
  char path[FN_REFLEN];
3755
3773
 
3756
3774
  snprintf(tmp_name, sizeof(tmp_name), "%s-%lx_%"PRIx64,
3757
 
           tmp_file_prefix, current_pid, session->thread_id);
 
3775
           TMP_FILE_PREFIX, current_pid, session->thread_id);
3758
3776
  /* Safety fix for InnoDB */
3759
3777
  if (lower_case_table_names)
3760
3778
    my_casedn_str(files_charset_info, tmp_name);
4385
4403
  handlerton *old_db_type, *new_db_type, *save_old_db_type;
4386
4404
  legacy_db_type table_type;
4387
4405
 
 
4406
  new_name_buff[0]= '\0';
 
4407
 
4388
4408
  if (table_list && table_list->schema_table)
4389
4409
  {
4390
4410
    my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), "", "", INFORMATION_SCHEMA_NAME.c_str());
4792
4812
      close_temporary_table(session, altered_table, 1, 1);
4793
4813
  }
4794
4814
 
4795
 
  snprintf(tmp_name, sizeof(tmp_name), "%s-%lx_%"PRIx64, tmp_file_prefix,
 
4815
  snprintf(tmp_name, sizeof(tmp_name), "%s-%lx_%"PRIx64, TMP_FILE_PREFIX,
4796
4816
           current_pid, session->thread_id);
4797
4817
  /* Safety fix for innodb */
4798
4818
  if (lower_case_table_names)
4915
4935
  */
4916
4936
 
4917
4937
  session->set_proc_info("rename result table");
4918
 
  snprintf(old_name, sizeof(old_name), "%s2-%lx-%"PRIx64, tmp_file_prefix,
 
4938
  snprintf(old_name, sizeof(old_name), "%s2-%lx-%"PRIx64, TMP_FILE_PREFIX,
4919
4939
           current_pid, session->thread_id);
4920
4940
  if (lower_case_table_names)
4921
4941
    my_casedn_str(files_charset_info, old_name);