Databases Reference
In-Depth Information
The ha_static_text class that implements interfaces defined by the handler class
is the heart of our storage engine. The handler class itself is quite big and has many
virtual methods that we can implement in ha_static_text . But luckily only a few
are defined as abstract—and it is only these methods that we are absolutely required
to implement. They are:
Method name
Description
table_type
This method simply returns the name of a storage engine,
STATIC_TEXT in our case.
bas_ext
When an engine puts different tables in different files, like MyISAM
does, this method returns a list of filename extensions that the engine
uses. Otherwise it is an empty list.
table_flags
A combination of flags that define table capabilities. It is a handler
method, not a handlerton method, as different tables are allowed
to have different capabilities.
index_flags
A combination of flags that define index capabilities. It does not
matter what we return here; this method will never be called, as our
engine does not support indexes.
create
This method is invoked to create a new table in the storage engine.
It will be empty in our case, because our engine does not need to do
anything on table creation, but we still have to provide this method.
store_lock
Another method that every engine is required to implement. It is
used by the MySQL locking subsystem. This method takes two
arguments, lock level and a pointer to a variable, and stores a lock of
this (or modified) lock level in this variable. That is where the name
of the method comes from. Engines that rely on MySQL table level
locking store the unaltered lock level, while engines that support a
higher lock granularity—page or row-level locking—downgrade the
lock to allow concurrent write access to the tables.
open
This method opens an existing table.
close
The opposite of open() —to close an open table.
rnd_init
This method is called before random reads or sequential table scans
(but not before an index lookup or traversal). It should prepare the
table for this kind of access.
rnd_next
In sequential table scans this method returns the next record of the
table. When invoked in a loop it works like an iterator, advancing
the cursor, and returning the next record on each invocation until the
end of table is reached.
position
This method remembers a current record position in the internal
handler variable. A position is whatever the engine uses to uniquely
identify the record; for example, a primary key value, a row ID, an
address in memory, or an offset in the data file.
Search WWH ::




Custom Search