Loading mysql-test/r/archive.result +15 −1 Original line number Diff line number Diff line Loading @@ -2601,4 +2601,18 @@ auto fld1 companynr fld3 fld4 fld5 fld6 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; mysql-test/t/archive.test +12 −1 Original line number Diff line number Diff line Loading @@ -1299,4 +1299,15 @@ INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily',''); 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; sql/examples/ha_archive.cc +24 −0 Original line number Diff line number Diff line Loading @@ -427,6 +427,30 @@ const char **ha_archive::bas_ext() const { 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. Loading sql/examples/ha_archive.h +1 −0 Original line number Diff line number Diff line Loading @@ -124,6 +124,7 @@ class ha_archive: public handler 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); Loading Loading
mysql-test/r/archive.result +15 −1 Original line number Diff line number Diff line Loading @@ -2601,4 +2601,18 @@ auto fld1 companynr fld3 fld4 fld5 fld6 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;
mysql-test/t/archive.test +12 −1 Original line number Diff line number Diff line Loading @@ -1299,4 +1299,15 @@ INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily',''); 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;
sql/examples/ha_archive.cc +24 −0 Original line number Diff line number Diff line Loading @@ -427,6 +427,30 @@ const char **ha_archive::bas_ext() const { 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. Loading
sql/examples/ha_archive.h +1 −0 Original line number Diff line number Diff line Loading @@ -124,6 +124,7 @@ class ha_archive: public handler 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); Loading