From: Date: April 26 2005 11:35am Subject: bk commit into 4.1 tree (msvensson:1.2207) BUG#9911 List-Archive: http://lists.mysql.com/internals/24303 X-Bug: 9911 Message-Id: <20050426093556.F11C825DF7D@blaudden.homeip.net> Below is the list of changes that have just been committed into a local 4.1 repository of msvensson. When msvensson does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2207 05/04/26 11:35:52 msvensson@neptunus.(none) +4 -0 BUG#9911 RENAME TABLE of type ARCHIVE fails with .ARN file error - Implemented ha_archive::rename_table - Added testcases for rename sql/examples/ha_archive.h 1.11 05/04/26 11:35:50 msvensson@neptunus.(none) +1 -0 Implement special version of rename table that does not care it the .arn file is missing sql/examples/ha_archive.cc 1.21 05/04/26 11:35:50 msvensson@neptunus.(none) +24 -0 Implement special version of rename table that does not care it the .arn file is missing mysql-test/t/archive.test 1.4 05/04/26 11:35:49 msvensson@neptunus.(none) +12 -1 Addd testcase for rename of archive table mysql-test/r/archive.result 1.3 05/04/26 11:35:49 msvensson@neptunus.(none) +15 -1 Addd testcase for rename of archive table # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: msvensson # Host: neptunus.(none) # Root: /home/msvensson/mysql/bug9911 --- 1.2/mysql-test/r/archive.result 2004-09-21 03:33:12 +02:00 +++ 1.3/mysql-test/r/archive.result 2005-04-26 11:35:49 +02:00 @@ -2601,4 +2601,18 @@ 2 011401 37 breaking dreaded Steinberg W 3 011402 37 Romans scholastics jarring 4 011403 37 intercepted audiology tinily -drop table t1, t2; +create table t3 engine=archive select * from t2; +select * from t3 where fld3='bonfire'; +auto fld1 companynr fld3 fld4 fld5 fld6 +1191 068504 00 bonfire corresponds positively +select count(*) from t3; +count(*) +1203 +rename table t3 to t4; +select * from t4 where fld3='bonfire'; +auto fld1 companynr fld3 fld4 fld5 fld6 +1191 068504 00 bonfire corresponds positively +select count(*) from t4; +count(*) +1203 +drop table t1, t2, t4; --- 1.3/mysql-test/t/archive.test 2005-01-26 15:27:28 +01:00 +++ 1.4/mysql-test/t/archive.test 2005-04-26 11:35:49 +02:00 @@ -1299,4 +1299,15 @@ SELECT * FROM t2; OPTIMIZE TABLE t2; SELECT * FROM t2; -drop table t1, t2; + +# +# Test rename of table +# +create table t3 engine=archive select * from t2; +select * from t3 where fld3='bonfire'; +select count(*) from t3; +rename table t3 to t4; +select * from t4 where fld3='bonfire'; +select count(*) from t4; + +drop table t1, t2, t4; --- 1.20/sql/examples/ha_archive.cc 2005-02-12 19:17:22 +01:00 +++ 1.21/sql/examples/ha_archive.cc 2005-04-26 11:35:50 +02:00 @@ -427,6 +427,30 @@ { static const char *ext[]= { ARZ, ARN, ARM, NullS }; return ext; } +/* + Rename all files that this handler defines in bas_ext list + + NOTE Don't care if the .arn file is missing +*/ +int ha_archive::rename_table(const char * from, const char * to) +{ + DBUG_ENTER("ha_archive::rename_table"); + for (const char **ext=bas_ext(); *ext ; ext++) + { + if (rename_file_ext(from,to,*ext)) + { + if (my_errno == ENOENT && + !my_strcasecmp(system_charset_info, *ext, ARN)) + continue; + + DBUG_RETURN(my_errno); + } + + } + DBUG_RETURN(0); +} + + /* When opening a file we: Create/get our shared structure. --- 1.10/sql/examples/ha_archive.h 2005-01-26 15:27:28 +01:00 +++ 1.11/sql/examples/ha_archive.h 2005-04-26 11:35:50 +02:00 @@ -124,6 +124,7 @@ int optimize(THD* thd, HA_CHECK_OPT* check_opt); THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); + int rename_table(const char * from, const char * to); }; bool archive_db_init(void);