Add SqlString.fn
Function Call Proxy
#1
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds the ability to raw "escape" by calling any
SqlString.fn.*
property as a function.It takes the Proxy example from mysqljs#9 and merges it in directly into the library.
It only works on Node.js v6+ (according to node.green), but there is a check so that users of lower versions can use the library (without
SqlString.fn.*
support), which is a con mysqljs#9 didn't have..Examples:
Should be a lot more secure than mysqljs#9, since the escape function checks if the value from the
SqlString.fn.*
call is in an instance of an internal function class (SqlFunction
) that doesn't get exported. It also escapes all arguments.Playing (security) devils advocate:
SqlString.fn
orSqlString.escape
, you're screwed.Array.prototype.map
, you're screwed.