sql-query-identifier
sql-query-identifier copied to clipboard
MySQL 'DELIMITER' keyword is not supported
Currently it seems that this package doesn't support using MySQL's DELIMITER keyword which is commonly used with stored procedures which contain multiple statements.
I've created a very basic example below to highlight the issue in its simplest form:
Example Input
SELECT 1;
DELIMITER $
SELECT 2$
SELECT 3$
Expected Output (Suggestion) Not sure if this is the best solution, but just what I would have expected to see initially.
[
{
start: 1,
end: 9,
text: 'SELECT 1;',
type: 'SELECT',
executionType: 'LISTING',
parameters: []
},
{
start: 12,
end: 23,
text: 'DELIMITER $',
type: 'DELIMITER',
executionType: 'MODIFICATION',
parameters: []
},
{
start: 26,
end: 34,
text: 'SELECT 2$',
type: 'SELECT',
executionType: 'LISTING',
parameters: []
},
{
start: 37,
end: 45,
text: 'SELECT 3$',
type: 'SELECT',
executionType: 'LISTING',
parameters: []
}
]
Actual Output (with strict mode disabled)
[
{
start: 1,
end: 9,
text: 'SELECT 1;',
type: 'SELECT',
executionType: 'LISTING',
parameters: []
},
{
start: 12,
end: 45,
text: 'DELIMITER $\n\nSELECT 2$\n\nSELECT 3$\n',
type: 'UNKNOWN',
executionType: 'UNKNOWN',
parameters: []
}
]
Demo Incase it's useful, I've also created a functioning demo here