Skip to content

Enhancement for SQL bind-variables #1

@zipelkopf

Description

@zipelkopf

Hi, thanks for your extension :-)

I'm using inline SQL 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 anthing else can be defined.

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

Would you consider enhancing your plugin with the following ideas?

  1. Add an optional parameter in the plugin's settings so to choose the symbol for bind-variables. Then alter the formatting accordingly by taking into accound the chosen symbol.
  2. Otherwise, if the above is too much, just fix the formatting. Perhaps symbols that are not reserved in the SQL context, like :, should not be moved of position.

Thanks a mill!

P.S. Some others formatting extensions do not have this problem, but they do not nicelly format like yours, so I hope for your help here :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions