diff options
author | unknown <guilhem@mysql.com> | 2003-07-23 15:48:52 +0200 |
---|---|---|
committer | unknown <guilhem@mysql.com> | 2003-07-23 15:48:52 +0200 |
commit | bacddcc5f5d7772d01b7f09fa8a80fa05c6fd38f (patch) | |
tree | db007f6faa5d281c80deaf115da3281e11562697 /sql | |
parent | a80c5a9c9b4a50f6cd9813b42596cecc9001ae87 (diff) | |
parent | dae34fb60f81802853961efad3edfa3427215680 (diff) | |
download | mariadb-git-bacddcc5f5d7772d01b7f09fa8a80fa05c6fd38f.tar.gz |
Merge gbichot@213.136.52.20:/home/bk/mysql-4.1
into mysql.com:/home/mysql_src/mysql-4.1
Diffstat (limited to 'sql')
-rw-r--r-- | sql/slave.cc | 63 | ||||
-rw-r--r-- | sql/slave.h | 2 |
2 files changed, 65 insertions, 0 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index c45c11f8bef..37979576b73 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1565,6 +1565,48 @@ int register_slave_on_master(MYSQL* mysql) } +/* + Builds a String from a HASH of TABLE_RULE_ENT. Cannot be used for any other + hash, as it assumes that the hash entries are TABLE_RULE_ENT. + + SYNOPSIS + table_rule_ent_hash_to_str() + s pointer to the String to fill + h pointer to the HASH to read + + RETURN VALUES + none +*/ + +void table_rule_ent_hash_to_str(String* s, HASH* h) +{ + s->length(0); + for (uint i=0 ; i < h->records ; i++) + { + TABLE_RULE_ENT* e= (TABLE_RULE_ENT*) hash_element(h, i); + if (s->length()) + s->append(','); + s->append(e->db,e->key_len); + } +} + +/* + Mostly the same thing as above +*/ + +void table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a) +{ + s->length(0); + for (uint i=0 ; i < a->elements ; i++) + { + TABLE_RULE_ENT* e; + get_dynamic(a, (gptr)&e, i); + if (s->length()) + s->append(','); + s->append(e->db,e->key_len); + } +} + int show_master_info(THD* thd, MASTER_INFO* mi) { // TODO: fix this for multi-master @@ -1594,6 +1636,10 @@ int show_master_info(THD* thd, MASTER_INFO* mi) field_list.push_back(new Item_empty_string("Slave_SQL_Running", 3)); field_list.push_back(new Item_empty_string("Replicate_do_db", 20)); field_list.push_back(new Item_empty_string("Replicate_ignore_db", 20)); + field_list.push_back(new Item_empty_string("Replicate_do_table", 20)); + field_list.push_back(new Item_empty_string("Replicate_ignore_table", 23)); + field_list.push_back(new Item_empty_string("Replicate_wild_do_table", 24)); + field_list.push_back(new Item_empty_string("Replicate_wild_ignore_table", 28)); field_list.push_back(new Item_return_int("Last_errno", 4, MYSQL_TYPE_LONG)); field_list.push_back(new Item_empty_string("Last_error", 20)); field_list.push_back(new Item_return_int("Skip_counter", 10, @@ -1626,6 +1672,23 @@ int show_master_info(THD* thd, MASTER_INFO* mi) protocol->store(mi->rli.slave_running ? "Yes":"No", &my_charset_bin); protocol->store(&replicate_do_db); protocol->store(&replicate_ignore_db); + /* + We can't directly use some protocol->store for + replicate_*_table, + as Protocol doesn't know the TABLE_RULE_ENT struct. + We first build Strings and then pass them to protocol->store. + */ + char buf[256]; + String tmp(buf, sizeof(buf), &my_charset_bin); + table_rule_ent_hash_to_str(&tmp, &replicate_do_table); + protocol->store(&tmp); + table_rule_ent_hash_to_str(&tmp, &replicate_ignore_table); + protocol->store(&tmp); + table_rule_ent_dynamic_array_to_str(&tmp, &replicate_wild_do_table); + protocol->store(&tmp); + table_rule_ent_dynamic_array_to_str(&tmp, &replicate_wild_ignore_table); + protocol->store(&tmp); + protocol->store((uint32) mi->rli.last_slave_errno); protocol->store(mi->rli.last_slave_error, &my_charset_bin); protocol->store((uint32) mi->rli.slave_skip_counter); diff --git a/sql/slave.h b/sql/slave.h index 429456eb0bb..668fff52d08 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -398,6 +398,8 @@ int mysql_table_dump(THD* thd, const char* db, int fetch_master_table(THD* thd, const char* db_name, const char* table_name, MASTER_INFO* mi, MYSQL* mysql); +void table_rule_ent_hash_to_str(String* s, HASH* h); +void table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a); int show_master_info(THD* thd, MASTER_INFO* mi); int show_binlog_info(THD* thd); |