Skip to content

MySQL 'DELIMITER' keyword is not supported #66

@mike183

Description

@mike183

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions