@query-doctor/core 0.8.0-rc.9 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -855,6 +855,12 @@ function stripTableQualifiers(node) {
|
|
|
855
855
|
//#endregion
|
|
856
856
|
//#region src/sql/analyzer.ts
|
|
857
857
|
const ignoredIdentifier = "__qd_placeholder";
|
|
858
|
+
const STATEMENT_TYPE_MAP = {
|
|
859
|
+
SelectStmt: "select",
|
|
860
|
+
InsertStmt: "insert",
|
|
861
|
+
UpdateStmt: "update",
|
|
862
|
+
DeleteStmt: "delete"
|
|
863
|
+
};
|
|
858
864
|
/**
|
|
859
865
|
* Analyzes a query and returns a list of column references that
|
|
860
866
|
* should be indexed.
|
|
@@ -870,6 +876,7 @@ var Analyzer = class {
|
|
|
870
876
|
if (!ast.stmts) throw new Error("Query did not have any statements. This should probably never happen?");
|
|
871
877
|
const stmt = ast.stmts[0].stmt;
|
|
872
878
|
if (!stmt) throw new Error("Query did not have any statements. This should probably never happen?");
|
|
879
|
+
const statementType = STATEMENT_TYPE_MAP[getNodeKind(stmt)] ?? "other";
|
|
873
880
|
const { highlights, indexRepresentations, indexesToCheck, shadowedAliases, tempTables, tableMappings, nudges } = new Walker(query).walk(stmt);
|
|
874
881
|
const sortedHighlights = highlights.sort((a, b) => b.position.end - a.position.end);
|
|
875
882
|
let currQuery = query;
|
|
@@ -907,6 +914,7 @@ var Analyzer = class {
|
|
|
907
914
|
const { tags, queryWithoutTags } = this.extractSqlcommenter(query);
|
|
908
915
|
const formattedQueryWithoutTags = formattedQuery ? this.extractSqlcommenter(formattedQuery).queryWithoutTags : void 0;
|
|
909
916
|
return {
|
|
917
|
+
statementType,
|
|
910
918
|
indexesToCheck,
|
|
911
919
|
ansiHighlightedQuery: currQuery,
|
|
912
920
|
referencedTables,
|