How do you debug MySQL stored procedures?

后端 未结 16 1283
旧时难觅i
旧时难觅i 2020-11-30 17:44

My current process for debugging stored procedures is very simple. I create a table called \"debug\" where I insert variable values from the stored procedure as it runs. Thi

16条回答
  •  醉话见心
    2020-11-30 18:12

    Another way is presented here

    http://gilfster.blogspot.co.at/2006/03/debugging-stored-procedures-in-mysql.html

    with custom debug mySql procedures and logging tables.

    You can also just place a simple select in your code and see if it is executed.

    SELECT 'Message Text' AS `Title`; 
    

    I got this idea from

    http://forums.mysql.com/read.php?99,78155,78225#msg-78225

    Also somebody created a template for custom debug procedures on GitHub.

    See here

    http://www.bluegecko.net/mysql/debugging-stored-procedures/ https://github.com/CaptTofu/Stored-procedure-debugging-routines

    Was mentioned here

    How to catch any exception in triggers and store procedures for mysql?

提交回复
热议问题