Hi!
I use a variable when creating stored procedures to include a carriage return.
If you put this:
BEGIN
# Versión 1.3.0 - 20130201
SET @message := ''; -- Mensaje
SET @sep := '\n'; -- Separador de Mensajes
SET @message := CONCAT(@message, 'Linea 1', @sep);
SET @message := CONCAT(@message, 'Linea 2', @sep);
# Mensaje de ejecución de CREACION de TABLAS CRUZADAS
CALL common_schema.prettify_message('Ejemplo', common_schema.trim_wspace(@message));
END
You'll get this:
BEGIN
# Versión 1.3.0 - 20130201
SET @message := ''; -- Mensaje
SET @sep := '
'; -- Separador de Mensajes
SET @message := CONCAT(@message, 'Linea 1', @sep);
SET @message := CONCAT(@message, 'Linea 2', @sep);
# Mensaje de ejecución de CREACION de TABLAS CRUZADAS
CALL common_schema.prettify_message('Ejemplo', common_schema.trim_wspace(@message));
END
Stored Procedure error when using \n
This is a server issue. HeidiSQL takes the procedure code from IS:
Escaped input gets stored unescaped by MySQL. See
http://bugs.mysql.com/bug.php?id=58342
http://bugs.mysql.com/bug.php?id=62129
SELECT `ROUTINE_DEFINITION` FROM information_schema.`ROUTINES` WHERE `ROUTINE_SCHEMA`='yourdatabase' AND `ROUTINE_NAME`='yourroutinename' AND `ROUTINE_TYPE`='PROCEDURE';
Escaped input gets stored unescaped by MySQL. See
http://bugs.mysql.com/bug.php?id=58342
http://bugs.mysql.com/bug.php?id=62129
See also issue #3107.
Please read all comments there. Issue #3103 and issue #3104 are also relevant here. I had to move from the SHOW CREATE PROCEDURE approach to the SELECT .. FROM IS.VIEWS approach as it's now, to fix several other bugs in my parser. So, I fixed a few bugs and ran into a server bug unfortunately. I hope the server bug gets fixed at some point, as I don't want to break the other fixes again.
Please login to leave a reply, or register at first.