summaryrefslogtreecommitdiff
path: root/sql/examples/ha_example.h
diff options
context:
space:
mode:
authorunknown <pem@mysql.com>2004-05-26 17:04:45 +0200
committerunknown <pem@mysql.com>2004-05-26 17:04:45 +0200
commitf8866c162b57fa102298dbfc9e49d4f72f16c1d7 (patch)
treee4e5bb1f8b9718ec195b357c050b3dc3254b447d /sql/examples/ha_example.h
parent556b51e12aa58c5a7894a6bd010c2cd59d6e0cc3 (diff)
parent3a675ff5f8ed659344d7540f811ca052d999407d (diff)
downloadmariadb-git-f8866c162b57fa102298dbfc9e49d4f72f16c1d7.tar.gz
Merging 4.1 to 5.0.
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union client/mysqltest.c: Auto merged configure.in: Auto merged include/my_sys.h: Auto merged include/mysql_com.h: Auto merged libmysql/libmysql.c: Auto merged libmysqld/Makefile.am: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/mi_check.c: Auto merged myisam/myisamchk.c: Auto merged myisam/myisamdef.h: Auto merged mysql-test/r/func_group.result: Auto merged mysql-test/r/func_time.result: Auto merged mysql-test/r/null.result: Auto merged mysql-test/r/query_cache.result: Auto merged mysql-test/r/rpl_server_id2.result: Auto merged mysql-test/r/select.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/variables.result: Auto merged mysql-test/t/rpl000015.test: Auto merged mysql-test/t/rpl_error_ignored_table.test: Auto merged mysql-test/t/rpl_log.test: Auto merged mysql-test/t/rpl_log_pos.test: Auto merged mysql-test/t/rpl_max_relay_size.test: Auto merged mysql-test/t/rpl_relayrotate.test: Auto merged mysql-test/t/rpl_rotate_logs.test: Auto merged mysql-test/t/rpl_server_id2.test: Auto merged mysql-test/t/subselect.test: Auto merged mysql-test/t/variables.test: Auto merged mysys/my_pthread.c: Auto merged netware/BUILD/compile-netware-all: Auto merged netware/BUILD/compile-netware-standard: Auto merged netware/BUILD/mwenv: Auto merged netware/Makefile.am: Auto merged netware/my_manage.c: Auto merged netware/my_manage.h: Auto merged netware/mysql_test_run.c: Auto merged scripts/mysql_install_db.sh: Auto merged sql/Makefile.am: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_berkeley.h: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_innodb.h: Auto merged sql/ha_myisam.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_subselect.cc: Auto merged sql/item_subselect.h: Auto merged sql/item_sum.cc: Auto merged sql/item_sum.h: Auto merged sql/item_timefunc.cc: Auto merged sql/lock.cc: Auto merged sql/mysql_priv.h: Auto merged sql/opt_range.cc: Auto merged sql/protocol.cc: Auto merged sql/protocol.h: Auto merged sql/repl_failsafe.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_show.cc: Auto merged sql/sql_string.cc: Auto merged sql/sql_string.h: Auto merged sql/sql_table.cc: Auto merged sql/sql_union.cc: Auto merged sql/sql_yacc.yy: Auto merged tests/client_test.c: Auto merged
Diffstat (limited to 'sql/examples/ha_example.h')
-rw-r--r--sql/examples/ha_example.h46
1 files changed, 40 insertions, 6 deletions
diff --git a/sql/examples/ha_example.h b/sql/examples/ha_example.h
index 466632a1795..2228f04284a 100644
--- a/sql/examples/ha_example.h
+++ b/sql/examples/ha_example.h
@@ -14,6 +14,17 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+/*
+ Please read ha_exmple.cc before reading this file.
+ Please keep in mind that the example storage engine implements all methods
+ that are required to be implemented. handler.h has a full list of methods
+ that you can implement.
+*/
+
+/*
+ EXAMPLE_SHARE is a structure that will be shared amoung all open handlers
+ The example implements the minimum of what you will probably need.
+*/
typedef struct st_example_share {
char *table_name;
uint table_name_length,use_count;
@@ -21,6 +32,9 @@ typedef struct st_example_share {
THR_LOCK lock;
} EXAMPLE_SHARE;
+/*
+ Class definition for the storage engine
+*/
class ha_example: public handler
{
THR_LOCK_DATA lock; /* MySQL lock */
@@ -33,17 +47,34 @@ public:
~ha_example()
{
}
- const char *table_type() const { return "EXAMPLE"; }
+ /* The name that will be used for display purposes */
+ const char *table_type() const { return "EXAMPLE"; }
+ /* The name of the index type that will be used for display */
const char *index_type(uint inx) { return "NONE"; }
const char **bas_ext() const;
+ /*
+ This is a list of flags that says what the storage engine
+ implements. The current table flags are documented in
+ table_flags.
+ */
ulong table_flags() const
{
return 0;
}
+ /*
+ This is a list of flags that says how the storage engine
+ implements indexes. The current index flags are documented in
+ handler.h. If you do not implement indexes, just return zero
+ here.
+ */
ulong index_flags(uint inx) const
{
return 0;
}
+ /*
+ unireg.cc will call the following to make sure that the storage engine can
+ handle the data it is about to send.
+ */
uint max_record_length() const { return HA_MAX_REC_LENGTH; }
uint max_keys() const { return 0; }
uint max_key_parts() const { return 0; }
@@ -52,10 +83,15 @@ public:
Called in test_quick_select to determine if indexes should be used.
*/
virtual double scan_time() { return (double) (records+deleted) / 20.0+10; }
- /* The next method will never be called */
+ /*
+ The next method will never be called if you do not implement indexes.
+ */
virtual double read_time(ha_rows rows) { return (double) rows / 20.0+1; }
virtual bool fast_key_read() { return 1;}
+ /*
+ Everything below are methods that we implment in ha_example.cc.
+ */
int open(const char *name, int mode, uint test_if_locked);
int close(void);
int write_row(byte * buf);
@@ -78,10 +114,8 @@ public:
int reset(void);
int external_lock(THD *thd, int lock_type);
int delete_all_rows(void);
- ha_rows records_in_range(int inx, const byte *start_key,uint start_key_len,
- enum ha_rkey_function start_search_flag,
- const byte *end_key,uint end_key_len,
- enum ha_rkey_function end_search_flag);
+ ha_rows records_in_range(uint inx, key_range *min_key,
+ key_range *max_key);
int delete_table(const char *from);
int rename_table(const char * from, const char * to);
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);