Skip to content

Enhancement for SQL bind-variables #162

@zipelkopf

Description

@zipelkopf

Hi, I'm using the formatter as part of a Visual Studio Code plugin and I'd like to suggest a minor change.

I'm using inline SQL (i.e. MySQL) with other coding languages like PHP and a common implementation is using the so called bind-variables that are escaped and passed into the SQL as parameters.
A special character is usually defined to identify the inline parameter within the SQL, like : but anything else (not reserved) can be used.

This is a SQL example before formatting, please note the :myParam

SELECT
	NULL
FROM
	t_sample
WHERE
	smp_id = :myParam

The problem is that any symbol near the parameter gets moved after formatting, changing from :myParam into : myParam.
See below

SELECT
	NULL
FROM
	t_sample
WHERE
	smp_id = : myParam

Is it possible to avoid this situation?
The syntax of the bind-variable should not get altered by getting split
Thanks a mill!

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