jQuery-QueryBuilder
jQuery-QueryBuilder copied to clipboard
[Feature] option to wrap the column names with backticks
as per https://github.com/mistic100/sql-parser/issues/5
have the output'ed sql output something like `column`="1"
instead of as it is now column="1"
i would suggest it gets added in as an "option" to not break backwards compatibility.
alternatively add in a "column_name_prefix" and "column_name_suffix" option?
For this to work with filters using table.column
as field, the field should allow an array, otherwise it will be serialized as `table.column`
instead of `table`.`column`
Or perhaps splitting by dot is enough
to be honest i still feel that the input should match the output. so instead of querybuilder trying to add in backticks should leave it to the rules to include it or not.
filters: [
{
"id": "`is_team`",
"label": "My team column",
"type": "string",
(FOR ANYONE SEEING THIS SNIPPET MISTIC100 HAS SAID DONT DO THIS, REMOVE THE BACKTICKS)
the visual side of querybuilder uses "label" in anycase so the user wont "see" id too often. leave the use backtick or not option to the developer.
the only problem i have seen so far is that the sql parser strips the id value of "other" characters. everything else "seems" to work when you add backticks to the filter id except for the parser
by moving it to the what-you-put-in-is-what-you-get-out part im sure you will get a lot less github "issues" cropping up from users wanting to do some strange things with the querybuilder
I will not modify SQLParser to leave the backtick, it makes no sense (it's a standalone parser not an extension to QueryBuilder)