MySQL 9.1.0
Source Code Documentation
dd::sdi_utils Namespace Reference

Classes

class  Closure_error_handler
 Class template which derives from Internal_error_handler and overrides handle_condition with the CONDITION_HANDLER_CLOS template parameter. More...
 

Functions

bool checked_return (bool ret)
 In debug mode, check that a true argument is paired with thd->is_error() or thd->killed being set. More...
 
bool mdl_lock (THD *thd, MDL_key::enum_mdl_namespace ns, const String_type &schema_name, const String_type &object_name, enum_mdl_type mt=MDL_EXCLUSIVE, enum_mdl_duration md=MDL_TRANSACTION)
 Convenience function for obtaining MDL. More...
 
template<typename T >
const T & ptr_as_cref (const T *p)
 
template<typename CH_CLOS , typename ACTION_CLOS >
bool handle_errors (THD *thd, CH_CLOS &&chc, ACTION_CLOS &&ac)
 Set up a custom error handler to use for errors from the execution of a closure. More...
 
template<typename P_TYPE , typename CLOS_TYPE >
std::unique_ptr< P_TYPE, CLOS_TYPE > make_guard (P_TYPE *p, CLOS_TYPE &&clos)
 

Function Documentation

◆ checked_return()

bool dd::sdi_utils::checked_return ( bool  ret)
inline

In debug mode, check that a true argument is paired with thd->is_error() or thd->killed being set.

In optimized mode it turns into a noop.

Parameters
[in]retreturn value to check
Returns
same as argument passed in

NDEBUG

◆ handle_errors()

template<typename CH_CLOS , typename ACTION_CLOS >
bool dd::sdi_utils::handle_errors ( THD thd,
CH_CLOS &&  chc,
ACTION_CLOS &&  ac 
)

Set up a custom error handler to use for errors from the execution of a closure.

Parameters
thdthread context
chcclosure which implements the Internal_error_handler::handle_condition override
acclosure action for which error conditions should be handled.
Return values
trueif an error occurs
falseotherwise

◆ make_guard()

template<typename P_TYPE , typename CLOS_TYPE >
std::unique_ptr< P_TYPE, CLOS_TYPE > dd::sdi_utils::make_guard ( P_TYPE *  p,
CLOS_TYPE &&  clos 
)

◆ mdl_lock()

bool dd::sdi_utils::mdl_lock ( THD thd,
MDL_key::enum_mdl_namespace  ns,
const String_type schema_name,
const String_type object_name,
enum_mdl_type  mt = MDL_EXCLUSIVE,
enum_mdl_duration  md = MDL_TRANSACTION 
)
inline

Convenience function for obtaining MDL.

Sets up the MDL_request struct and populates it, before calling Mdl_context::acquire_lock.

Parameters
thdthread context
nsMDL key namespace
schema_nameschema name
object_nameobject name
mtMDL type
mdMDL duration
Returns
value from Mdl_context::acquire_lock

◆ ptr_as_cref()

template<typename T >
const T & dd::sdi_utils::ptr_as_cref ( const T *  p)