MySQL 8.4.3
Source Code Documentation
Sroutine_hash_entry Class Reference

Structure that represents element in the set of stored routines used by statement or routine. More...

#include <sp.h>

Public Types

enum  entry_type {
  FUNCTION , PROCEDURE , TRIGGER , FK_TABLE_ROLE_PARENT_CHECK ,
  FK_TABLE_ROLE_CHILD_CHECK , FK_TABLE_ROLE_CHILD_UPDATE , FK_TABLE_ROLE_CHILD_DELETE
}
 

Public Member Functions

entry_type type () const
 
const char * db () const
 
size_t db_length () const
 
const char * name () const
 
size_t name_length () const
 
bool use_normalized_key () const
 
const char * part_mdl_key ()
 
size_t part_mdl_key_length ()
 

Public Attributes

char * m_key
 Key identifying routine or other object added to the set. More...
 
LEX_CSTRING m_object_name
 
uint16 m_key_length
 
uint16 m_db_length
 
Sroutine_hash_entrynext
 Next element in list linking all routines in set. More...
 
Table_refbelong_to_view
 Uppermost view which directly or indirectly uses this routine. More...
 
int64 m_cache_version
 This is for prepared statement validation purposes. More...
 

Detailed Description

Structure that represents element in the set of stored routines used by statement or routine.

Member Enumeration Documentation

◆ entry_type

Enumerator
FUNCTION 
PROCEDURE 
TRIGGER 
FK_TABLE_ROLE_PARENT_CHECK 

Parent table in a foreign key on which child table there was insert or update.

We will lookup new values in parent, so need to acquire SR lock on it.

FK_TABLE_ROLE_CHILD_CHECK 

Child table in a foreign key with RESTRICT/NO ACTION as corresponding rule and on which parent table there was delete or update.

We will check if old parent key is referenced by child table, so need to acquire SR lock on it.

FK_TABLE_ROLE_CHILD_UPDATE 

Child table in a foreign key with CASCADE/SET NULL/SET DEFAULT as 'on update' rule, on which parent there was update, or with SET NULL/ SET DEFAULT as 'on delete' rule, on which parent there was delete.

We might need to update rows in child table, so we need to acquire SW lock on it. We also need to take into account that child table might be parent for some other FKs, so such update needs to be handled recursively.

FK_TABLE_ROLE_CHILD_DELETE 

Child table in a foreign key with CASCADE as 'on delete' rule for which there was delete from the parent table.

We might need to delete rows from the child table, so we need to acquire SW lock on it. We also need to take into account that child table might be parent for some other FKs, so such delete needs to be handled recursively (and even might result in updates).

Member Function Documentation

◆ db()

const char * Sroutine_hash_entry::db ( ) const
inline

◆ db_length()

size_t Sroutine_hash_entry::db_length ( ) const
inline

◆ name()

const char * Sroutine_hash_entry::name ( ) const
inline

◆ name_length()

size_t Sroutine_hash_entry::name_length ( ) const
inline

◆ part_mdl_key()

const char * Sroutine_hash_entry::part_mdl_key ( )
inline

◆ part_mdl_key_length()

size_t Sroutine_hash_entry::part_mdl_key_length ( )
inline

◆ type()

entry_type Sroutine_hash_entry::type ( ) const
inline

◆ use_normalized_key()

bool Sroutine_hash_entry::use_normalized_key ( ) const
inline

Member Data Documentation

◆ belong_to_view

Table_ref* Sroutine_hash_entry::belong_to_view

Uppermost view which directly or indirectly uses this routine.

0 if routine is not used in view. Note that it also can be 0 if statement uses routine both via view and directly.

◆ m_cache_version

int64 Sroutine_hash_entry::m_cache_version

This is for prepared statement validation purposes.

A statement looks up and pre-loads all its stored functions at prepare. Later on, if a function is gone from the cache, execute may fail. Similarly, tables involved in referential constraints are also prelocked. Remember the version of the cached item at prepare to be able to invalidate the prepared statement at execute if it changes.

◆ m_db_length

uint16 Sroutine_hash_entry::m_db_length

◆ m_key

char* Sroutine_hash_entry::m_key

Key identifying routine or other object added to the set.

Key format: "@<1-byte entry type@>@<db name@>\0@<routine/object name@>\0".

Note
We use binary comparison for these keys as the <db name> component requires case-sensitive comparison on –lower-case-table-names=0 systems. On systems where –lower-case-table-names > 0 database names which passed to functions working with this set are already lowercased. So binary comparison is equivalent to case-insensitive comparison for them. Routine names are case and accent insensitive. To achieve such comparison we normalize routine names by converting their characters to their sort weights (according to case and accent insensitive collation). In this case, the actual routine name is also stored in the member m_object_name.
For Foreign Key objects, '<db name>\0<object name>\0' part of the key is compatible with keys used by MDL. So one can easily construct MDL_key from this key.

◆ m_key_length

uint16 Sroutine_hash_entry::m_key_length

◆ m_object_name

LEX_CSTRING Sroutine_hash_entry::m_object_name

◆ next

Sroutine_hash_entry* Sroutine_hash_entry::next

Next element in list linking all routines in set.

See also comments for LEX::sroutine/sroutine_list and sp_head::m_sroutines.


The documentation for this class was generated from the following file: