dt-sql-parser 4.5.1-beta.0 → 4.5.1-beta.2
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/lib/flink/FlinkSqlLexer.d.ts +399 -397
- package/dist/lib/flink/FlinkSqlLexer.js +2504 -2489
- package/dist/lib/flink/FlinkSqlParser.d.ts +617 -465
- package/dist/lib/flink/FlinkSqlParser.js +5014 -3359
- package/dist/lib/flink/FlinkSqlParserListener.d.ts +90 -0
- package/dist/lib/flink/FlinkSqlParserVisitor.d.ts +57 -0
- package/dist/lib/generic/GenericSqlListener.d.ts +5 -90
- package/dist/lib/generic/GenericSqlParser.d.ts +32 -101
- package/dist/lib/generic/GenericSqlParser.js +912 -1312
- package/dist/lib/generic/GenericSqlVisitor.d.ts +3 -56
- package/dist/lib/mysql/MySqlParser.d.ts +31 -8
- package/dist/lib/mysql/MySqlParser.js +5786 -5659
- package/dist/lib/mysql/MySqlParserListener.d.ts +33 -5
- package/dist/lib/mysql/MySqlParserVisitor.d.ts +20 -3
- package/dist/lib/postgresql/PostgreSqlParser.d.ts +19 -2
- package/dist/lib/postgresql/PostgreSqlParser.js +1857 -1756
- package/dist/lib/postgresql/PostgreSqlParserListener.d.ts +20 -5
- package/dist/lib/postgresql/PostgreSqlParserVisitor.d.ts +12 -3
- package/dist/lib/spark/SparkSqlParser.d.ts +1 -1
- package/dist/lib/spark/SparkSqlParser.js +2925 -2963
- package/dist/lib/trino/TrinoSqlLexer.d.ts +297 -296
- package/dist/lib/trino/TrinoSqlLexer.js +1451 -1445
- package/dist/lib/trino/TrinoSqlListener.d.ts +46 -0
- package/dist/lib/trino/TrinoSqlParser.d.ts +463 -411
- package/dist/lib/trino/TrinoSqlParser.js +5382 -5048
- package/dist/lib/trino/TrinoSqlVisitor.d.ts +29 -0
- package/dist/parser/common/basicSQL.d.ts +12 -0
- package/dist/parser/common/basicSQL.js +71 -0
- package/dist/parser/generic/genericEntityCollector.d.ts +3 -6
- package/dist/parser/generic/genericEntityCollector.js +21 -29
- package/dist/parser/generic/index.js +0 -15
- package/dist/parser/mysql/index.js +14 -0
- package/dist/parser/mysql/mysqlEntityCollector.d.ts +2 -1
- package/dist/parser/mysql/mysqlEntityCollector.js +5 -0
- package/dist/parser/postgresql/index.js +2 -1
- package/dist/parser/postgresql/postgreEntityCollector.d.ts +2 -1
- package/dist/parser/postgresql/postgreEntityCollector.js +5 -0
- package/dist/parser/trino/index.js +3 -1
- package/package.json +1 -1
|
@@ -138,6 +138,8 @@ import { RelationDefaultContext } from "./TrinoSqlParser.js";
|
|
|
138
138
|
import { JoinRelationContext } from "./TrinoSqlParser.js";
|
|
139
139
|
import { JoinTypeContext } from "./TrinoSqlParser.js";
|
|
140
140
|
import { JoinCriteriaContext } from "./TrinoSqlParser.js";
|
|
141
|
+
import { JoinColumnEqualityContext } from "./TrinoSqlParser.js";
|
|
142
|
+
import { JoinColumnReferenceContext } from "./TrinoSqlParser.js";
|
|
141
143
|
import { SampledRelationContext } from "./TrinoSqlParser.js";
|
|
142
144
|
import { SampleTypeContext } from "./TrinoSqlParser.js";
|
|
143
145
|
import { TrimsSpecificationContext } from "./TrinoSqlParser.js";
|
|
@@ -223,6 +225,7 @@ import { NullLiteralContext } from "./TrinoSqlParser.js";
|
|
|
223
225
|
import { RowConstructorContext } from "./TrinoSqlParser.js";
|
|
224
226
|
import { SubscriptContext } from "./TrinoSqlParser.js";
|
|
225
227
|
import { JsonExistsContext } from "./TrinoSqlParser.js";
|
|
228
|
+
import { CoalesceContext } from "./TrinoSqlParser.js";
|
|
226
229
|
import { CurrentPathContext } from "./TrinoSqlParser.js";
|
|
227
230
|
import { SubqueryExpressionContext } from "./TrinoSqlParser.js";
|
|
228
231
|
import { BinaryLiteralContext } from "./TrinoSqlParser.js";
|
|
@@ -355,6 +358,7 @@ import { CatalogNameCreateContext } from "./TrinoSqlParser.js";
|
|
|
355
358
|
import { FunctionNameContext } from "./TrinoSqlParser.js";
|
|
356
359
|
import { FunctionNameCreateContext } from "./TrinoSqlParser.js";
|
|
357
360
|
import { ColumnRefContext } from "./TrinoSqlParser.js";
|
|
361
|
+
import { EmptyColumnContext } from "./TrinoSqlParser.js";
|
|
358
362
|
import { ColumnNameContext } from "./TrinoSqlParser.js";
|
|
359
363
|
import { ColumnNameCreateContext } from "./TrinoSqlParser.js";
|
|
360
364
|
import { QualifiedNameContext } from "./TrinoSqlParser.js";
|
|
@@ -1319,6 +1323,18 @@ export declare class TrinoSqlVisitor<Result> extends AbstractParseTreeVisitor<Re
|
|
|
1319
1323
|
* @return the visitor result
|
|
1320
1324
|
*/
|
|
1321
1325
|
visitJoinCriteria?: (ctx: JoinCriteriaContext) => Result;
|
|
1326
|
+
/**
|
|
1327
|
+
* Visit a parse tree produced by `TrinoSqlParser.joinColumnEquality`.
|
|
1328
|
+
* @param ctx the parse tree
|
|
1329
|
+
* @return the visitor result
|
|
1330
|
+
*/
|
|
1331
|
+
visitJoinColumnEquality?: (ctx: JoinColumnEqualityContext) => Result;
|
|
1332
|
+
/**
|
|
1333
|
+
* Visit a parse tree produced by `TrinoSqlParser.joinColumnReference`.
|
|
1334
|
+
* @param ctx the parse tree
|
|
1335
|
+
* @return the visitor result
|
|
1336
|
+
*/
|
|
1337
|
+
visitJoinColumnReference?: (ctx: JoinColumnReferenceContext) => Result;
|
|
1322
1338
|
/**
|
|
1323
1339
|
* Visit a parse tree produced by `TrinoSqlParser.sampledRelation`.
|
|
1324
1340
|
* @param ctx the parse tree
|
|
@@ -1888,6 +1904,13 @@ export declare class TrinoSqlVisitor<Result> extends AbstractParseTreeVisitor<Re
|
|
|
1888
1904
|
* @return the visitor result
|
|
1889
1905
|
*/
|
|
1890
1906
|
visitJsonExists?: (ctx: JsonExistsContext) => Result;
|
|
1907
|
+
/**
|
|
1908
|
+
* Visit a parse tree produced by the `coalesce`
|
|
1909
|
+
* labeled alternative in `TrinoSqlParser.primaryExpression`.
|
|
1910
|
+
* @param ctx the parse tree
|
|
1911
|
+
* @return the visitor result
|
|
1912
|
+
*/
|
|
1913
|
+
visitCoalesce?: (ctx: CoalesceContext) => Result;
|
|
1891
1914
|
/**
|
|
1892
1915
|
* Visit a parse tree produced by the `currentPath`
|
|
1893
1916
|
* labeled alternative in `TrinoSqlParser.primaryExpression`.
|
|
@@ -2761,6 +2784,12 @@ export declare class TrinoSqlVisitor<Result> extends AbstractParseTreeVisitor<Re
|
|
|
2761
2784
|
* @return the visitor result
|
|
2762
2785
|
*/
|
|
2763
2786
|
visitColumnRef?: (ctx: ColumnRefContext) => Result;
|
|
2787
|
+
/**
|
|
2788
|
+
* Visit a parse tree produced by `TrinoSqlParser.emptyColumn`.
|
|
2789
|
+
* @param ctx the parse tree
|
|
2790
|
+
* @return the visitor result
|
|
2791
|
+
*/
|
|
2792
|
+
visitEmptyColumn?: (ctx: EmptyColumnContext) => Result;
|
|
2764
2793
|
/**
|
|
2765
2794
|
* Visit a parse tree produced by `TrinoSqlParser.columnName`.
|
|
2766
2795
|
* @param ctx the parse tree
|
|
@@ -95,10 +95,22 @@ export declare abstract class BasicSQL<L extends Lexer = Lexer, PRC extends Pars
|
|
|
95
95
|
private parseWithCache;
|
|
96
96
|
/**
|
|
97
97
|
* Validate input string and return syntax errors if exists.
|
|
98
|
+
* When input contains multiple statements separated by semicolons
|
|
99
|
+
* and the initial parse doesn't capture all errors, each statement
|
|
100
|
+
* is validated independently to collect all errors.
|
|
98
101
|
* @param input source string
|
|
99
102
|
* @returns syntax errors
|
|
100
103
|
*/
|
|
101
104
|
validate(input: string): ParseError[];
|
|
105
|
+
/**
|
|
106
|
+
* Validate each statement fragment independently and collect all errors.
|
|
107
|
+
*/
|
|
108
|
+
private validateStatements;
|
|
109
|
+
/**
|
|
110
|
+
* Split input into individual statement strings by semicolons.
|
|
111
|
+
* Handles semicolons inside quoted strings correctly.
|
|
112
|
+
*/
|
|
113
|
+
private splitStatements;
|
|
102
114
|
/**
|
|
103
115
|
* Get the input string that has been parsed.
|
|
104
116
|
*/
|
|
@@ -104,13 +104,84 @@ export class BasicSQL {
|
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
106
|
* Validate input string and return syntax errors if exists.
|
|
107
|
+
* When input contains multiple statements separated by semicolons
|
|
108
|
+
* and the initial parse doesn't capture all errors, each statement
|
|
109
|
+
* is validated independently to collect all errors.
|
|
107
110
|
* @param input source string
|
|
108
111
|
* @returns syntax errors
|
|
109
112
|
*/
|
|
110
113
|
validate(input) {
|
|
111
114
|
this.parseWithCache(input);
|
|
115
|
+
if (this._parseErrors.length > 0) {
|
|
116
|
+
const statements = this.splitStatements(input);
|
|
117
|
+
if (statements.length > 1) {
|
|
118
|
+
const splitErrors = this.validateStatements(statements);
|
|
119
|
+
if (splitErrors.length > this._parseErrors.length) {
|
|
120
|
+
this._parseErrors = splitErrors;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
112
124
|
return this._parseErrors;
|
|
113
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Validate each statement fragment independently and collect all errors.
|
|
128
|
+
*/
|
|
129
|
+
validateStatements(statements) {
|
|
130
|
+
const allErrors = [];
|
|
131
|
+
let lineOffset = 0;
|
|
132
|
+
for (const statement of statements) {
|
|
133
|
+
if (!statement.text.trim()) {
|
|
134
|
+
const newlines = (statement.text.match(/\n/g) || []).length;
|
|
135
|
+
lineOffset += newlines;
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
const parser = this.createParser(statement.text);
|
|
139
|
+
const errors = [];
|
|
140
|
+
parser.removeErrorListeners();
|
|
141
|
+
parser.addErrorListener(this.createErrorListener((error) => {
|
|
142
|
+
errors.push({
|
|
143
|
+
startLine: error.startLine + lineOffset,
|
|
144
|
+
endLine: error.endLine + lineOffset,
|
|
145
|
+
startColumn: error.startColumn,
|
|
146
|
+
endColumn: error.endColumn,
|
|
147
|
+
message: error.message,
|
|
148
|
+
});
|
|
149
|
+
}));
|
|
150
|
+
parser.errorHandler = new ErrorStrategy();
|
|
151
|
+
parser.program();
|
|
152
|
+
allErrors.push(...errors);
|
|
153
|
+
const newlines = (statement.text.match(/\n/g) || []).length;
|
|
154
|
+
lineOffset += newlines;
|
|
155
|
+
}
|
|
156
|
+
return allErrors;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Split input into individual statement strings by semicolons.
|
|
160
|
+
* Handles semicolons inside quoted strings correctly.
|
|
161
|
+
*/
|
|
162
|
+
splitStatements(input) {
|
|
163
|
+
const statements = [];
|
|
164
|
+
let inSingleQuote = false;
|
|
165
|
+
let inDoubleQuote = false;
|
|
166
|
+
let lastSplit = 0;
|
|
167
|
+
for (let i = 0; i < input.length; i++) {
|
|
168
|
+
const ch = input[i];
|
|
169
|
+
if (ch === "'" && !inDoubleQuote) {
|
|
170
|
+
inSingleQuote = !inSingleQuote;
|
|
171
|
+
}
|
|
172
|
+
else if (ch === '"' && !inSingleQuote) {
|
|
173
|
+
inDoubleQuote = !inDoubleQuote;
|
|
174
|
+
}
|
|
175
|
+
else if (ch === ';' && !inSingleQuote && !inDoubleQuote) {
|
|
176
|
+
statements.push({ text: input.slice(lastSplit, i + 1), start: lastSplit });
|
|
177
|
+
lastSplit = i + 1;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (lastSplit < input.length) {
|
|
181
|
+
statements.push({ text: input.slice(lastSplit), start: lastSplit });
|
|
182
|
+
}
|
|
183
|
+
return statements;
|
|
184
|
+
}
|
|
114
185
|
/**
|
|
115
186
|
* Get the input string that has been parsed.
|
|
116
187
|
*/
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import type { GenericSqlListener } from '../../lib/generic/GenericSqlListener';
|
|
2
|
-
import { AlterTableContext,
|
|
2
|
+
import { AlterTableContext, ColumnDefinitionContext, ColumnRefContext, CreateTableContext, DeleteContext, DropTableContext, InsertContext, QuerySpecificationContext, QueryStatementContext, SelectItemContext, SingleStatementContext, TableNameContext, TableNameCreateContext, UpdateContext } from '../../lib/generic/GenericSqlParser';
|
|
3
3
|
import { EntityCollector } from '../common/entityCollector';
|
|
4
4
|
export declare class GenericEntityCollector extends EntityCollector implements GenericSqlListener {
|
|
5
5
|
/** ====== Entity Begin */
|
|
6
6
|
exitTableName(ctx: TableNameContext): void;
|
|
7
7
|
exitTableNameCreate(ctx: TableNameCreateContext): void;
|
|
8
8
|
exitColumnRef(ctx: ColumnRefContext): void;
|
|
9
|
-
|
|
9
|
+
exitColumnDefinition(ctx: ColumnDefinitionContext): void;
|
|
10
10
|
exitQuerySpecification(ctx: QuerySpecificationContext): void;
|
|
11
|
-
|
|
12
|
-
exitSelectStarElement(ctx: SelectStarElementContext): void;
|
|
13
|
-
exitSelectAllElement(ctx: SelectAllElementContext): void;
|
|
14
|
-
exitSelectEmptyElement(ctx: SelectEmptyElementContext): void;
|
|
11
|
+
exitSelectItem(ctx: SelectItemContext): void;
|
|
15
12
|
private isSimpleColumnReference;
|
|
16
13
|
/** ===== Statement begin */
|
|
17
14
|
enterSingleStatement(ctx: SingleStatementContext): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColumnDefinitionContext, CreateTableStatementContext,
|
|
1
|
+
import { ColumnDefinitionContext, CreateTableStatementContext, SelectItemContext, } from '../../lib/generic/GenericSqlParser';
|
|
2
2
|
import { AttrName, ColumnDeclareType, EntityCollector, StmtContextType, TableDeclareType, } from '../common/entityCollector';
|
|
3
3
|
import { EntityContextType } from '../common/types';
|
|
4
4
|
export class GenericEntityCollector extends EntityCollector {
|
|
@@ -19,7 +19,7 @@ export class GenericEntityCollector extends EntityCollector {
|
|
|
19
19
|
exitColumnRef(ctx) {
|
|
20
20
|
this.pushEntity(ctx, EntityContextType.COLUMN);
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
exitColumnDefinition(ctx) {
|
|
23
23
|
this.pushEntity(ctx, EntityContextType.COLUMN_CREATE, [
|
|
24
24
|
{
|
|
25
25
|
attrName: AttrName.colType,
|
|
@@ -34,33 +34,25 @@ export class GenericEntityCollector extends EntityCollector {
|
|
|
34
34
|
exitQuerySpecification(ctx) {
|
|
35
35
|
this.pushEntity(ctx, EntityContextType.QUERY_RESULT);
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
this.pushEntity(ctx, EntityContextType.COLUMN, [], {
|
|
57
|
-
declareType: ColumnDeclareType.ALL,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
exitSelectEmptyElement(ctx) {
|
|
61
|
-
this.pushEntity(ctx, EntityContextType.COLUMN, [], {
|
|
62
|
-
declareType: ColumnDeclareType.LITERAL,
|
|
63
|
-
});
|
|
37
|
+
exitSelectItem(ctx) {
|
|
38
|
+
if (ctx.ASTERISK()) {
|
|
39
|
+
this.pushEntity(ctx, EntityContextType.COLUMN, [], {
|
|
40
|
+
declareType: ColumnDeclareType.ALL,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
const isSimpleColumn = this.isSimpleColumnReference(ctx);
|
|
45
|
+
this.pushEntity(ctx, EntityContextType.COLUMN, [
|
|
46
|
+
{
|
|
47
|
+
attrName: AttrName.alias,
|
|
48
|
+
endContextList: [SelectItemContext.name],
|
|
49
|
+
},
|
|
50
|
+
], {
|
|
51
|
+
declareType: isSimpleColumn
|
|
52
|
+
? ColumnDeclareType.LITERAL
|
|
53
|
+
: ColumnDeclareType.EXPRESSION,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
64
56
|
}
|
|
65
57
|
isSimpleColumnReference(ctx) {
|
|
66
58
|
const text = ctx.getText();
|
|
@@ -19,9 +19,6 @@ export class GenericSQL extends BasicSQL {
|
|
|
19
19
|
GenericSqlParser.RULE_tableName,
|
|
20
20
|
GenericSqlParser.RULE_tableNameCreate,
|
|
21
21
|
GenericSqlParser.RULE_columnRef,
|
|
22
|
-
GenericSqlParser.RULE_columnRefCreate,
|
|
23
|
-
GenericSqlParser.RULE_columnName,
|
|
24
|
-
GenericSqlParser.RULE_functionName,
|
|
25
22
|
...this.excludeKeywordRules,
|
|
26
23
|
]);
|
|
27
24
|
this._diagnostics = (options === null || options === void 0 ? void 0 : options.diagnostics) !== false;
|
|
@@ -71,18 +68,6 @@ export class GenericSQL extends BasicSQL {
|
|
|
71
68
|
syntaxContextType = EntityContextType.COLUMN;
|
|
72
69
|
break;
|
|
73
70
|
}
|
|
74
|
-
case GenericSqlParser.RULE_columnRefCreate: {
|
|
75
|
-
syntaxContextType = EntityContextType.COLUMN_CREATE;
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
case GenericSqlParser.RULE_columnName: {
|
|
79
|
-
syntaxContextType = EntityContextType.COLUMN;
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
case GenericSqlParser.RULE_functionName: {
|
|
83
|
-
syntaxContextType = EntityContextType.FUNCTION;
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
71
|
default:
|
|
87
72
|
break;
|
|
88
73
|
}
|
|
@@ -8,6 +8,13 @@ import { MysqlErrorListener } from './mysqlErrorListener';
|
|
|
8
8
|
import { MysqlSplitListener } from './mysqlSplitListener';
|
|
9
9
|
import { MySqlSemanticContextCollector } from '../mysql/mysqlSemanticContextCollector';
|
|
10
10
|
export { MySqlEntityCollector, MysqlSplitListener };
|
|
11
|
+
const ALLOW_EMPTY_COLUMN_PARENT_RULES = new Set([
|
|
12
|
+
MySqlParser.RULE_joinSpec,
|
|
13
|
+
MySqlParser.RULE_fromClause,
|
|
14
|
+
MySqlParser.RULE_orderByExpression,
|
|
15
|
+
MySqlParser.RULE_groupByItem,
|
|
16
|
+
MySqlParser.RULE_havingClause,
|
|
17
|
+
]);
|
|
11
18
|
export class MySQL extends BasicSQL {
|
|
12
19
|
constructor() {
|
|
13
20
|
super(...arguments);
|
|
@@ -26,6 +33,7 @@ export class MySQL extends BasicSQL {
|
|
|
26
33
|
MySqlParser.RULE_functionNameCreate,
|
|
27
34
|
MySqlParser.RULE_columnName,
|
|
28
35
|
MySqlParser.RULE_columnNamePath,
|
|
36
|
+
MySqlParser.RULE_columnNamePathAllowEmpty,
|
|
29
37
|
MySqlParser.RULE_columnNameCreate,
|
|
30
38
|
...this.excludeKeywordRules,
|
|
31
39
|
]);
|
|
@@ -94,6 +102,12 @@ export class MySQL extends BasicSQL {
|
|
|
94
102
|
syntaxContextType = EntityContextType.COLUMN;
|
|
95
103
|
break;
|
|
96
104
|
}
|
|
105
|
+
case MySqlParser.RULE_columnNamePathAllowEmpty: {
|
|
106
|
+
if (candidateRule.ruleList.some((rule) => ALLOW_EMPTY_COLUMN_PARENT_RULES.has(rule))) {
|
|
107
|
+
syntaxContextType = EntityContextType.COLUMN;
|
|
108
|
+
}
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
97
111
|
case MySqlParser.RULE_columnNameCreate: {
|
|
98
112
|
syntaxContextType = EntityContextType.COLUMN_CREATE;
|
|
99
113
|
break;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColumnCreateTableContext, ColumnNameCreateContext, CopyCreateTableContext, CreateDatabaseContext, CreateFunctionContext, CreateFunctionLoadableContext, CreateViewContext, DatabaseNameContext, DatabaseNameCreateContext, FunctionNameCreateContext, InsertStatementContext, QueryCreateTableContext, SelectElementsContext, SelectExpressionElementContext, SelectLiteralColumnNameContext, SelectStatementContext, SingleStatementContext, TableNameContext, TableNameCreateContext, ViewNameContext, ViewNameCreateContext, TableAllColumnsContext, AtomSubQueryTableSourceContext, PureAllColumnsContext, SelectElement_dot_emptyContext } from '../../lib/mysql/MySqlParser';
|
|
1
|
+
import { ColumnCreateTableContext, ColumnNameCreateContext, CopyCreateTableContext, CreateDatabaseContext, CreateFunctionContext, CreateFunctionLoadableContext, CreateViewContext, DatabaseNameContext, DatabaseNameCreateContext, FunctionNameCreateContext, InsertStatementContext, QueryCreateTableContext, SelectElementsContext, SelectExpressionElementContext, SelectLiteralColumnNameContext, SelectStatementContext, SingleStatementContext, TableNameContext, TableNameCreateContext, ViewNameContext, ViewNameCreateContext, TableAllColumnsContext, AtomSubQueryTableSourceContext, PureAllColumnsContext, SelectElement_dot_emptyContext, ColumnNamePath_dot_emptyContext } from '../../lib/mysql/MySqlParser';
|
|
2
2
|
import type { MySqlParserListener } from '../../lib/mysql/MySqlParserListener';
|
|
3
3
|
import { EntityCollector } from '../common/entityCollector';
|
|
4
4
|
export declare class MySqlEntityCollector extends EntityCollector implements MySqlParserListener {
|
|
@@ -19,6 +19,7 @@ export declare class MySqlEntityCollector extends EntityCollector implements MyS
|
|
|
19
19
|
exitPureAllColumns(ctx: PureAllColumnsContext): void;
|
|
20
20
|
exitSelectLiteralColumnName(ctx: SelectLiteralColumnNameContext): void;
|
|
21
21
|
exitSelectElement_dot_empty(ctx: SelectElement_dot_emptyContext): void;
|
|
22
|
+
exitColumnNamePath_dot_empty(ctx: ColumnNamePath_dot_emptyContext): void;
|
|
22
23
|
exitSelectExpressionElement(ctx: SelectExpressionElementContext): void;
|
|
23
24
|
/** ===== Statement begin */
|
|
24
25
|
enterSingleStatement(ctx: SingleStatementContext): void;
|
|
@@ -98,6 +98,11 @@ export class MySqlEntityCollector extends EntityCollector {
|
|
|
98
98
|
declareType: ColumnDeclareType.LITERAL,
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
+
exitColumnNamePath_dot_empty(ctx) {
|
|
102
|
+
this.pushEntity(ctx, EntityContextType.COLUMN, [], {
|
|
103
|
+
declareType: ColumnDeclareType.LITERAL,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
101
106
|
exitSelectExpressionElement(ctx) {
|
|
102
107
|
this.pushEntity(ctx, EntityContextType.COLUMN, [
|
|
103
108
|
{
|
|
@@ -130,7 +130,8 @@ export class PostgreSQL extends BasicSQL {
|
|
|
130
130
|
candidateRule.ruleList.includes(PostgreSqlParser.RULE_whereClause) ||
|
|
131
131
|
candidateRule.ruleList.includes(PostgreSqlParser.RULE_havingClause) ||
|
|
132
132
|
candidateRule.ruleList.includes(PostgreSqlParser.RULE_windowClause) ||
|
|
133
|
-
candidateRule.ruleList.includes(PostgreSqlParser.RULE_triggerWhen)
|
|
133
|
+
candidateRule.ruleList.includes(PostgreSqlParser.RULE_triggerWhen) ||
|
|
134
|
+
candidateRule.ruleList.includes(PostgreSqlParser.RULE_joinQual)) {
|
|
134
135
|
syntaxContextType = EntityContextType.COLUMN;
|
|
135
136
|
}
|
|
136
137
|
break;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AlterTableStmtContext, type ColumnCreateTableContext, type ColumnNameCreateContext, type CreateDatabaseContext, type CreateForeignTableContext, type CreateFunctionStmtContext, type CreateMaterializedViewContext, type CreatePartitionForeignTableContext, type CreateViewContext, type DatabaseNameContext, type DatabaseNameCreateContext, FuncTableContext, type FunctionNameCreateContext, type InsertStatementContext, type ProcedureNameContext, type ProcedureNameCreateContext, type QueryCreateTableContext, SelectExpressionColumnNameContext, SelectLiteralColumnNameContext, SelectNoParensContext, type SelectStatementContext, SelectWithParensContext, type SingleStmtContext, TableAllColumnsContext, type TableNameContext, type TableNameCreateContext, Target_dot_emptyContext, Target_emptyContext, TargetListContext, type ViewNameContext, type ViewNameCreateContext, XmlTableContext } from '../../lib/postgresql/PostgreSqlParser';
|
|
1
|
+
import { type AlterTableStmtContext, type ColumnCreateTableContext, type ColumnNameCreateContext, type CreateDatabaseContext, type CreateForeignTableContext, type CreateFunctionStmtContext, type CreateMaterializedViewContext, type CreatePartitionForeignTableContext, type CreateViewContext, type DatabaseNameContext, type DatabaseNameCreateContext, FuncTableContext, type FunctionNameCreateContext, type InsertStatementContext, type ProcedureNameContext, type ProcedureNameCreateContext, type QueryCreateTableContext, SelectExpressionColumnNameContext, SelectLiteralColumnNameContext, SelectNoParensContext, type SelectStatementContext, SelectWithParensContext, type SingleStmtContext, TableAllColumnsContext, type TableNameContext, type TableNameCreateContext, Target_dot_emptyContext, Target_emptyContext, ColumnNamePath_dot_emptyContext, TargetListContext, type ViewNameContext, type ViewNameCreateContext, XmlTableContext } from '../../lib/postgresql/PostgreSqlParser';
|
|
2
2
|
import type { PostgreSqlParserListener } from '../../lib/postgresql/PostgreSqlParserListener';
|
|
3
3
|
import { EntityCollector } from '../common/entityCollector';
|
|
4
4
|
export declare class PostgreSqlEntityCollector extends EntityCollector implements PostgreSqlParserListener {
|
|
@@ -18,6 +18,7 @@ export declare class PostgreSqlEntityCollector extends EntityCollector implement
|
|
|
18
18
|
exitTableAllColumns(ctx: TableAllColumnsContext): void;
|
|
19
19
|
exitTarget_empty(ctx: Target_emptyContext): void;
|
|
20
20
|
exitTarget_dot_empty(ctx: Target_dot_emptyContext): void;
|
|
21
|
+
exitColumnNamePath_dot_empty(ctx: ColumnNamePath_dot_emptyContext): void;
|
|
21
22
|
exitSelectExpressionColumnName(ctx: SelectExpressionColumnNameContext): void;
|
|
22
23
|
exitSelectLiteralColumnName(ctx: SelectLiteralColumnNameContext): void;
|
|
23
24
|
exitProcedureName(ctx: ProcedureNameContext): void;
|
|
@@ -105,6 +105,11 @@ export class PostgreSqlEntityCollector extends EntityCollector {
|
|
|
105
105
|
declareType: ColumnDeclareType.LITERAL,
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
|
+
exitColumnNamePath_dot_empty(ctx) {
|
|
109
|
+
this.pushEntity(ctx, EntityContextType.COLUMN, [], {
|
|
110
|
+
declareType: ColumnDeclareType.LITERAL,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
108
113
|
exitSelectExpressionColumnName(ctx) {
|
|
109
114
|
this.pushEntity(ctx, EntityContextType.COLUMN, [
|
|
110
115
|
{
|
|
@@ -115,9 +115,11 @@ export class TrinoSQL extends BasicSQL {
|
|
|
115
115
|
candidateRule.ruleList.includes(TrinoSqlParser.RULE_havingClause) ||
|
|
116
116
|
candidateRule.ruleList.includes(TrinoSqlParser.RULE_partitionBy) ||
|
|
117
117
|
candidateRule.ruleList.includes(TrinoSqlParser.RULE_whenClause) ||
|
|
118
|
-
candidateRule.ruleList.includes(TrinoSqlParser.RULE_relation)
|
|
118
|
+
candidateRule.ruleList.includes(TrinoSqlParser.RULE_relation) ||
|
|
119
|
+
candidateRule.ruleList.includes(TrinoSqlParser.RULE_joinCriteria)) {
|
|
119
120
|
syntaxContextType = EntityContextType.COLUMN;
|
|
120
121
|
}
|
|
122
|
+
break;
|
|
121
123
|
}
|
|
122
124
|
default:
|
|
123
125
|
break;
|