summaryrefslogtreecommitdiff
path: root/sql/rpl_utility.h
diff options
context:
space:
mode:
authorunknown <mats@mysql.com>2006-05-03 15:00:38 +0200
committerunknown <mats@mysql.com>2006-05-03 15:00:38 +0200
commit12443de1b2c16970711336defee2e7c3d695d848 (patch)
tree80c5e99a54942e7c856946cb0b1ec087bb185db2 /sql/rpl_utility.h
parentcbdc730ae50aa5363dab071fe958608d8b223766 (diff)
downloadmariadb-git-12443de1b2c16970711336defee2e7c3d695d848.tar.gz
WL#3259 (RBR with more columns on slave than on master):
Extended replication to allow extra columns added last on slave as compared with table on master. mysql-test/extra/rpl_tests/rpl_row_tabledefs.test: Testing that replication can handle extra extra columns on slave. mysql-test/r/rpl_row_tabledefs.result: Result file change sql/Makefile.am: Adding new files. sql/field.cc: Implementing missing Field_bit::set_default() sql/field.h: Implementing missing Field_bit::set_default() sql/log_event.cc: Extending unpack_row() and replace_record() to handle the case when there are more columns on the slave than on the master. Especially handle BIT columns correctly. Using newly introduced table_def class to perform comparison. sql/log_event.h: Adding field to table_map_log_event. Changing prototype for do_prepare_row(). sql/mysql_priv.h: Adding include guards mysql-test/t/rpl_row_tabledefs.test: New BitKeeper file ``mysql-test/t/rpl_row_tabledefs.test'' sql/rpl_utility.cc: New BitKeeper file ``sql/rpl_utility.cc'' sql/rpl_utility.h: New BitKeeper file ``sql/rpl_utility.h''
Diffstat (limited to 'sql/rpl_utility.h')
-rw-r--r--sql/rpl_utility.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/sql/rpl_utility.h b/sql/rpl_utility.h
new file mode 100644
index 00000000000..0ac3c10eec6
--- /dev/null
+++ b/sql/rpl_utility.h
@@ -0,0 +1,60 @@
+/* Copyright 2006 MySQL AB. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef RPL_UTILITY_H
+#define RPL_UTILITY_H
+
+#ifndef __cplusplus
+#error "Don't include this C++ header file from a non-C++ file!"
+#endif
+
+#include "mysql_priv.h"
+
+uint32
+field_length_from_packed(enum_field_types const field_type,
+ byte const *const data);
+
+/*
+ A table definition from the master.
+
+ RESPONSIBILITIES
+
+ - Extract table definition data from the table map event
+ - Check if table definition in table map is compatible with table
+ definition on slave
+ */
+
+class table_def
+{
+public:
+ typedef unsigned char field_type;
+
+ table_def(field_type *t, my_size_t s)
+ : m_type(t), m_size(s)
+ {
+ }
+
+ my_size_t size() const { return m_size; }
+ field_type type(my_ptrdiff_t i) const { return m_type[i]; }
+
+ int compatible_with(RELAY_LOG_INFO *rli, TABLE *table) const;
+
+private:
+ my_size_t m_size;
+ field_type *m_type;
+};
+
+#endif /* RPL_UTILITY_H */