1
votes

How to get PhpStorm data editor to recognize DELIMITER \\?

Scenario: I have a console open, and I want to create a function where I have ; defined in the function.

On execution, function create fails on the first line where ; exists.

The query is like so

DELIMITER //
create function blah (datablah varchar(200)) returns tinyint(1)
  BEGIN
   Return tinyintVar;
  END //
DELIMITER ;

This function works as intended too as it is in production and I want to copy it over into a dev DB. This is why I know the error is due to the delimiter.

But this is not the first time I've tried to do this in an open console with another function. When executing this SQL inline in the data editor console, it just doesn't detect or acknowledge the DELIMITER keyword. Even if I just run with Ctrl + Enter on the line with DELIMITER \\ I get the message "nothing to run".

Note: this will work if I have a .sql file and I just execute the file. But current workflow is to highlight the function from live DB, open editor to view the create function code and then Copy + Paste into the open console window I currently have open.

So, is the only way to get the DELIMIER recognized is to execute a .sql file?

PhpStorm 2018.2.2

The error is

[2018-09-05 12:07:33] [42000][1064] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(19), endPeriod DATETIME(19)) returns tinyint(1)
[2018-09-05 12:07:33] BEGIN
[2018-09-05 12:07:33] DECLARE live BOOLEA' at line 1

screenshot enter image description here

From the screenshot, you'll notice the execute group hasn't put the green box around the delimiter keywords. This is why I think it's not recognizing the keyword.

1
Running fine here. Please attach a screenshot of how you're running this + the error you're getting - Dmitrii
Have you tried selecting whole command (from DELIMITER // till DELIMITER ;) and execute the selection? Screenshots (or better screencast) would be very helpful here. - LazyOne
@LazyOne yes I have, that is how I execute all my commands as my open console window is basically a scratch pad of loads of SQL statements so I have to be explicted on which command I want to execute. - mushcraft
Do you have Introspect Using JDBC metadata on in the Options tab if datasource properties? If yes, turn it off - moscas
DELIMETER is the command line statement, it is out of scope intentionally. And why do you think this code actually works? - moscas

1 Answers

2
votes

As there is a Feature request to have it implemented I will say it's not supported.

DBE-2968: Ability to configure SQL Statement delimiter/terminator