Name
HANDLER
Synopsis
HANDLERtableOPEN [AShandle] HANDLERhandleREADindexoperator(value,...) [WHEREcondition] [LIMIT . . . ] HANDLERhandleREADindex{FIRST|NEXT|PREV|LAST} [WHEREcondition] [LIMIT . . . ] HANDLERhandleREAD {FIRST|NEXT} [WHEREcondition] [LIMIT . . . ] HANDLERhandleCLOSE
Use this statement as a faster
alternative to the SELECT statement. The
HANDLER statement establishes a handle for reading
a MyISAM or an InnoDB table, much like a file handle in a programming
language such as Perl. You must issue the HANDLER
table OPEN method first
to establish a table handle and assign it the name in the
AS clause. The AS clause and
handle name are optional, though. If an alias is not set up, the
table name is used for subsequent HANDLER
statements. A handle provides direct access to the table, as opposed
to working from a results set. The handle is usable only by the
current connection thread that established it. The table is still
accessible by others, though, and is not locked by this statement.
Because of this and because the method provides direct table access,
the data read can change and even be incomplete on an active database
while running subsequent read
statements.
You can use the three HANDLER
handle READ... formats
shown here to read data from a table. The HANDLER
handle CLOSE method is
used to close a table handle. Here are a couple of basic examples of
the HANDLER statement:
HANDLER clients OPEN AS clients_handle; HANDLER clients_handle READ FIRST;
The first ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access