-
Notifications
You must be signed in to change notification settings - Fork 552
-
Notifications
You must be signed in to change notification settings - Fork 552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: plugins.sql-support avoid quote the string on user demand. #872
Comments
Why could't you add a sqlStatement ? $element.queryBuilder({
filters: ...,
sqlStatements: {
custom: function() {
return {
add: function(rule, value) {
escape or passthru
},
run: function() {
return null;
}
};
}
}
});
$element.queryBuilder('getSQL', 'custom'); |
I don't understand this sentence. SQL statements should be mandary in any database communication, especially when dealing whith user inputs. |
I'm creating a plugin to do it so how can i modify/add the sqlStatements from a plugin? See: #221 (comment)
I try to said that we don' t need an statement when we have not parameters :) but probably i said something different, sorry i need to sleep a little, but childrens in house = chaos. It will work as you suggest, but i was searching for a solution from inside a plugin. Thanks. |
QueryBuilder.defaults({
sqlStatements: {
custom: ...
},
}); exactly like the SQL plugin is adding it's own configuration. |
Lot of Thanks. |
Unfortunately the sqlStatements are filtered and then only the default Statements are allowed: jQuery-QueryBuilder/src/plugins/sql-support/plugin.js Lines 655 to 659 in 73cb350
if i add the 'custom' to the regular expression it work, but that required modify the code. Probably that function can search for custom defined statemens and allow them if they are defined instead of only allow the default values? |
Do you plan to publish this plugin ? If not you override an existing statement function. |
I have not an specific plan to published the plugin, but i have not problem to published it if needed by someone else. What it try to solve It's an open issue here anyway. The inconvenient i see is just break the compatibility with upstream. It's really hard bifurcate a lot of jquery plugins and maintain then in also a lot of sites at same time (sure you know). If I change the plugin when i need to update it, I will lose the changes I made on it years before and it's hard remember what specific thing are needed by all of them. So, i always try to avoid divergence and not modify the upstream code as opposite. I always try to build a wrapper of the plugin. This are examples: So, yes is a lot of work i made trying to avoid an override. I understand your point anyway, but if you have a chance, please support it. Have a good day and really thanks a lot. |
If we are loading as values a set of table.columns values from a database like occurs in: #221, our values are string, but we want get it without quotes, because are columns not statistic values.
This is current impossible to handled in the getSql method because it just check for the value type:
jQuery-QueryBuilder/src/plugins/sql-support/plugin.js
Lines 321 to 323 in 73cb350
One idea is add a new sqlStatements that check for a variable in the current rule and with base on that disable the quote for that rule or not. Then the user can set that value in the rule on demand. But we can not add by our self an sqlStatements on demand. Also the usage of an sqlStatements in a standard sql have not semantic sense.
So, a solution, a workaround, an idea?
The text was updated successfully, but these errors were encountered: