This is the
Used for opening tables. The name will be the name of the file. A table is opened when it needs to be opened. For instance when a request comes in for a select on the table (tables are not open and closed for each request, they are cached).
Called from handler.cc by handler::ha_open(). The server opens all tables by calling ha_open() which then calls the handler specific open().
A handler object is opened as part of its initialization and before being used for normal queries (not before meta-data changes always.) If the object was opened it will also be closed before being deleted.
This is the
open is called to open a database table.
The first parameter is the name of the table to be opened. The
second parameter determines what file to open or what
operation to take. The values are defined in
handler.h and are copied here for your
#define HA_OPEN_KEYFILE 1 #define HA_OPEN_RNDFILE 2 #define HA_GET_INDEX 4 #define HA_GET_INFO 8 /* do a ha_info() after open */ #define HA_READ_ONLY 16 /* File opened as readonly */ #define HA_TRY_READ_ONLY 32 /* Try readonly if can't open with read and write */ #define HA_WAIT_IF_LOCKED 64 /* Wait if locked on open */ #define HA_ABORT_IF_LOCKED 128 /* skip if locked on open.*/ #define HA_BLOCK_LOCK 256 /* unlock when reading some records */ #define HA_OPEN_TEMPORARY 512
The final option dictates whether the handler should check for a lock on the table before opening it.
Typically your storage engine will need to implement some form
of shared access control to prevent file corruption is a
multi-threaded environment. For an example of how to implement
file locking, see the
free_share() methods of
Copyright © 1997, 2014, Oracle and/or its affiliates. All rights reserved. Legal Notices