diff options
author | unknown <mats@mysql.com> | 2006-02-24 16:31:38 +0100 |
---|---|---|
committer | unknown <mats@mysql.com> | 2006-02-24 16:31:38 +0100 |
commit | d11aa8345db0801c62fcf966bfce6c4d7eda63f8 (patch) | |
tree | 6b2f92caee2aae47cbd2a4f203c4b2a8af20ab61 /sql/handler.h | |
parent | d6aea04c5b45fd8444d14872c08751746f1eba8b (diff) | |
parent | 613fb54f95f440baa02ba31fbc317c2a880f3513 (diff) | |
download | mariadb-git-d11aa8345db0801c62fcf966bfce6c4d7eda63f8.tar.gz |
Merge mysqldev@production.mysql.com:my/mysql-5.1-release
into mysql.com:/home/bk/w3023-mysql-5.1-new
mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test:
Auto merged
mysql-test/extra/rpl_tests/rpl_log.test:
Auto merged
mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test:
Auto merged
mysql-test/r/binlog_row_insert_select.result:
Auto merged
mysql-test/r/rpl_row_delayed_ins.result:
Auto merged
mysql-test/t/rpl_sp.test:
Auto merged
mysql-test/t/sp.test:
Auto merged
sql/ha_ndbcluster_binlog.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/handler.h:
Auto merged
mysql-test/t/rpl_ndb_dd_basic.test:
Auto merged
sql/log.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/opt_range.cc:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/table.h:
Auto merged
mysql-test/r/binlog_row_mix_innodb_myisam.result:
Merge with 5.1.7 release clone.
mysql-test/r/rpl_row_basic_11bugs.result:
Merge with 5.1.7 release clone.
mysql-test/r/rpl_row_basic_2myisam.result:
Merge with 5.1.7 release clone.
mysql-test/r/rpl_row_basic_3innodb.result:
Merge with 5.1.7 release clone.
mysql-test/r/rpl_row_create_table.result:
Merge with 5.1.7 release clone.
mysql-test/r/rpl_row_log.result:
Merge with 5.1.7 release clone.
mysql-test/r/rpl_row_log_innodb.result:
Merge with 5.1.7 release clone.
mysql-test/r/rpl_row_sp008.result:
Merge with 5.1.7 release clone.
mysql-test/t/rpl_row_basic_11bugs.test:
Merge with 5.1.7 release clone.
mysql-test/t/rpl_row_sp008.test:
Merge with 5.1.7 release clone.
Diffstat (limited to 'sql/handler.h')
-rw-r--r-- | sql/handler.h | 73 |
1 files changed, 56 insertions, 17 deletions
diff --git a/sql/handler.h b/sql/handler.h index fa4450544e9..8189973da66 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1086,7 +1086,35 @@ typedef struct st_ha_create_information bool store_on_disk; /* 1 if table stored on disk */ } HA_CREATE_INFO; +/* + Class for maintaining hooks used inside operations on tables such + as: create table functions, delete table functions, and alter table + functions. + + Class is using the Template Method pattern to separate the public + usage interface from the private inheritance interface. This + imposes no overhead, since the public non-virtual function is small + enough to be inlined. + + The hooks are usually used for functions that does several things, + e.g., create_table_from_items(), which both create a table and lock + it. + */ +class TABLEOP_HOOKS +{ +public: + inline void prelock(TABLE **tables, uint count) + { + do_prelock(tables, count); + } +private: + /* Function primitive that is called prior to locking tables */ + virtual void do_prelock(TABLE **tables, uint count) + { + /* Default is to do nothing */ + } +}; typedef struct st_savepoint SAVEPOINT; extern ulong savepoint_alloc_size; @@ -1480,15 +1508,24 @@ public: uint get_index(void) const { return active_index; } virtual int open(const char *name, int mode, uint test_if_locked)=0; virtual int close(void)=0; - virtual int ha_write_row(byte * buf); - virtual int ha_update_row(const byte * old_data, byte * new_data); - virtual int ha_delete_row(const byte * buf); + + /* + These functions represent the public interface to *users* of the + handler class, hence they are *not* virtual. For the inheritance + interface, see the (private) functions write_row(), update_row(), + and delete_row() below. + */ + int ha_external_lock(THD *thd, int lock_type); + int ha_write_row(byte * buf); + int ha_update_row(const byte * old_data, byte * new_data); + int ha_delete_row(const byte * buf); + /* If the handler does it's own injection of the rows, this member function should return 'true'. */ virtual bool is_injective() const { return false; } - + /* SYNOPSIS start_bulk_update() @@ -1620,7 +1657,6 @@ public: { return 0; } virtual int extra_opt(enum ha_extra_function operation, ulong cache_size) { return extra(operation); } - virtual int external_lock(THD *thd, int lock_type) { return 0; } /* In an UPDATE or DELETE, if the row under the cursor was locked by another transaction, and the engine used an optimistic read of the last @@ -1894,28 +1930,31 @@ public: { return COMPATIBLE_DATA_NO; } private: - /* - Row-level primitives for storage engines. - These should be overridden by the storage engine class. To call - these methods, use the corresponding 'ha_*' method above. + Row-level primitives for storage engines. These should be + overridden by the storage engine class. To call these methods, use + the corresponding 'ha_*' method above. */ - friend int ndb_add_binlog_index(THD *, void *); + virtual int external_lock(THD *thd __attribute__((unused)), + int lock_type __attribute__((unused))) + { + return 0; + } - virtual int write_row(byte *buf __attribute__((unused))) - { - return HA_ERR_WRONG_COMMAND; + virtual int write_row(byte *buf __attribute__((unused))) + { + return HA_ERR_WRONG_COMMAND; } virtual int update_row(const byte *old_data __attribute__((unused)), byte *new_data __attribute__((unused))) - { - return HA_ERR_WRONG_COMMAND; + { + return HA_ERR_WRONG_COMMAND; } virtual int delete_row(const byte *buf __attribute__((unused))) - { - return HA_ERR_WRONG_COMMAND; + { + return HA_ERR_WRONG_COMMAND; } }; |