rdebug_watch_variables
NAME
rdebug_watch_variables(): List user defined variables and local variables visible and used within current scope, with their current values.TYPE
ProcedureDESCRIPTION
This procedure is part of the rdebug API.
rdebug_watch_variables() lists the names, locations and most importantly the values of local variables and user defined variables currently visible on the worker.
At any given time throughout the worker's execution, some variables are visible, some not (not in scope, such as variables belonging to a routine that called the currently executing routine). These would be routine parameters and local variables. Also, user defined variables can be used by a routine.
Any local variable/parameter which is visible at the time of calling rdebug_watch_variables(), and any user defined variable used by the current executing worker's routine, are presented along with their values. This excludes variables injected by rdebug itself, as these only serve to the purpose of managing the debugging session.
Execution of this routine only makes sense on an active debugging session, i.e. after calling rdebug_start().
SYNOPSIS
rdebug_watch_variables() READS SQL DATA
Output:
- routine_schema: schema of routine containing variable.
- routine_name: name of routine containing variable.
- variable_name: name of variable.
- variable_type: type of variable. Either:
- param: routine parameter
- local: local routine variable
- user_defined: user defined (session) variable
- variable_value: BLOB representation of current value.
EXAMPLES
Watch variables on a routine with only local variables:
mysql> call rdebug_watch_variables(); +----------------+--------------------+-------------------+---------------+----------------+ | routine_schema | routine_name | variable_name | variable_type | variable_value | +----------------+--------------------+-------------------+---------------+----------------+ | test | analyze_continents | current_continent | local | Europe | | test | analyze_continents | done | local | 0 | +----------------+--------------------+-------------------+---------------+----------------+
Watch variables on a routine with a parameter and which uses a user defined variable:
mysql> call rdebug_watch_variables(); +----------------+--------------------------+-------------------+---------------+----------------+ | routine_schema | routine_name | variable_name | variable_type | variable_value | +----------------+--------------------------+-------------------+---------------+----------------+ | test | analyze_continent_cities | @avg_count_cities | user_defined | 18.282608695 | | test | analyze_continent_cities | @count_countries | user_defined | 46 | | test | analyze_continent_cities | current_continent | param | Europe | +----------------+--------------------------+-------------------+---------------+----------------+