diff options
author | svoj@mysql.com/june.mysql.com <> | 2007-01-31 17:09:58 +0400 |
---|---|---|
committer | svoj@mysql.com/june.mysql.com <> | 2007-01-31 17:09:58 +0400 |
commit | a28b2ca1ebe95f9180efa4b84c25ba0535f6532c (patch) | |
tree | 6ceb1e941102a0524e3df9896048492d38121db2 /sql/ha_myisammrg.cc | |
parent | de1572d687219421fd68acdf309ccbc79b896390 (diff) | |
parent | a69107598e869d04e6ba5e39a2fbf9a0b0a9ca90 (diff) | |
download | mariadb-git-a28b2ca1ebe95f9180efa4b84c25ba0535f6532c.tar.gz |
Merge mysql.com:/home/svoj/devel/mysql/WL3567/mysql-4.1-engines
into mysql.com:/home/svoj/devel/mysql/WL3567/mysql-5.0-engines
Diffstat (limited to 'sql/ha_myisammrg.cc')
-rw-r--r-- | sql/ha_myisammrg.cc | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index 09445f775de..97823e2cf47 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -66,6 +66,12 @@ static const char *ha_myisammrg_exts[] = { ".MRG", NullS }; +extern int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out, + MI_COLUMNDEF **recinfo_out, uint *records_out); +extern int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo, + uint t1_keys, uint t1_recs, + MI_KEYDEF *t2_keyinfo, MI_COLUMNDEF *t2_recinfo, + uint t2_keys, uint t2_recs, bool strict); const char **ha_myisammrg::bas_ext() const { @@ -87,6 +93,12 @@ const char *ha_myisammrg::index_type(uint key_number) int ha_myisammrg::open(const char *name, int mode, uint test_if_locked) { + MI_KEYDEF *keyinfo; + MI_COLUMNDEF *recinfo; + MYRG_TABLE *u_table; + uint recs; + uint keys= table->keys; + int error; char name_buff[FN_REFLEN]; DBUG_PRINT("info", ("ha_myisammrg::open")); @@ -109,18 +121,43 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked) { DBUG_PRINT("error",("reclength: %lu mean_rec_length: %lu", table->s->reclength, mean_rec_length)); + error= HA_ERR_WRONG_MRG_TABLE_DEF; goto err; } + if ((error= table2myisam(table, &keyinfo, &recinfo, &recs))) + { + /* purecov: begin inspected */ + DBUG_PRINT("error", ("Failed to convert TABLE object to MyISAM " + "key and column definition")); + goto err; + /* purecov: end */ + } + for (u_table= file->open_tables; u_table < file->end_table; u_table++) + { + if (check_definition(keyinfo, recinfo, keys, recs, + u_table->table->s->keyinfo, u_table->table->s->rec, + u_table->table->s->base.keys, + u_table->table->s->base.fields, false)) + { + my_free((gptr) recinfo, MYF(0)); + error= HA_ERR_WRONG_MRG_TABLE_DEF; + goto err; + } + } + my_free((gptr) recinfo, MYF(0)); #if !defined(BIG_TABLES) || SIZEOF_OFF_T == 4 /* Merge table has more than 2G rows */ if (table->s->crashed) + { + error= HA_ERR_WRONG_MRG_TABLE_DEF; goto err; + } #endif return (0); err: myrg_close(file); file=0; - return (my_errno= HA_ERR_WRONG_MRG_TABLE_DEF); + return (my_errno= error); } int ha_myisammrg::close(void) |