Showing entries 1 to 2
Displaying posts with tag: sp (reset)
Warning and error information in stored procedures revisited

Originally way to handle warnings and errors in MySQL stored routine was designed as follows:


  • if warning was generated during stored routine execution which has a handler for such a warning/error, MySQL remembered the handler, ignored the warning and continued execution
  • after routine is executed MySQL checked if there is a remembered handler and activated if any

This logic was not ideal and causes several problems, particularly:


  • it was not possible to choose right handler for an instruction which generated several warnings or errors, because only first one was chosen
  • handling conditions in current scope messed with conditions in different
  • there were no generated warning/errors in Diagnostic Area that is against SQL Standard.

[Read more]
MySQL processlist – (show/kill processes)

It”s not the most common task in the world, but you might want to view processes from a particular user and once in a while you might even need to kill processes from a single user, be it during an attack or because you simply got a bug in an application bombarding your db server with connections!

Here is a small stored procedure which does exactly that!

call process_list("show","username","hostname");

– shows all processes owned by username@hostname

call process_list("kill","username","hostname");

– kills all processes owned by username@hostname

The code for this stored procedure can be found below. If you have any comments / suggestions feel free to comment below.

######################################################################
##                                        …

[Read more]
Showing entries 1 to 2