My Project
Public Member Functions
Reprepare_observer Class Reference

#include <sql_prepare.h>

List of all members.

Public Member Functions

bool report_error (THD *thd)
bool is_invalidated () const
void reset_reprepare_observer ()

Detailed Description

An interface that is used to take an action when the locking module notices that a table version has changed since the last execution. "Table" here may refer to any kind of table -- a base table, a temporary table, a view or an information schema table.

When we open and lock tables for execution of a prepared statement, we must verify that they did not change since statement prepare. If some table did change, the statement parse tree *may* be no longer valid, e.g. in case it contains optimizations that depend on table metadata.

This class provides an interface (a method) that is invoked when such a situation takes place. The implementation of the method simply reports an error, but the exact details depend on the nature of the SQL statement.

At most 1 instance of this class is active at a time, in which case THD::m_reprepare_observer is not NULL.

See also:
check_and_update_table_version() for details of the version tracking algorithm
Open_tables_state::m_reprepare_observer for the life cycle of metadata observers.

Member Function Documentation

bool Reprepare_observer::report_error ( THD *  thd)

Check if a change of metadata is OK. In future the signature of this method may be extended to accept the old and the new versions, but since currently the check is very simple, we only need the THD to report an error.

Push an error to the error stack and return TRUE for now.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines