diff options
author | unknown <tsmith@sita.local> | 2007-08-29 15:28:38 -0600 |
---|---|---|
committer | unknown <tsmith@sita.local> | 2007-08-29 15:28:38 -0600 |
commit | 48193af48948acb84ddd3b488b6f8faa4a6d126b (patch) | |
tree | 81c00dc60322deeb0c094deef5d141509c980a60 /sql/log_event_old.h | |
parent | 024bd2f612825cd36c93775728f56856e5f28267 (diff) | |
parent | 053c9d1c473df4e1457992ee6a39da3e0cb39bdd (diff) | |
download | mariadb-git-48193af48948acb84ddd3b488b6f8faa4a6d126b.tar.gz |
Merge sita.local:/Users/tsmith/m/bk/maint/51-target22
into sita.local:/Users/tsmith/m/bk/maint/51
sql/field.cc:
Auto merged
sql/log_event_old.cc:
Auto merged
sql/rpl_record.h:
Auto merged
sql/rpl_utility.cc:
Auto merged
sql/rpl_utility.h:
Auto merged
sql/slave.h:
Auto merged
storage/innobase/handler/ha_innodb.cc:
Auto merged
sql/log_event.cc:
Manual merge
sql/log_event.h:
Manual merge
sql/log_event_old.h:
Manual merge
sql/rpl_record.cc:
Manual merge
sql/slave.cc:
Manual merge
Diffstat (limited to 'sql/log_event_old.h')
-rw-r--r-- | sql/log_event_old.h | 130 |
1 files changed, 123 insertions, 7 deletions
diff --git a/sql/log_event_old.h b/sql/log_event_old.h index b6e25b6bc73..81e55097905 100644 --- a/sql/log_event_old.h +++ b/sql/log_event_old.h @@ -20,9 +20,90 @@ Need to include this file at the proper position of log_event.h */ + +class Old_rows_log_event +{ + public: + + virtual ~Old_rows_log_event() {} + + protected: + +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + + int do_apply_event(Rows_log_event*,const Relay_log_info*); + + /* + Primitive to prepare for a sequence of row executions. + + DESCRIPTION + + Before doing a sequence of do_prepare_row() and do_exec_row() + calls, this member function should be called to prepare for the + entire sequence. Typically, this member function will allocate + space for any buffers that are needed for the two member + functions mentioned above. + + RETURN VALUE + + The member function will return 0 if all went OK, or a non-zero + error code otherwise. + */ + virtual int do_before_row_operations(TABLE *table) = 0; + + /* + Primitive to clean up after a sequence of row executions. + + DESCRIPTION + + After doing a sequence of do_prepare_row() and do_exec_row(), + this member function should be called to clean up and release + any allocated buffers. + */ + virtual int do_after_row_operations(TABLE *table, int error) = 0; + + /* + Primitive to prepare for handling one row in a row-level event. + + DESCRIPTION + + The member function prepares for execution of operations needed for one + row in a row-level event by reading up data from the buffer containing + the row. No specific interpretation of the data is normally done here, + since SQL thread specific data is not available: that data is made + available for the do_exec function. + + A pointer to the start of the next row, or NULL if the preparation + failed. Currently, preparation cannot fail, but don't rely on this + behavior. -class Write_rows_log_event_old : public Write_rows_log_event + RETURN VALUE + Error code, if something went wrong, 0 otherwise. + */ + virtual int do_prepare_row(THD*, Relay_log_info const*, TABLE*, + uchar const *row_start, + uchar const **row_end) = 0; + + /* + Primitive to do the actual execution necessary for a row. + + DESCRIPTION + The member function will do the actual execution needed to handle a row. + + RETURN VALUE + 0 if execution succeeded, 1 if execution failed. + + */ + virtual int do_exec_row(TABLE *table) = 0; + +#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ +}; + + +class Write_rows_log_event_old + : public Write_rows_log_event, public Old_rows_log_event { + public: enum { @@ -49,14 +130,26 @@ private: virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; } #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + // use old definition of do_apply_event() + virtual int do_apply_event(const Relay_log_info *rli) + { return Old_rows_log_event::do_apply_event(this,rli); } + + // primitives for old version of do_apply_event() + virtual int do_before_row_operations(TABLE *table); + virtual int do_after_row_operations(TABLE *table, int error); virtual int do_prepare_row(THD*, Relay_log_info const*, TABLE*, uchar const *row_start, uchar const **row_end); + virtual int do_exec_row(TABLE *table); + #endif }; -class Update_rows_log_event_old : public Update_rows_log_event +class Update_rows_log_event_old + : public Update_rows_log_event, public Old_rows_log_event { + uchar *m_after_image, *m_memory; + public: enum { @@ -67,14 +160,16 @@ public: #if !defined(MYSQL_CLIENT) Update_rows_log_event_old(THD *thd, TABLE *table, ulong table_id, MY_BITMAP const *cols, bool is_transactional) - : Update_rows_log_event(thd, table, table_id, cols, is_transactional) + : Update_rows_log_event(thd, table, table_id, cols, is_transactional), + m_after_image(NULL), m_memory(NULL) { } #endif #if defined(HAVE_REPLICATION) Update_rows_log_event_old(const char *buf, uint event_len, const Format_description_log_event *descr) - : Update_rows_log_event(buf, event_len, descr) + : Update_rows_log_event(buf, event_len, descr), + m_after_image(NULL), m_memory(NULL) { } #endif @@ -83,14 +178,25 @@ private: virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; } #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + // use old definition of do_apply_event() + virtual int do_apply_event(const Relay_log_info *rli) + { return Old_rows_log_event::do_apply_event(this,rli); } + + // primitives for old version of do_apply_event() + virtual int do_before_row_operations(TABLE *table); + virtual int do_after_row_operations(TABLE *table, int error); virtual int do_prepare_row(THD*, Relay_log_info const*, TABLE*, uchar const *row_start, uchar const **row_end); + virtual int do_exec_row(TABLE *table); #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ }; -class Delete_rows_log_event_old : public Delete_rows_log_event +class Delete_rows_log_event_old + : public Delete_rows_log_event, public Old_rows_log_event { + uchar *m_after_image, *m_memory; + public: enum { @@ -101,14 +207,16 @@ public: #if !defined(MYSQL_CLIENT) Delete_rows_log_event_old(THD *thd, TABLE *table, ulong table_id, MY_BITMAP const *cols, bool is_transactional) - : Delete_rows_log_event(thd, table, table_id, cols, is_transactional) + : Delete_rows_log_event(thd, table, table_id, cols, is_transactional), + m_after_image(NULL), m_memory(NULL) { } #endif #if defined(HAVE_REPLICATION) Delete_rows_log_event_old(const char *buf, uint event_len, const Format_description_log_event *descr) - : Delete_rows_log_event(buf, event_len, descr) + : Delete_rows_log_event(buf, event_len, descr), + m_after_image(NULL), m_memory(NULL) { } #endif @@ -117,8 +225,16 @@ private: virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; } #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + // use old definition of do_apply_event() + virtual int do_apply_event(const Relay_log_info *rli) + { return Old_rows_log_event::do_apply_event(this,rli); } + + // primitives for old version of do_apply_event() + virtual int do_before_row_operations(TABLE *table); + virtual int do_after_row_operations(TABLE *table, int error); virtual int do_prepare_row(THD*, Relay_log_info const*, TABLE*, uchar const *row_start, uchar const **row_end); + virtual int do_exec_row(TABLE *table); #endif }; |