Repository navigation
feat(experimental)!: write only raw values as SQL and quote names whole - #136
Merged
Merged
Conversation
…hole by default
format and escape write as SQL only a value raw() created, recognized by
an own mark shared through Symbol.for, and read its SQL without calling
its methods. Any other object with a toSqlString method is written as
any other object. unsafe: { toSqlString: true }, in format, escape, and
createOptions, brings back the method with the output of 1.x.
A name given to escapeId or bound to ??, and each key of an expanded
object, objectToValues included, is quoted as one identifier, keeping a
dot inside it. unsafe: { qualifiedNames: true }, in escapeId, format,
escape, and createOptions, splits it on each dot as 1.x did.
forbidQualified is no longer an option.
…d drop repeated tests
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #136 +/- ##
========================================
Coverage ? 100.00%
========================================
Files ? 33
Lines ? 3094
Branches ? 772
========================================
Hits ? 3094
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
formatandescapewrite a value as raw SQL only whenraw()created it. The mark is an own property, so JSON, a polluted prototype, or a Proxy that answers every key cannot pass for one, and no method of the value is called. Any other object with atoSqlStringmethod is an ordinary object.unsafe: { toSqlString: true }brings back detection by method with the same output.escapeId,??, and the keys of expanded objects keep a dot inside the name, as the server's own client quotes a name.unsafe: { qualifiedNames: true }brings back the split on dots, and a qualified name written by the developer uses??.??orescapeIdon each part.escapetakesqualifiedNamesfor the keys it writes, andforbidQualifiedis no longer an option.On Node,
escapeIdand??cost less without options, a raw value costs about 3 ns more, and the unsafe uses cost nothing extra in an object made bycreateOptions.