[3.x] Remove problematic unused code when formatting SQL #924
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.
Fixes: #919
Replaces pull request #923 as per Dries' request
Formatted SQL preview:
which should be:
Telescope's
QueryWatcher
always stores an empty array for query parameter bindings.telescope/src/Watchers/QueryWatcher.php
Lines 39 to 41 in f5dee9a
This causes an issue in NPM package
sql-formatter
when the query has MySQL session variables referenced with an'@'
character. Using the generic SQL:2011 dialect, it's treated like a named placeholder (e.g., for MS SQL Server.)This expects a named options parameter as if
@user_id
is referenced within aWHERE
clause, e.g.,{params: {user_id: 1}}
Missing a named binding value, JavaScriptundefined
is instead filled in.Excluding the
params
option will stop the package from attempting to fill the placeholder.<query-preview>
cleanup.format()
method since the argument is never used.slotProps.entry.content.bindings
returned by the API endpoint is always[]
'bindings' => []
line also be removed? Does the JSON payload need that when PDO parameters are replaced before database insertion?sqlFormatter.format()
public API, pull in the exactStandardSqlFormatter
implementation. ES6 classesDb2Formatter
,N1qlFormatter
, &PlSqlFormatter
are also being unnecessarily bundled into Telescope's app.js. This shrinks the production file 813kb to 796kb. There's definitely more room for perf improvement here. e.g.,/**!
NPM package commentsentry
&batch
since query data is accessed via a slotted scope.