• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stephenafamo / bob / 14939098091

09 May 2025 10:59PM UTC coverage: 36.868% (-4.6%) from 41.506%
14939098091

push

github

stephenafamo
Move reusable sqlite parser components to antlrhelpers package

0 of 758 new or added lines in 12 files covered. (0.0%)

547 existing lines in 8 files now uncovered.

6533 of 17720 relevant lines covered (36.87%)

212.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/gen/bobgen-sqlite/driver/parser/visitor.go
1
package parser
2

3
import (
4
        "errors"
5
        "fmt"
6
        "slices"
7
        "strconv"
8
        "strings"
9
        "sync/atomic"
10

11
        "github.com/antlr4-go/antlr/v4"
12
        "github.com/stephenafamo/bob"
13
        antlrhelpers "github.com/stephenafamo/bob/gen/bobgen-helpers/parser/antlrhelpers"
14
        "github.com/stephenafamo/bob/internal"
15
        sqliteparser "github.com/stephenafamo/sqlparser/sqlite"
16
)
17

18
var _ sqliteparser.SQLiteParserVisitor = &visitor{}
19

UNCOV
20
func NewVisitor(db tables) *visitor {
×
UNCOV
21
        return &visitor{
×
NEW
22
                Visitor: antlrhelpers.Visitor[any, IndexExtra]{
×
NEW
23
                        DB:        db,
×
NEW
24
                        Names:     make(map[NodeKey]string),
×
NEW
25
                        Infos:     make(map[NodeKey]NodeInfo),
×
NEW
26
                        Functions: defaultFunctions,
×
NEW
27
                        Atom:      &atomic.Int64{},
×
NEW
28
                },
×
UNCOV
29
        }
×
UNCOV
30
}
×
31

32
type visitor struct {
33
        antlrhelpers.Visitor[any, IndexExtra]
34
}
35

UNCOV
36
func (v *visitor) childVisitor() *visitor {
×
UNCOV
37
        return &visitor{
×
NEW
38
                Visitor: antlrhelpers.Visitor[any, IndexExtra]{
×
NEW
39
                        DB:        v.DB,
×
NEW
40
                        Names:     v.Visitor.Names,
×
NEW
41
                        Infos:     v.Visitor.Infos,
×
NEW
42
                        Functions: v.Functions,
×
NEW
43
                        Atom:      v.Atom,
×
NEW
44
                        Sources:   slices.Clone(v.Sources),
×
NEW
45
                },
×
UNCOV
46
        }
×
UNCOV
47
}
×
48

49
func (v *visitor) Visit(tree antlr.ParseTree) any { return tree.Accept(v) }
×
50

UNCOV
51
func (v *visitor) VisitChildren(ctx antlr.RuleNode) any {
×
NEW
52
        if v.Err != nil {
×
NEW
53
                v.Err = fmt.Errorf("visiting children: %w", v.Err)
×
54
                return nil
×
55
        }
×
56

UNCOV
57
        for i, child := range ctx.GetChildren() {
×
UNCOV
58
                if tree, ok := child.(antlr.ParseTree); ok {
×
UNCOV
59
                        tree.Accept(v)
×
UNCOV
60
                }
×
61

NEW
62
                if v.Err != nil {
×
NEW
63
                        v.Err = fmt.Errorf("visiting child %d: %w", i, v.Err)
×
64
                        return nil
×
65
                }
×
66
        }
67

UNCOV
68
        return nil
×
69
}
70

UNCOV
71
func (v *visitor) VisitTerminal(ctx antlr.TerminalNode) any {
×
UNCOV
72
        token := ctx.GetSymbol()
×
UNCOV
73
        literals := sqliteparser.SQLiteLexerLexerStaticData.LiteralNames
×
UNCOV
74
        if token.GetTokenType() >= len(literals) {
×
UNCOV
75
                return nil
×
UNCOV
76
        }
×
77

UNCOV
78
        literal := literals[token.GetTokenType()]
×
UNCOV
79
        if len(literal) < 4 {
×
UNCOV
80
                return nil
×
UNCOV
81
        }
×
NEW
82
        v.StmtRules = append(v.StmtRules, internal.Replace(
×
UNCOV
83
                token.GetStart(),
×
UNCOV
84
                token.GetStop(),
×
UNCOV
85
                literal[1:len(literal)-1],
×
UNCOV
86
        ))
×
UNCOV
87

×
UNCOV
88
        return nil
×
89
}
90

91
func (v *visitor) VisitErrorNode(_ antlr.ErrorNode) any { return nil }
×
92

UNCOV
93
func (v *visitor) VisitParse(ctx *sqliteparser.ParseContext) any {
×
UNCOV
94
        return ctx.Sql_stmt_list().Accept(v)
×
UNCOV
95
}
×
96

UNCOV
97
func (v *visitor) VisitSql_stmt_list(ctx *sqliteparser.Sql_stmt_listContext) any {
×
UNCOV
98
        stmts := ctx.AllSql_stmt()
×
NEW
99
        allresp := make([]StmtInfo, len(stmts))
×
UNCOV
100

×
UNCOV
101
        for i, stmt := range stmts {
×
UNCOV
102
                for _, child := range stmt.GetChildren() {
×
UNCOV
103
                        if _, isTerminal := child.(antlr.TerminalNode); isTerminal {
×
104
                                continue
×
105
                        }
106

NEW
107
                        v.Sources = nil
×
NEW
108
                        v.StmtRules = slices.Clone(v.BaseRules)
×
NEW
109
                        v.Atom = &atomic.Int64{}
×
UNCOV
110

×
UNCOV
111
                        resp := child.(antlr.ParseTree).Accept(v)
×
NEW
112
                        if v.Err != nil {
×
NEW
113
                                v.Err = fmt.Errorf("stmt %d: %w", i, v.Err)
×
114
                                return nil
×
115
                        }
×
116

NEW
117
                        info, ok := resp.([]ReturnColumn)
×
UNCOV
118
                        if !ok {
×
NEW
119
                                v.Err = fmt.Errorf("stmt %d: could not columns, got %T", i, resp)
×
120
                                return nil
×
121
                        }
×
122

UNCOV
123
                        var imports [][]string
×
UNCOV
124
                        queryType := bob.QueryTypeUnknown
×
UNCOV
125
                        mods := &strings.Builder{}
×
UNCOV
126

×
UNCOV
127
                        switch child := child.(type) {
×
UNCOV
128
                        case *sqliteparser.Select_stmtContext:
×
UNCOV
129
                                queryType = bob.QueryTypeSelect
×
UNCOV
130
                                imports = v.modSelect_stmt(child, mods)
×
131
                        case *sqliteparser.Insert_stmtContext:
×
132
                                queryType = bob.QueryTypeInsert
×
133
                                v.modInsert_stmt(child, mods)
×
134
                        case *sqliteparser.Update_stmtContext:
×
135
                                queryType = bob.QueryTypeUpdate
×
136
                                v.modUpdate_stmt(child, mods)
×
137
                        case *sqliteparser.Delete_stmtContext:
×
138
                                queryType = bob.QueryTypeDelete
×
139
                                v.modDelete_stmt(child, mods)
×
140
                        }
141

NEW
142
                        allresp[i] = StmtInfo{
×
NEW
143
                                QueryType: queryType,
×
NEW
144
                                Node:      stmt,
×
NEW
145
                                Columns:   info,
×
NEW
146
                                EditRules: slices.Clone(v.StmtRules),
×
NEW
147
                                Comment:   v.getCommentToLeft(stmt),
×
NEW
148
                                Mods:      mods,
×
NEW
149
                                Imports:   imports,
×
UNCOV
150
                        }
×
151

152
                }
153
        }
154

UNCOV
155
        return allresp
×
156
}
157

158
func (v *visitor) VisitSql_stmt(ctx *sqliteparser.Sql_stmtContext) any {
×
159
        return v.VisitChildren(ctx)
×
160
}
×
161

162
func (v *visitor) VisitAlter_table_stmt(ctx *sqliteparser.Alter_table_stmtContext) any {
×
163
        return v.VisitChildren(ctx)
×
164
}
×
165

166
func (v *visitor) VisitAnalyze_stmt(ctx *sqliteparser.Analyze_stmtContext) any {
×
167
        return v.VisitChildren(ctx)
×
168
}
×
169

170
func (v *visitor) VisitAttach_stmt(ctx *sqliteparser.Attach_stmtContext) any {
×
171
        return v.VisitChildren(ctx)
×
172
}
×
173

174
func (v *visitor) VisitBegin_stmt(ctx *sqliteparser.Begin_stmtContext) any {
×
175
        return v.VisitChildren(ctx)
×
176
}
×
177

178
func (v *visitor) VisitCommit_stmt(ctx *sqliteparser.Commit_stmtContext) any {
×
179
        return v.VisitChildren(ctx)
×
180
}
×
181

182
func (v *visitor) VisitRollback_stmt(ctx *sqliteparser.Rollback_stmtContext) any {
×
183
        return v.VisitChildren(ctx)
×
184
}
×
185

186
func (v *visitor) VisitSavepoint_stmt(ctx *sqliteparser.Savepoint_stmtContext) any {
×
187
        return v.VisitChildren(ctx)
×
188
}
×
189

190
func (v *visitor) VisitRelease_stmt(ctx *sqliteparser.Release_stmtContext) any {
×
191
        return v.VisitChildren(ctx)
×
192
}
×
193

194
func (v *visitor) VisitCreate_index_stmt(ctx *sqliteparser.Create_index_stmtContext) any {
×
195
        return v.VisitChildren(ctx)
×
196
}
×
197

198
func (v *visitor) VisitIndexed_column(ctx *sqliteparser.Indexed_columnContext) any {
×
199
        return v.VisitChildren(ctx)
×
200
}
×
201

202
func (v *visitor) VisitCreate_table_stmt(ctx *sqliteparser.Create_table_stmtContext) any {
×
203
        return v.VisitChildren(ctx)
×
204
}
×
205

206
func (v *visitor) VisitColumn_def(ctx *sqliteparser.Column_defContext) any {
×
207
        return v.VisitChildren(ctx)
×
208
}
×
209

UNCOV
210
func (v *visitor) VisitType_name(ctx *sqliteparser.Type_nameContext) any {
×
UNCOV
211
        return v.VisitChildren(ctx)
×
UNCOV
212
}
×
213

214
func (v *visitor) VisitColumn_constraint(ctx *sqliteparser.Column_constraintContext) any {
×
215
        return v.VisitChildren(ctx)
×
216
}
×
217

218
func (v *visitor) VisitSigned_number(ctx *sqliteparser.Signed_numberContext) any {
×
219
        return v.VisitChildren(ctx)
×
220
}
×
221

222
func (v *visitor) VisitTable_constraint(ctx *sqliteparser.Table_constraintContext) any {
×
223
        return v.VisitChildren(ctx)
×
224
}
×
225

226
func (v *visitor) VisitForeign_key_clause(ctx *sqliteparser.Foreign_key_clauseContext) any {
×
227
        return v.VisitChildren(ctx)
×
228
}
×
229

230
func (v *visitor) VisitConflict_clause(ctx *sqliteparser.Conflict_clauseContext) any {
×
231
        return v.VisitChildren(ctx)
×
232
}
×
233

234
func (v *visitor) VisitCreate_trigger_stmt(ctx *sqliteparser.Create_trigger_stmtContext) any {
×
235
        return v.VisitChildren(ctx)
×
236
}
×
237

238
func (v *visitor) VisitCreate_view_stmt(ctx *sqliteparser.Create_view_stmtContext) any {
×
239
        return v.VisitChildren(ctx)
×
240
}
×
241

242
func (v *visitor) VisitCreate_virtual_table_stmt(ctx *sqliteparser.Create_virtual_table_stmtContext) any {
×
243
        return v.VisitChildren(ctx)
×
244
}
×
245

246
func (v *visitor) VisitDelete_stmt(ctx *sqliteparser.Delete_stmtContext) any {
×
NEW
247
        v.Sources = append(
×
NEW
248
                v.Sources,
×
249
                v.getSourceFromTable(ctx.Qualified_table_name()),
×
250
        )
×
251

×
252
        v2 := v.childVisitor()
×
253
        v2.VisitChildren(ctx)
×
NEW
254
        if v2.Err != nil {
×
NEW
255
                v.Err = fmt.Errorf("insert stmt: %w", v2.Err)
×
256
                return nil
×
257
        }
×
NEW
258
        v.StmtRules = append(v.StmtRules, v2.StmtRules...)
×
259

×
260
        returning := ctx.Returning_clause()
×
261
        if returning == nil {
×
NEW
262
                return []ReturnColumn{}
×
263
        }
×
264

265
        source := v.sourceFromColumns(returning.AllResult_column())
×
NEW
266
        return source.Columns
×
267
}
268

269
func (v *visitor) VisitDetach_stmt(ctx *sqliteparser.Detach_stmtContext) any {
×
270
        return v.VisitChildren(ctx)
×
271
}
×
272

273
func (v *visitor) VisitDrop_stmt(ctx *sqliteparser.Drop_stmtContext) any {
×
274
        return v.VisitChildren(ctx)
×
275
}
×
276

277
func (v *visitor) VisitExpr_case(ctx *sqliteparser.Expr_caseContext) any {
×
278
        return v.VisitChildren(ctx)
×
279
}
×
280

UNCOV
281
func (v *visitor) VisitExpr_arithmetic(ctx *sqliteparser.Expr_arithmeticContext) any {
×
UNCOV
282
        v.VisitChildren(ctx)
×
NEW
283
        if v.Err != nil {
×
284
                return nil
×
285
        }
×
286

NEW
287
        lhsType := v.Infos[antlrhelpers.Key(ctx.GetLhs())].Type
×
NEW
288
        rhsType := v.Infos[antlrhelpers.Key(ctx.GetRhs())].Type
×
UNCOV
289

×
NEW
290
        typ := []NodeType{knownType("INTEGER", notNullable), knownType("REAL", notNullable)}
×
UNCOV
291

×
UNCOV
292
        switch {
×
UNCOV
293
        case len(lhsType) == 1 && len(rhsType) == 1:
×
NEW
294
                typ = []NodeType{knownType("REAL", notNullable)}
×
UNCOV
295
                lhs := lhsType[0]
×
UNCOV
296
                rhs := rhsType[0]
×
NEW
297
                if lhs.DBType == "INTEGER" &&
×
NEW
298
                        rhs.DBType == "INTEGER" {
×
NEW
299
                        typ = []NodeType{knownType("INTEGER", anyNullable(lhs.Nullable, rhs.Nullable))}
×
UNCOV
300
                }
×
301

302
        case len(lhsType) == 1 && len(rhsType) == 0:
×
NEW
303
                typ = []NodeType{knownType("REAL", notNullable)}
×
304
                lhs := lhsType[0]
×
NEW
305
                if lhs.DBType == "INTEGER" {
×
NEW
306
                        typ = []NodeType{knownType("INTEGER", lhs.Nullable)}
×
UNCOV
307
                }
×
308

UNCOV
309
        case len(lhsType) == 0 && len(rhsType) == 1:
×
NEW
310
                typ = []NodeType{knownType("REAL", notNullable)}
×
UNCOV
311
                rhs := rhsType[0]
×
NEW
312
                if rhs.DBType == "INTEGER" {
×
NEW
313
                        typ = []NodeType{knownType("INTEGER", rhs.Nullable)}
×
UNCOV
314
                }
×
315
        }
316

NEW
317
        v.UpdateInfo(NodeInfo{
×
NEW
318
                Node:            ctx,
×
UNCOV
319
                ExprDescription: "Arithmetic",
×
UNCOV
320
                Type:            typ,
×
UNCOV
321
        })
×
UNCOV
322

×
NEW
323
        v.UpdateInfo(NodeInfo{
×
NEW
324
                Node:            ctx.GetLhs(),
×
UNCOV
325
                ExprDescription: "Arithmetic LHS",
×
UNCOV
326
                Type:            typ,
×
UNCOV
327
        })
×
UNCOV
328

×
NEW
329
        v.UpdateInfo(NodeInfo{
×
NEW
330
                Node:            ctx.GetRhs(),
×
UNCOV
331
                ExprDescription: "Arithmetic RHS",
×
UNCOV
332
                Type:            typ,
×
UNCOV
333
        })
×
UNCOV
334

×
UNCOV
335
        return nil
×
336
}
337

338
func (v *visitor) VisitExpr_json_extract_string(ctx *sqliteparser.Expr_json_extract_stringContext) any {
×
339
        v.VisitChildren(ctx)
×
NEW
340
        if v.Err != nil {
×
341
                return nil
×
342
        }
×
343

NEW
344
        v.UpdateInfo(NodeInfo{
×
NEW
345
                Node:            ctx,
×
346
                ExprDescription: "JSON->>",
×
NEW
347
                Type:            []NodeType{knownType("", nullable)},
×
348
        })
×
349

×
NEW
350
        v.UpdateInfo(NodeInfo{
×
NEW
351
                Node:            ctx.GetLhs(),
×
352
                ExprDescription: "JSON->> LHS",
×
NEW
353
                Type:            []NodeType{knownType("JSON", notNullable)},
×
354
        })
×
355

×
NEW
356
        v.UpdateInfo(NodeInfo{
×
NEW
357
                Node:            ctx.GetRhs(),
×
358
                ExprDescription: "JSON->> RHS",
×
NEW
359
                Type: []NodeType{
×
360
                        knownType("TEXT", notNullable),
×
361
                        knownType("INTEGER", notNullable),
×
362
                },
×
363
        })
×
364

×
365
        return nil
×
366
}
367

368
func (v *visitor) VisitExpr_raise(ctx *sqliteparser.Expr_raiseContext) any {
×
369
        return v.VisitChildren(ctx)
×
370
}
×
371

UNCOV
372
func (v *visitor) VisitExpr_bool(ctx *sqliteparser.Expr_boolContext) any {
×
UNCOV
373
        v.VisitChildren(ctx)
×
NEW
374
        if v.Err != nil {
×
375
                return nil
×
376
        }
×
377

NEW
378
        v.UpdateInfo(NodeInfo{
×
NEW
379
                Node:            ctx,
×
UNCOV
380
                ExprDescription: "AND/OR",
×
NEW
381
                Type:            []NodeType{knownType("BOOLEAN", notNullable)},
×
UNCOV
382
        })
×
UNCOV
383

×
NEW
384
        v.UpdateInfo(NodeInfo{
×
NEW
385
                Node:            ctx.GetLhs(),
×
UNCOV
386
                ExprDescription: "AND/OR LHS",
×
NEW
387
                Type:            []NodeType{knownType("BOOLEAN", nullable)},
×
UNCOV
388
        })
×
UNCOV
389

×
NEW
390
        v.UpdateInfo(NodeInfo{
×
NEW
391
                Node:            ctx.GetRhs(),
×
UNCOV
392
                ExprDescription: "AND/OR RHS",
×
NEW
393
                Type:            []NodeType{knownType("BOOLEAN", nullable)},
×
UNCOV
394
        })
×
UNCOV
395

×
UNCOV
396
        return nil
×
397
}
398

UNCOV
399
func (v *visitor) VisitExpr_is(ctx *sqliteparser.Expr_isContext) any {
×
UNCOV
400
        v.VisitChildren(ctx)
×
NEW
401
        if v.Err != nil {
×
402
                return nil
×
403
        }
×
404

NEW
405
        v.UpdateInfo(NodeInfo{
×
NEW
406
                Node:            ctx,
×
UNCOV
407
                ExprDescription: "IS",
×
NEW
408
                Type:            []NodeType{knownType("BOOLEAN", notNullable)},
×
UNCOV
409
        })
×
UNCOV
410

×
NEW
411
        v.UpdateInfo(NodeInfo{
×
NEW
412
                Node:            ctx.GetLhs(),
×
UNCOV
413
                ExprDescription: "IS LHS",
×
UNCOV
414
                ExprRef:         ctx.GetRhs(),
×
NEW
415
                Type:            []NodeType{knownType("", nullable)},
×
UNCOV
416
        })
×
UNCOV
417

×
NEW
418
        v.UpdateInfo(NodeInfo{
×
NEW
419
                Node:            ctx.GetRhs(),
×
UNCOV
420
                ExprDescription: "IS RHS",
×
UNCOV
421
                ExprRef:         ctx.GetLhs(),
×
NEW
422
                Type:            []NodeType{knownType("", nullable)},
×
UNCOV
423
        })
×
UNCOV
424

×
UNCOV
425
        return nil
×
426
}
427

428
func (v *visitor) VisitExpr_concat(ctx *sqliteparser.Expr_concatContext) any {
×
429
        v.VisitChildren(ctx)
×
NEW
430
        if v.Err != nil {
×
431
                return nil
×
432
        }
×
433

NEW
434
        v.UpdateInfo(NodeInfo{
×
NEW
435
                Node:            ctx,
×
436
                ExprDescription: "Concat",
×
NEW
437
                Type:            []NodeType{knownType("TEXT", notNullable)},
×
438
        })
×
439

×
NEW
440
        v.UpdateInfo(NodeInfo{
×
NEW
441
                Node:            ctx.GetLhs(),
×
442
                ExprDescription: "Concat LHS",
×
NEW
443
                Type:            []NodeType{knownType("TEXT", notNullable)},
×
444
        })
×
445

×
NEW
446
        v.UpdateInfo(NodeInfo{
×
NEW
447
                Node:            ctx.GetRhs(),
×
448
                ExprDescription: "Concat RHS",
×
NEW
449
                Type:            []NodeType{knownType("TEXT", notNullable)},
×
450
        })
×
451

×
452
        return nil
×
453
}
454

UNCOV
455
func (v *visitor) VisitExpr_list(ctx *sqliteparser.Expr_listContext) any {
×
UNCOV
456
        exprs := ctx.AllExpr()
×
UNCOV
457
        if len(exprs) == 1 {
×
NEW
458
                v.MaybeSetName(ctx, v.GetName(exprs[0]))
×
UNCOV
459
        }
×
460

NEW
461
        v.StmtRules = append(v.StmtRules, internal.RecordPoints(
×
UNCOV
462
                ctx.GetStart().GetStart(),
×
UNCOV
463
                ctx.GetStop().GetStop(),
×
UNCOV
464
                func(start, end int) error {
×
NEW
465
                        v.UpdateInfo(NodeInfo{
×
NEW
466
                                Node:            ctx,
×
UNCOV
467
                                ExprDescription: "LIST",
×
UNCOV
468
                                EditedPosition:  [2]int{start, end},
×
NEW
469
                                IsGroup:         true,
×
UNCOV
470
                        })
×
UNCOV
471
                        return nil
×
UNCOV
472
                },
×
473
        )...)
474

UNCOV
475
        return v.VisitChildren(ctx)
×
476
}
477

478
func (v *visitor) VisitExpr_in(ctx *sqliteparser.Expr_inContext) any {
×
479
        v.VisitChildren(ctx)
×
NEW
480
        if v.Err != nil {
×
481
                return nil
×
482
        }
×
483

484
        rhsExpr := ctx.GetRhsExpr()
×
485
        rhsList, rhsIsList := rhsExpr.(*sqliteparser.Expr_listContext)
×
486
        if !rhsIsList {
×
487
                return nil
×
488
        }
×
489
        rhsChildren := rhsList.AllExpr()
×
490

×
491
        // If there is only one child, it can be multiple
×
492
        singleIn := len(rhsChildren) == 1
×
493

×
494
        lhs := ctx.GetLhs()
×
495
        lhsList, lhsIsList := lhs.(*sqliteparser.Expr_listContext)
×
496
        var lhsChildren []sqliteparser.IExprContext
×
497
        if lhsIsList {
×
498
                lhsChildren = lhsList.AllExpr()
×
499
        }
×
NEW
500
        lhsChildNames := make([]string, len(lhsChildren))
×
NEW
501
        for i, child := range lhsChildren {
×
NEW
502
                lhsChildNames[i] = v.GetName(child)
×
NEW
503
        }
×
504

NEW
505
        lhsName := v.GetName(lhs)
×
506

×
507
        for _, child := range rhsChildren {
×
NEW
508
                v.UpdateInfo(NodeInfo{
×
NEW
509
                        Node:                 child,
×
510
                        ExprDescription:      "IN RHS",
×
511
                        ExprRef:              lhs,
×
512
                        IgnoreRefNullability: true,
×
513
                        CanBeMultiple:        singleIn,
×
514
                })
×
NEW
515
                v.MaybeSetName(child, lhsName)
×
516

×
517
                childList, childIsList := child.(*sqliteparser.Expr_listContext)
×
518
                if !childIsList {
×
519
                        continue
×
520
                }
521
                grandChildren := childList.AllExpr()
×
522

×
523
                if len(grandChildren) != len(lhsChildren) {
×
NEW
524
                        v.Err = fmt.Errorf("IN: list length mismatch %d != %d", len(grandChildren), len(lhsChildren))
×
525
                        return nil
×
526
                }
×
527

528
                for i, grandChild := range grandChildren {
×
NEW
529
                        v.UpdateInfo(NodeInfo{
×
NEW
530
                                Node:                 grandChild,
×
531
                                ExprDescription:      "IN RHS List",
×
532
                                ExprRef:              lhsChildren[i],
×
533
                                IgnoreRefNullability: true,
×
534
                        })
×
NEW
535
                        v.MaybeSetName(grandChild, lhsChildNames[i])
×
536
                }
×
537

NEW
538
                v.StmtRules = append(v.StmtRules, internal.RecordPoints(
×
539
                        childList.GetStart().GetStart(),
×
540
                        childList.GetStop().GetStop(),
×
541
                        func(start, end int) error {
×
NEW
542
                                v.UpdateInfo(NodeInfo{
×
NEW
543
                                        Node:           childList,
×
544
                                        EditedPosition: [2]int{start, end},
×
545
                                })
×
546
                                return nil
×
547
                        },
×
548
                )...)
549
        }
550

551
        return nil
×
552
}
553

554
func (v *visitor) VisitExpr_collate(ctx *sqliteparser.Expr_collateContext) any {
×
555
        return v.VisitChildren(ctx)
×
556
}
×
557

558
// Visit a parse tree produced by SQLiteParser#expr_modulo.
559
func (v *visitor) VisitExpr_modulo(ctx *sqliteparser.Expr_moduloContext) any {
×
560
        v.VisitChildren(ctx)
×
NEW
561
        if v.Err != nil {
×
562
                return nil
×
563
        }
×
564

NEW
565
        v.UpdateInfo(NodeInfo{
×
NEW
566
                Node:            ctx,
×
567
                ExprDescription: "Modulo",
×
NEW
568
                Type:            []NodeType{knownType("INTEGER", notNullable)},
×
569
        })
×
570

×
NEW
571
        v.UpdateInfo(NodeInfo{
×
NEW
572
                Node:            ctx.GetLhs(),
×
573
                ExprDescription: "Modulo LHS",
×
NEW
574
                Type:            []NodeType{knownType("INTEGER", notNullable)},
×
575
        })
×
576

×
NEW
577
        v.UpdateInfo(NodeInfo{
×
NEW
578
                Node:            ctx.GetRhs(),
×
579
                ExprDescription: "Modulo RHS",
×
NEW
580
                Type:            []NodeType{knownType("INTEGER", notNullable)},
×
581
        })
×
582

×
583
        return nil
×
584
}
585

UNCOV
586
func (v *visitor) VisitExpr_qualified_column_name(ctx *sqliteparser.Expr_qualified_column_nameContext) any {
×
NEW
587
        v.MaybeSetName(
×
UNCOV
588
                ctx,
×
UNCOV
589
                getName(ctx.Column_name()),
×
UNCOV
590
        )
×
UNCOV
591

×
UNCOV
592
        v.VisitChildren(ctx)
×
NEW
593
        if v.Err != nil {
×
594
                return nil
×
595
        }
×
596

NEW
597
        v.UpdateInfo(NodeInfo{
×
NEW
598
                Node:            ctx,
×
UNCOV
599
                ExprDescription: "Qualified",
×
NEW
600
                Type:            makeRef(v.Sources, ctx),
×
UNCOV
601
        })
×
UNCOV
602

×
UNCOV
603
        return nil
×
604
}
605

606
func (v *visitor) VisitExpr_match(ctx *sqliteparser.Expr_matchContext) any {
×
607
        v.VisitChildren(ctx)
×
NEW
608
        if v.Err != nil {
×
609
                return nil
×
610
        }
×
611

NEW
612
        v.UpdateInfo(NodeInfo{
×
NEW
613
                Node:            ctx,
×
614
                ExprDescription: "Match",
×
NEW
615
                Type:            []NodeType{knownType("BOOLEAN", notNullable)},
×
616
        })
×
617

×
NEW
618
        v.UpdateInfo(NodeInfo{
×
NEW
619
                Node:            ctx.GetRhs(),
×
620
                ExprDescription: "Modulo RHS",
×
NEW
621
                Type:            []NodeType{knownType("TEXT", notNullable)},
×
622
        })
×
623

×
624
        return nil
×
625
}
626

627
func (v *visitor) VisitExpr_like(ctx *sqliteparser.Expr_likeContext) any {
×
628
        v.VisitChildren(ctx)
×
NEW
629
        if v.Err != nil {
×
630
                return nil
×
631
        }
×
632

NEW
633
        v.UpdateInfo(NodeInfo{
×
NEW
634
                Node:            ctx,
×
635
                ExprDescription: "LIKE",
×
NEW
636
                Type:            []NodeType{knownType("BOOLEAN", notNullable)},
×
637
        })
×
638

×
NEW
639
        v.UpdateInfo(NodeInfo{
×
NEW
640
                Node:            ctx.GetLhs(),
×
641
                ExprDescription: "Like LHS",
×
NEW
642
                Type:            []NodeType{knownType("TEXT", notNullable)},
×
643
        })
×
644

×
NEW
645
        v.UpdateInfo(NodeInfo{
×
NEW
646
                Node:            ctx.GetRhs(),
×
647
                ExprDescription: "Like RHS",
×
NEW
648
                Type:            []NodeType{knownType("TEXT", notNullable)},
×
649
        })
×
650

×
651
        return nil
×
652
}
653

654
func (v *visitor) VisitExpr_null_comp(ctx *sqliteparser.Expr_null_compContext) any {
×
655
        v.VisitChildren(ctx)
×
NEW
656
        if v.Err != nil {
×
657
                return nil
×
658
        }
×
659

NEW
660
        v.UpdateInfo(NodeInfo{
×
NEW
661
                Node:            ctx,
×
662
                ExprDescription: "NULL Comparison",
×
NEW
663
                Type:            []NodeType{knownType("BOOLEAN", notNullable)},
×
664
        })
×
665

×
NEW
666
        v.UpdateInfo(NodeInfo{
×
NEW
667
                Node:            ctx.Expr(),
×
668
                ExprDescription: "NULL Comparison Expr",
×
NEW
669
                Type:            []NodeType{knownType("", notNullable)},
×
670
        })
×
671

×
672
        return nil
×
673
}
674

675
func (v *visitor) VisitExpr_json_extract_json(ctx *sqliteparser.Expr_json_extract_jsonContext) any {
×
676
        v.VisitChildren(ctx)
×
NEW
677
        if v.Err != nil {
×
678
                return nil
×
679
        }
×
680

NEW
681
        v.UpdateInfo(NodeInfo{
×
NEW
682
                Node:            ctx,
×
683
                ExprDescription: "JSON->",
×
NEW
684
                Type:            []NodeType{knownType("JSON", notNullable)},
×
685
        })
×
686

×
NEW
687
        v.UpdateInfo(NodeInfo{
×
NEW
688
                Node:            ctx.GetLhs(),
×
689
                ExprDescription: "JSON-> LHS",
×
NEW
690
                Type:            []NodeType{knownType("JSON", notNullable)},
×
691
        })
×
692

×
NEW
693
        v.UpdateInfo(NodeInfo{
×
NEW
694
                Node:            ctx.GetRhs(),
×
695
                ExprDescription: "JSON-> RHS",
×
NEW
696
                Type:            []NodeType{knownType("TEXT", notNullable)},
×
697
        })
×
698

×
699
        return nil
×
700
}
701

702
func (v *visitor) VisitExpr_exists_select(ctx *sqliteparser.Expr_exists_selectContext) any {
×
703
        return v.VisitChildren(ctx)
×
704
}
×
705

UNCOV
706
func (v *visitor) VisitExpr_comparison(ctx *sqliteparser.Expr_comparisonContext) any {
×
UNCOV
707
        v.VisitChildren(ctx)
×
NEW
708
        if v.Err != nil {
×
UNCOV
709
                return nil
×
710
        }
×
711

NEW
712
        v.UpdateInfo(NodeInfo{
×
NEW
713
                Node:            ctx,
×
UNCOV
714
                ExprDescription: "Comparison",
×
NEW
715
                Type:            []NodeType{knownType("BOOLEAN", notNullable)},
×
UNCOV
716
        })
×
UNCOV
717

×
NEW
718
        v.UpdateInfo(NodeInfo{
×
NEW
719
                Node:                 ctx.GetLhs(),
×
UNCOV
720
                ExprDescription:      "Comparison LHS",
×
UNCOV
721
                ExprRef:              ctx.GetRhs(),
×
UNCOV
722
                IgnoreRefNullability: true,
×
UNCOV
723
        })
×
UNCOV
724

×
NEW
725
        v.UpdateInfo(NodeInfo{
×
NEW
726
                Node:                 ctx.GetRhs(),
×
UNCOV
727
                ExprDescription:      "Comparison RHS",
×
UNCOV
728
                ExprRef:              ctx.GetLhs(),
×
UNCOV
729
                IgnoreRefNullability: true,
×
UNCOV
730
        })
×
UNCOV
731

×
NEW
732
        v.MatchNames(ctx.GetLhs(), ctx.GetRhs())
×
NEW
733

×
UNCOV
734
        return nil
×
735
}
736

UNCOV
737
func (v *visitor) VisitExpr_literal(ctx *sqliteparser.Expr_literalContext) any {
×
UNCOV
738
        v.VisitChildren(ctx)
×
NEW
739
        if v.Err != nil {
×
740
                return nil
×
741
        }
×
742

NEW
743
        var DBType NodeType
×
UNCOV
744

×
UNCOV
745
        typ := ctx.Literal_value().GetLiteralType().GetTokenType()
×
UNCOV
746
        switch typ {
×
747
        case sqliteparser.SQLiteParserNUMERIC_LITERAL:
×
NEW
748
                v.MaybeSetName(ctx, ctx.GetText())
×
749

×
750
                if strings.ContainsAny(ctx.GetText(), ".eE") {
×
751
                        DBType = knownType("REAL", notNullable)
×
752
                        break
×
753
                }
754

755
                text := strings.ReplaceAll(ctx.GetText(), "_", "")
×
756
                if len(text) < 2 {
×
757
                        DBType = knownType("INTEGER", notNullable)
×
758
                        break
×
759
                }
760

761
                base := 10
×
762

×
763
                if strings.EqualFold(text[0:2], "0x") {
×
764
                        text = text[2:]
×
765
                        base = 16
×
766
                }
×
767

768
                _, err := strconv.ParseInt(text, base, 64)
×
769
                if err == nil {
×
770
                        DBType = knownType("INTEGER", notNullable)
×
771
                        break
×
772
                }
773

774
                if errors.Is(err, strconv.ErrRange) {
×
775
                        DBType = knownType("REAL", notNullable)
×
776
                        break
×
777
                }
778

NEW
779
                v.Err = fmt.Errorf("cannot parse numeric integer: %s", ctx.GetText())
×
780
                return nil
×
781

UNCOV
782
        case sqliteparser.SQLiteParserSTRING_LITERAL:
×
UNCOV
783
                DBType = knownType("TEXT", notNullable)
×
UNCOV
784
                txt := strings.ReplaceAll(ctx.GetText(), "'", "")
×
NEW
785
                v.MaybeSetName(ctx, txt)
×
786

787
        case sqliteparser.SQLiteParserBLOB_LITERAL:
×
788
                DBType = knownType("BLOB", notNullable)
×
NEW
789
                v.MaybeSetName(ctx, "BLOB")
×
790

UNCOV
791
        case sqliteparser.SQLiteParserNULL_:
×
UNCOV
792
                DBType = knownType("", nullable)
×
NEW
793
                v.MaybeSetName(ctx, "NULL")
×
794

795
        case sqliteparser.SQLiteParserTRUE_,
796
                sqliteparser.SQLiteParserFALSE_:
×
797
                DBType = knownType("BOOLEAN", notNullable)
×
NEW
798
                v.MaybeSetName(ctx, ctx.GetText())
×
799

800
        case sqliteparser.SQLiteParserCURRENT_TIME_,
801
                sqliteparser.SQLiteParserCURRENT_DATE_,
802
                sqliteparser.SQLiteParserCURRENT_TIMESTAMP_:
×
803
                DBType = knownType("DATETIME", notNullable)
×
NEW
804
                v.MaybeSetName(ctx, ctx.GetText()[:len(ctx.GetText())-1])
×
805

806
        default:
×
NEW
807
                v.Err = fmt.Errorf("unknown literal type: %d", typ)
×
808
                return nil
×
809
        }
810

NEW
811
        info := NodeInfo{
×
NEW
812
                Node:            ctx,
×
UNCOV
813
                ExprDescription: "Literal",
×
UNCOV
814
        }
×
UNCOV
815

×
NEW
816
        if len(DBType.DBType) > 0 {
×
NEW
817
                info.Type = []NodeType{DBType}
×
UNCOV
818
        }
×
819

NEW
820
        v.UpdateInfo(info)
×
UNCOV
821

×
UNCOV
822
        return nil
×
823
}
824

UNCOV
825
func (v *visitor) VisitExpr_cast(ctx *sqliteparser.Expr_castContext) any {
×
UNCOV
826
        v.VisitChildren(ctx)
×
NEW
827
        if v.Err != nil {
×
828
                return nil
×
829
        }
×
830

NEW
831
        v.UpdateInfo(NodeInfo{
×
NEW
832
                Node:            ctx,
×
UNCOV
833
                ExprDescription: "CAST",
×
NEW
834
                Type:            []NodeType{knownType(ctx.Type_name().GetText(), notNullable)},
×
UNCOV
835
        })
×
UNCOV
836

×
UNCOV
837
        return nil
×
838
}
839

840
func (v *visitor) VisitExpr_string_op(ctx *sqliteparser.Expr_string_opContext) any {
×
841
        v.VisitChildren(ctx)
×
NEW
842
        if v.Err != nil {
×
843
                return nil
×
844
        }
×
845

NEW
846
        v.UpdateInfo(NodeInfo{
×
NEW
847
                Node:            ctx,
×
848
                ExprDescription: "String OP",
×
NEW
849
                Type:            []NodeType{knownType("BOOLEAN", notNullable)},
×
850
        })
×
851

×
NEW
852
        v.UpdateInfo(NodeInfo{
×
NEW
853
                Node:            ctx.GetLhs(),
×
854
                ExprDescription: "String OP LHS",
×
NEW
855
                Type:            []NodeType{knownType("TEXT", notNullable)},
×
856
        })
×
857

×
NEW
858
        v.UpdateInfo(NodeInfo{
×
NEW
859
                Node:            ctx.GetRhs(),
×
860
                ExprDescription: "String OP RHS",
×
NEW
861
                Type:            []NodeType{knownType("TEXT", notNullable)},
×
862
        })
×
863

×
864
        return nil
×
865
}
866

867
func (v *visitor) VisitExpr_between(ctx *sqliteparser.Expr_betweenContext) any {
×
868
        return v.VisitChildren(ctx)
×
869
}
×
870

871
func (v *visitor) VisitExpr_bitwise(ctx *sqliteparser.Expr_bitwiseContext) any {
×
872
        v.VisitChildren(ctx)
×
NEW
873
        if v.Err != nil {
×
874
                return nil
×
875
        }
×
876

NEW
877
        v.UpdateInfo(NodeInfo{
×
NEW
878
                Node:            ctx,
×
879
                ExprDescription: "Bitwise",
×
NEW
880
                Type:            []NodeType{knownType("INTEGER", notNullable)},
×
881
        })
×
882

×
NEW
883
        v.UpdateInfo(NodeInfo{
×
NEW
884
                Node:            ctx.GetLhs(),
×
885
                ExprDescription: "Bitwise LHS",
×
NEW
886
                Type:            []NodeType{knownType("INTEGER", notNullable)},
×
887
        })
×
888

×
NEW
889
        v.UpdateInfo(NodeInfo{
×
NEW
890
                Node:            ctx.GetRhs(),
×
891
                ExprDescription: "Bitwise RHS",
×
NEW
892
                Type:            []NodeType{knownType("INTEGER", notNullable)},
×
893
        })
×
894

×
895
        return nil
×
896
}
897

898
func (v *visitor) VisitExpr_unary(ctx *sqliteparser.Expr_unaryContext) any {
×
899
        v.VisitChildren(ctx)
×
NEW
900
        if v.Err != nil {
×
901
                return nil
×
902
        }
×
903

904
        tokenTyp := ctx.Unary_operator().GetOperator().GetTokenType()
×
905
        switch tokenTyp {
×
906
        case sqliteparser.SQLiteParserPLUS:
×
907
                // Returns the same type as the operand
×
NEW
908
                v.UpdateInfo(NodeInfo{
×
NEW
909
                        Node:            ctx,
×
910
                        ExprDescription: "Unary Plus",
×
911
                        ExprRef:         ctx.Expr(),
×
912
                })
×
913

×
NEW
914
                v.UpdateInfo(NodeInfo{
×
NEW
915
                        Node:            ctx.Expr(),
×
916
                        ExprDescription: "Unary Plus Expr",
×
917
                        ExprRef:         ctx,
×
918
                })
×
919

920
        case sqliteparser.SQLiteParserMINUS:
×
921
                // Always INTEGER, should be used with a numeric literal
×
NEW
922
                v.UpdateInfo(NodeInfo{
×
NEW
923
                        Node:            ctx,
×
924
                        ExprDescription: "Unary Minus",
×
NEW
925
                        Type:            []NodeType{knownType("INTEGER", notNullable), knownType("REAL", notNullable)},
×
926
                })
×
927

×
NEW
928
                v.UpdateInfo(NodeInfo{
×
NEW
929
                        Node:            ctx.Expr(),
×
930
                        ExprDescription: "Unary Minus Expr",
×
NEW
931
                        Type:            []NodeType{knownType("INTEGER", notNullable), knownType("REAL", notNullable)},
×
932
                })
×
933

934
        case sqliteparser.SQLiteParserTILDE:
×
935
                // Bitwise NOT
×
936
                // Always INTEGER, should be used with a numeric literal
×
NEW
937
                v.UpdateInfo(NodeInfo{
×
NEW
938
                        Node:            ctx,
×
939
                        ExprDescription: "Unary Tilde",
×
NEW
940
                        Type:            []NodeType{knownType("INTEGER", notNullable)},
×
941
                })
×
942

×
NEW
943
                v.UpdateInfo(NodeInfo{
×
NEW
944
                        Node:            ctx.Expr(),
×
945
                        ExprDescription: "Unary Tilde Expr",
×
NEW
946
                        Type:            []NodeType{knownType("INTEGER", notNullable)},
×
947
                })
×
948

949
        case sqliteparser.SQLiteParserNOT_:
×
950
                // Returns a BOOLEAN (should technically only be used with a boolean expression)
×
NEW
951
                v.UpdateInfo(NodeInfo{
×
NEW
952
                        Node:            ctx,
×
953
                        ExprDescription: "Unary NOT",
×
NEW
954
                        Type:            []NodeType{knownType("BOOLEAN", notNullable)},
×
955
                })
×
956

×
NEW
957
                v.UpdateInfo(NodeInfo{
×
NEW
958
                        Node:            ctx.Expr(),
×
959
                        ExprDescription: "Unary NOT Expr",
×
NEW
960
                        Type:            []NodeType{knownType("BOOLEAN", notNullable)},
×
961
                })
×
962
        }
963

964
        return nil
×
965
}
966

UNCOV
967
func (v *visitor) VisitExpr_bind(ctx *sqliteparser.Expr_bindContext) any {
×
UNCOV
968
        v.VisitChildren(ctx)
×
NEW
969
        if v.Err != nil {
×
970
                return nil
×
971
        }
×
972

NEW
973
        info := NodeInfo{
×
NEW
974
                Node:            ctx,
×
UNCOV
975
                ExprDescription: "Bind",
×
NEW
976
                ArgKey:          ctx.GetText()[1:],
×
UNCOV
977
        }
×
UNCOV
978

×
UNCOV
979
        if ctx.NAMED_BIND_PARAMETER() != nil {
×
NEW
980
                info.Config.Name = info.ArgKey
×
981
        }
×
982

UNCOV
983
        parent, ok := ctx.GetParent().(*sqliteparser.Expr_castContext)
×
UNCOV
984
        if ok {
×
UNCOV
985
                info.ExprRef = parent
×
UNCOV
986
        }
×
987

NEW
988
        v.UpdateInfo(info)
×
UNCOV
989

×
UNCOV
990
        // So it does not refer the same atomic
×
NEW
991
        a := v.Atom
×
NEW
992
        v.StmtRules = append(v.StmtRules, internal.EditCallback(
×
UNCOV
993
                internal.ReplaceFromFunc(
×
UNCOV
994
                        ctx.GetStart().GetStart(), ctx.GetStop().GetStop(),
×
UNCOV
995
                        func() string {
×
UNCOV
996
                                return fmt.Sprintf("?%d", a.Add(1))
×
UNCOV
997
                        },
×
998
                ),
UNCOV
999
                func(start, end int, _, _ string) error {
×
NEW
1000
                        v.UpdateInfo(NodeInfo{
×
NEW
1001
                                Node:           ctx,
×
UNCOV
1002
                                EditedPosition: [2]int{start, end},
×
UNCOV
1003
                        })
×
UNCOV
1004
                        return nil
×
UNCOV
1005
                }),
×
1006
        )
1007

UNCOV
1008
        return nil
×
1009
}
1010

1011
func (v *visitor) VisitExpr_simple_func(ctx *sqliteparser.Expr_simple_funcContext) any {
×
1012
        v.VisitChildren(ctx)
×
NEW
1013
        if v.Err != nil {
×
NEW
1014
                v.Err = fmt.Errorf("simple function invocation: %w", v.Err)
×
1015
                return nil
×
1016
        }
×
1017

1018
        args := ctx.AllExpr()
×
1019
        argTypes := make([]string, len(args))
×
1020
        missingTypes := make([]bool, len(args))
×
1021
        nullable := make([]func() bool, len(args))
×
1022
        for i, arg := range args {
×
NEW
1023
                argTypes[i] = v.Infos[antlrhelpers.Key(arg)].Type.ConfirmedDBType()
×
NEW
1024
                nullable[i] = v.Infos[antlrhelpers.Key(arg)].Type.Nullable
×
1025
                if argTypes[i] == "" {
×
1026
                        missingTypes[i] = true
×
1027
                }
×
1028
        }
1029

1030
        funcName := getName(ctx.Simple_func())
×
NEW
1031
        funcDef, err := antlrhelpers.GetFunctionType(v.Functions, funcName, argTypes)
×
1032
        if err != nil {
×
NEW
1033
                v.Err = fmt.Errorf("simple function invocation: %w", err)
×
1034
                return nil
×
1035
        }
×
1036

1037
        for i, arg := range args {
×
1038
                if missingTypes[i] {
×
NEW
1039
                        v.UpdateInfo(NodeInfo{
×
NEW
1040
                                Node:            arg,
×
1041
                                ExprDescription: "Function Arg",
×
NEW
1042
                                Type: []NodeType{knownType(
×
NEW
1043
                                        funcDef.ArgType(i),
×
NEW
1044
                                        func() bool { return funcDef.ShouldArgsBeNullable },
×
1045
                                )},
1046
                        })
1047
                }
1048
        }
1049

NEW
1050
        info := NodeInfo{
×
NEW
1051
                Node:            ctx,
×
1052
                ExprDescription: "Function Arg",
×
NEW
1053
                Type: []NodeType{knownType(
×
NEW
1054
                        funcDef.ReturnType,
×
1055
                        anyNullable(nullable...),
×
1056
                )},
×
1057
        }
×
1058

×
NEW
1059
        if funcDef.CalcNullable != nil {
×
NEW
1060
                info.Type[0].NullableF = funcDef.CalcNullable(nullable...)
×
UNCOV
1061
        }
×
1062

NEW
1063
        v.UpdateInfo(info)
×
NEW
1064
        v.MaybeSetName(ctx, funcName)
×
1065

×
1066
        return nil
×
1067
}
1068

1069
func (v *visitor) VisitExpr_aggregate_func(ctx *sqliteparser.Expr_aggregate_funcContext) any {
×
1070
        return v.VisitChildren(ctx)
×
1071
}
×
1072

1073
func (v *visitor) VisitExpr_window_func(ctx *sqliteparser.Expr_window_funcContext) any {
×
1074
        return v.VisitChildren(ctx)
×
1075
}
×
1076

1077
func (v *visitor) VisitRaise_function(ctx *sqliteparser.Raise_functionContext) any {
×
1078
        return v.VisitChildren(ctx)
×
1079
}
×
1080

UNCOV
1081
func (v *visitor) VisitLiteral_value(ctx *sqliteparser.Literal_valueContext) any {
×
UNCOV
1082
        return v.VisitChildren(ctx)
×
UNCOV
1083
}
×
1084

1085
func (v *visitor) VisitValue_row(ctx *sqliteparser.Value_rowContext) any {
×
1086
        return v.VisitChildren(ctx)
×
1087
}
×
1088

1089
func (v *visitor) VisitValues_clause(ctx *sqliteparser.Values_clauseContext) any {
×
1090
        return v.VisitChildren(ctx)
×
1091
}
×
1092

1093
func (v *visitor) VisitInsert_stmt(ctx *sqliteparser.Insert_stmtContext) any {
×
1094
        tableName := getName(ctx.Table_name())
×
1095
        tableSource := v.getSourceFromTable(ctx)
×
NEW
1096
        v.Sources = append(v.Sources, tableSource)
×
1097

×
1098
        // v2 := v.childVisitor()
×
1099
        v.VisitChildren(ctx)
×
NEW
1100
        if v.Err != nil {
×
NEW
1101
                v.Err = fmt.Errorf("insert stmt: %w", v.Err)
×
1102
                return nil
×
1103
        }
×
1104
        // v.stmtRules = append(v.stmtRules, v2.stmtRules...)
1105

1106
        columns := ctx.AllColumn_name()
×
1107
        colNames := make([]string, len(columns))
×
1108
        for i := range columns {
×
1109
                colNames[i] = getName(columns[i])
×
1110
        }
×
1111
        if len(colNames) == 0 {
×
NEW
1112
                colNames = make([]string, len(tableSource.Columns))
×
NEW
1113
                for i := range tableSource.Columns {
×
NEW
1114
                        colNames[i] = tableSource.Columns[i].Name
×
UNCOV
1115
                }
×
1116
        }
1117

1118
        if values := ctx.Values_clause(); values != nil {
×
1119
                rows := values.AllValue_row()
×
1120
                for _, row := range rows {
×
NEW
1121
                        v.MaybeSetName(row, tableName)
×
NEW
1122
                        v.StmtRules = append(v.StmtRules, internal.RecordPoints(
×
1123
                                row.GetStart().GetStart(),
×
1124
                                row.GetStop().GetStop(),
×
1125
                                func(start, end int) error {
×
NEW
1126
                                        v.UpdateInfo(NodeInfo{
×
NEW
1127
                                                Node:            row,
×
1128
                                                ExprDescription: "ROW",
×
1129
                                                EditedPosition:  [2]int{start, end},
×
NEW
1130
                                                IsGroup:         true,
×
1131
                                                CanBeMultiple:   len(rows) == 1,
×
1132
                                        })
×
1133
                                        return nil
×
1134
                                },
×
1135
                        )...)
1136

1137
                        for valIndex, value := range row.AllExpr() {
×
NEW
1138
                                v.UpdateInfo(NodeInfo{
×
NEW
1139
                                        Node:            value,
×
1140
                                        ExprDescription: "ROW Value",
×
NEW
1141
                                        Type: []NodeType{getColumnType(
×
NEW
1142
                                                v.DB,
×
1143
                                                getName(ctx.Schema_name()),
×
1144
                                                tableName,
×
1145
                                                colNames[valIndex],
×
1146
                                        )},
×
1147
                                })
×
1148

×
1149
                                if valIndex < len(colNames) {
×
NEW
1150
                                        v.MaybeSetName(value, colNames[valIndex])
×
1151
                                }
×
1152
                        }
1153
                }
1154
        }
1155

1156
        returning := ctx.Returning_clause()
×
1157
        if returning == nil {
×
NEW
1158
                return []ReturnColumn{}
×
1159
        }
×
1160

1161
        source := v.sourceFromColumns(returning.AllResult_column())
×
NEW
1162
        return source.Columns
×
1163
}
1164

1165
func (v *visitor) VisitReturning_clause(ctx *sqliteparser.Returning_clauseContext) any {
×
1166
        return v.VisitChildren(ctx)
×
1167
}
×
1168

1169
func (v *visitor) VisitUpsert_clause(ctx *sqliteparser.Upsert_clauseContext) any {
×
1170
        return v.VisitChildren(ctx)
×
1171
}
×
1172

1173
func (v *visitor) VisitPragma_stmt(ctx *sqliteparser.Pragma_stmtContext) any {
×
1174
        return v.VisitChildren(ctx)
×
1175
}
×
1176

1177
func (v *visitor) VisitPragma_value(ctx *sqliteparser.Pragma_valueContext) any {
×
1178
        return v.VisitChildren(ctx)
×
1179
}
×
1180

1181
func (v *visitor) VisitReindex_stmt(ctx *sqliteparser.Reindex_stmtContext) any {
×
1182
        return v.VisitChildren(ctx)
×
1183
}
×
1184

1185
// Should return a stmt info
UNCOV
1186
func (v *visitor) VisitSelect_stmt(ctx *sqliteparser.Select_stmtContext) any {
×
UNCOV
1187
        // Create a new visitor, to not mix sources
×
UNCOV
1188
        // however, we clone any existing sources to the new visitor
×
UNCOV
1189
        v2 := v.childVisitor()
×
UNCOV
1190

×
UNCOV
1191
        if ctx.With_clause() != nil {
×
UNCOV
1192
                ctx.With_clause().Accept(v2)
×
NEW
1193
                if v.Err != nil {
×
NEW
1194
                        v.Err = fmt.Errorf("with clause: %w", v.Err)
×
1195
                        return nil
×
1196
                }
×
1197
        }
1198

1199
        // Should return a source
1200
        // Use the first select core to get the columns
UNCOV
1201
        source := v2.visitSelect_core(ctx.Select_core())
×
NEW
1202
        if v2.Err != nil {
×
NEW
1203
                v.Err = fmt.Errorf("select core 0: %w", v2.Err)
×
1204
                return nil
×
1205
        }
×
NEW
1206
        v.StmtRules = append(v.StmtRules, v2.StmtRules...)
×
UNCOV
1207

×
UNCOV
1208
        for i, compound := range ctx.AllCompound_select() {
×
1209
                v3 := v.childVisitor()
×
1210

×
1211
                coreSource := v3.visitSelect_core(compound.Select_core())
×
NEW
1212
                if v3.Err != nil {
×
NEW
1213
                        v.Err = fmt.Errorf("select core %d: %w", i, v3.Err)
×
1214
                        return nil
×
1215
                }
×
1216

NEW
1217
                if len(source.Columns) != len(coreSource.Columns) {
×
NEW
1218
                        v.Err = fmt.Errorf("select core %d: column count mismatch %d != %d", i, len(source.Columns), len(coreSource.Columns))
×
UNCOV
1219
                }
×
1220

NEW
1221
                v.StmtRules = append(v.StmtRules, v3.StmtRules...)
×
1222

×
NEW
1223
                for i, col := range source.Columns {
×
NEW
1224
                        matchingTypes := col.Type.Match(coreSource.Columns[i].Type)
×
1225

×
NEW
1226
                        if len(source.Columns[i].Type) == 0 {
×
NEW
1227
                                v.Err = fmt.Errorf(
×
1228
                                        "select core %d: column %d type mismatch:\n%v\n%v",
×
NEW
1229
                                        i, i, col.Type, coreSource.Columns[i].Type,
×
1230
                                )
×
1231
                        }
×
1232

NEW
1233
                        source.Columns[i].Type = matchingTypes
×
1234
                }
1235
        }
1236

UNCOV
1237
        if order := ctx.Order_by_stmt(); order != nil {
×
UNCOV
1238
                order.Accept(v)
×
NEW
1239
                if v.Err != nil {
×
NEW
1240
                        v.Err = fmt.Errorf("order by: %w", v.Err)
×
1241
                        return nil
×
1242
                }
×
1243
        }
1244

UNCOV
1245
        if limit := ctx.Limit_stmt(); limit != nil {
×
1246
                limit.Accept(v)
×
NEW
1247
                if v.Err != nil {
×
NEW
1248
                        v.Err = fmt.Errorf("limit: %w", v.Err)
×
1249
                        return nil
×
1250
                }
×
1251
        }
1252

NEW
1253
        return source.Columns
×
1254
}
1255

1256
// Should return a query source
1257
func (v *visitor) VisitSelect_core(ctx *sqliteparser.Select_coreContext) any {
×
1258
        return nil // do not visit children automatically
×
1259
}
×
1260

1261
// Should return a query source
NEW
1262
func (v *visitor) visitSelect_core(ctx sqliteparser.ISelect_coreContext) QuerySource {
×
UNCOV
1263
        v.visitFrom_item(ctx.From_item())
×
NEW
1264
        if v.Err != nil {
×
NEW
1265
                v.Err = fmt.Errorf("from item: %w", v.Err)
×
NEW
1266
                return QuerySource{}
×
UNCOV
1267
        }
×
1268

1269
        // Evaluate all the expressions
UNCOV
1270
        v.VisitChildren(ctx)
×
NEW
1271
        if v.Err != nil {
×
NEW
1272
                v.Err = fmt.Errorf("select core children: %w", v.Err)
×
NEW
1273
                return QuerySource{}
×
UNCOV
1274
        }
×
1275

UNCOV
1276
        return v.sourceFromColumns(ctx.AllResult_column())
×
1277
}
1278

UNCOV
1279
func (v *visitor) VisitResult_column(ctx *sqliteparser.Result_columnContext) any {
×
UNCOV
1280
        return v.VisitChildren(ctx)
×
UNCOV
1281
}
×
1282

UNCOV
1283
func (v *visitor) visitFrom_item(ctx sqliteparser.IFrom_itemContext) {
×
UNCOV
1284
        tables := ctx.AllTable_or_subquery()
×
UNCOV
1285

×
NEW
1286
        sources := make([]QuerySource, len(tables))
×
UNCOV
1287
        for i, table := range tables {
×
UNCOV
1288
                sources[i] = v.visitTable_or_subquery(table)
×
NEW
1289
                if v.Err != nil {
×
NEW
1290
                        v.Err = fmt.Errorf("table or subquery %d: %w", i, v.Err)
×
1291
                        return
×
1292
                }
×
1293
        }
1294

UNCOV
1295
        for i, joinOp := range ctx.AllJoin_operator() {
×
UNCOV
1296
                fullJoin := joinOp.FULL_() != nil
×
UNCOV
1297
                leftJoin := fullJoin || joinOp.LEFT_() != nil
×
UNCOV
1298
                rightJoin := fullJoin || joinOp.RIGHT_() != nil
×
UNCOV
1299

×
UNCOV
1300
                if leftJoin {
×
1301
                        right := sources[i+1]
×
NEW
1302
                        for i := range right.Columns {
×
NEW
1303
                                for j := range right.Columns[i].Type {
×
NEW
1304
                                        right.Columns[i].Type[j].NullableF = nullable
×
UNCOV
1305
                                }
×
1306
                        }
1307
                }
1308

UNCOV
1309
                if rightJoin {
×
1310
                        left := sources[i+1]
×
NEW
1311
                        for i := range left.Columns {
×
NEW
1312
                                for j := range left.Columns[i].Type {
×
NEW
1313
                                        left.Columns[i].Type[j].NullableF = nullable
×
UNCOV
1314
                                }
×
1315
                        }
1316
                }
1317
        }
1318

NEW
1319
        v.Sources = append(v.Sources, sources...)
×
1320
}
1321

UNCOV
1322
func (v *visitor) VisitFrom_item(ctx *sqliteparser.From_itemContext) any {
×
UNCOV
1323
        // return v.VisitChildren(ctx)
×
UNCOV
1324
        return nil // do not visit children automatically
×
UNCOV
1325
}
×
1326

1327
func (v *visitor) VisitJoin_operator(ctx *sqliteparser.Join_operatorContext) any {
×
1328
        return v.VisitChildren(ctx)
×
1329
}
×
1330

1331
func (v *visitor) VisitJoin_constraint(ctx *sqliteparser.Join_constraintContext) any {
×
1332
        return v.VisitChildren(ctx)
×
1333
}
×
1334

1335
func (v *visitor) VisitTable_or_subquery(ctx *sqliteparser.Table_or_subqueryContext) any {
×
1336
        panic("should not be called")
×
1337
}
1338

NEW
1339
func (v *visitor) visitTable_or_subquery(ctx sqliteparser.ITable_or_subqueryContext) QuerySource {
×
UNCOV
1340
        switch {
×
UNCOV
1341
        case ctx.Table_name() != nil:
×
UNCOV
1342
                return v.getSourceFromTable(ctx)
×
1343

1344
        case ctx.Select_stmt() != nil:
×
NEW
1345
                columns, ok := ctx.Select_stmt().Accept(v).([]ReturnColumn)
×
NEW
1346
                if v.Err != nil {
×
NEW
1347
                        v.Err = fmt.Errorf("table select stmt: %w", v.Err)
×
NEW
1348
                        return QuerySource{}
×
1349
                }
×
1350
                if !ok {
×
NEW
1351
                        v.Err = fmt.Errorf("could not get stmt info")
×
NEW
1352
                        return QuerySource{}
×
UNCOV
1353
                }
×
1354

NEW
1355
                return QuerySource{
×
NEW
1356
                        Name:    getName(ctx.Table_alias()),
×
NEW
1357
                        Columns: columns,
×
UNCOV
1358
                }
×
1359

1360
        case ctx.Table_or_subquery() != nil:
×
1361
                return v.visitTable_or_subquery(ctx.Table_or_subquery())
×
1362

1363
        default:
×
NEW
1364
                v.Err = fmt.Errorf("unknown table or subquery: %#v", antlrhelpers.Key(ctx))
×
NEW
1365
                return QuerySource{}
×
1366
        }
1367
}
1368

1369
func (v *visitor) VisitCompound_select(ctx *sqliteparser.Compound_selectContext) any {
×
1370
        return v.VisitChildren(ctx)
×
1371
}
×
1372

1373
func (v *visitor) VisitCompound_operator(ctx *sqliteparser.Compound_operatorContext) any {
×
1374
        return v.VisitChildren(ctx)
×
1375
}
×
1376

1377
func (v *visitor) VisitUpdate_stmt(ctx *sqliteparser.Update_stmtContext) any {
×
1378
        table := ctx.Qualified_table_name()
×
1379
        tableName := getName(table.Table_name())
×
1380
        tableSource := v.getSourceFromTable(table)
×
NEW
1381
        v.Sources = append(v.Sources, tableSource)
×
1382

×
1383
        v2 := v.childVisitor()
×
1384
        v2.VisitChildren(ctx)
×
NEW
1385
        if v2.Err != nil {
×
NEW
1386
                v.Err = fmt.Errorf("insert stmt: %w", v2.Err)
×
1387
                return nil
×
1388
        }
×
NEW
1389
        v.StmtRules = append(v.StmtRules, v2.StmtRules...)
×
1390

×
1391
        exprs := ctx.AllExpr()
×
1392
        for i, nameOrList := range ctx.AllColumn_name_or_list() {
×
1393
                nameExpr := nameOrList.Column_name()
×
1394
                if nameExpr == nil {
×
1395
                        continue
×
1396
                }
1397
                colName := getName(nameExpr)
×
1398
                expr := exprs[i]
×
NEW
1399
                v.UpdateInfo(NodeInfo{
×
NEW
1400
                        Node:            expr,
×
1401
                        ExprDescription: "SET Expr",
×
NEW
1402
                        Type: []NodeType{getColumnType(
×
NEW
1403
                                v.DB,
×
1404
                                getName(table.Schema_name()),
×
1405
                                tableName,
×
1406
                                colName,
×
1407
                        )},
×
1408
                })
×
1409

×
NEW
1410
                v.MaybeSetName(expr, colName)
×
1411
        }
1412

1413
        v.visitFrom_item(ctx.From_item())
×
NEW
1414
        if v.Err != nil {
×
NEW
1415
                v.Err = fmt.Errorf("from item: %w", v.Err)
×
NEW
1416
                return QuerySource{}
×
UNCOV
1417
        }
×
1418

1419
        returning := ctx.Returning_clause()
×
1420
        if returning == nil {
×
NEW
1421
                return []ReturnColumn{}
×
1422
        }
×
1423

1424
        source := v.sourceFromColumns(returning.AllResult_column())
×
NEW
1425
        return source.Columns
×
1426
}
1427

1428
func (v *visitor) VisitColumn_name_or_list(ctx *sqliteparser.Column_name_or_listContext) any {
×
1429
        return v.VisitChildren(ctx)
×
1430
}
×
1431

1432
func (v *visitor) VisitColumn_name_list(ctx *sqliteparser.Column_name_listContext) any {
×
1433
        return v.VisitChildren(ctx)
×
1434
}
×
1435

1436
func (v *visitor) VisitQualified_table_name(ctx *sqliteparser.Qualified_table_nameContext) any {
×
1437
        return v.VisitChildren(ctx)
×
1438
}
×
1439

1440
func (v *visitor) VisitVacuum_stmt(ctx *sqliteparser.Vacuum_stmtContext) any {
×
1441
        return v.VisitChildren(ctx)
×
1442
}
×
1443

1444
func (v *visitor) VisitFilter_clause(ctx *sqliteparser.Filter_clauseContext) any {
×
1445
        return v.VisitChildren(ctx)
×
1446
}
×
1447

1448
func (v *visitor) VisitWindow_defn(ctx *sqliteparser.Window_defnContext) any {
×
1449
        return v.VisitChildren(ctx)
×
1450
}
×
1451

1452
func (v *visitor) VisitOver_clause(ctx *sqliteparser.Over_clauseContext) any {
×
1453
        return v.VisitChildren(ctx)
×
1454
}
×
1455

1456
func (v *visitor) VisitFrame_spec(ctx *sqliteparser.Frame_specContext) any {
×
1457
        return v.VisitChildren(ctx)
×
1458
}
×
1459

1460
func (v *visitor) VisitFrame_clause(ctx *sqliteparser.Frame_clauseContext) any {
×
1461
        return v.VisitChildren(ctx)
×
1462
}
×
1463

UNCOV
1464
func (v *visitor) VisitWith_clause(ctx *sqliteparser.With_clauseContext) any {
×
UNCOV
1465
        return v.VisitChildren(ctx)
×
UNCOV
1466
}
×
1467

UNCOV
1468
func (v *visitor) VisitCommon_table_expression(ctx *sqliteparser.Common_table_expressionContext) any {
×
NEW
1469
        columns, ok := ctx.Select_stmt().Accept(v).([]ReturnColumn)
×
NEW
1470
        if v.Err != nil {
×
NEW
1471
                v.Err = fmt.Errorf("CTE select stmt: %w", v.Err)
×
1472
                return nil
×
1473
        }
×
UNCOV
1474
        if !ok {
×
NEW
1475
                v.Err = fmt.Errorf("could not get stmt info")
×
1476
                return nil
×
1477
        }
×
1478

NEW
1479
        source := QuerySource{
×
NEW
1480
                Name:    getName(ctx.Table_name()),
×
NEW
1481
                Columns: columns,
×
NEW
1482
                CTE:     true,
×
UNCOV
1483
        }
×
UNCOV
1484

×
UNCOV
1485
        columnNames := ctx.AllColumn_name()
×
UNCOV
1486
        if len(columnNames) == 0 {
×
NEW
1487
                v.Sources = append(v.Sources, source)
×
1488
                return nil
×
1489
        }
×
1490

NEW
1491
        if len(columnNames) != len(source.Columns) {
×
NEW
1492
                v.Err = fmt.Errorf("column names do not match %d != %d", len(columnNames), len(source.Columns))
×
1493
                return nil
×
1494
        }
×
1495

UNCOV
1496
        for i, column := range columnNames {
×
NEW
1497
                source.Columns[i].Name = getName(column)
×
UNCOV
1498
        }
×
1499

NEW
1500
        v.Sources = append(v.Sources, source)
×
UNCOV
1501
        return nil
×
1502
}
1503

UNCOV
1504
func (v *visitor) VisitWhere_stmt(ctx *sqliteparser.Where_stmtContext) any {
×
UNCOV
1505
        v.VisitChildren(ctx)
×
NEW
1506
        if v.Err != nil {
×
NEW
1507
                v.Err = fmt.Errorf("where stmt: %w", v.Err)
×
1508
                return nil
×
1509
        }
×
1510

UNCOV
1511
        return nil
×
1512
}
1513

UNCOV
1514
func (v *visitor) VisitOrder_by_stmt(ctx *sqliteparser.Order_by_stmtContext) any {
×
UNCOV
1515
        return v.VisitChildren(ctx)
×
UNCOV
1516
}
×
1517

1518
func (v *visitor) VisitGroup_by_stmt(ctx *sqliteparser.Group_by_stmtContext) any {
×
1519
        return v.VisitChildren(ctx)
×
1520
}
×
1521

1522
func (v *visitor) VisitWindow_stmt(ctx *sqliteparser.Window_stmtContext) any {
×
1523
        return v.VisitChildren(ctx)
×
1524
}
×
1525

1526
func (v *visitor) VisitLimit_stmt(ctx *sqliteparser.Limit_stmtContext) any {
×
1527
        return v.VisitChildren(ctx)
×
1528
}
×
1529

UNCOV
1530
func (v *visitor) VisitOrdering_term(ctx *sqliteparser.Ordering_termContext) any {
×
UNCOV
1531
        return v.VisitChildren(ctx)
×
UNCOV
1532
}
×
1533

UNCOV
1534
func (v *visitor) VisitAsc_desc(ctx *sqliteparser.Asc_descContext) any {
×
UNCOV
1535
        return v.VisitChildren(ctx)
×
UNCOV
1536
}
×
1537

1538
func (v *visitor) VisitFrame_left(ctx *sqliteparser.Frame_leftContext) any {
×
1539
        return v.VisitChildren(ctx)
×
1540
}
×
1541

1542
func (v *visitor) VisitFrame_right(ctx *sqliteparser.Frame_rightContext) any {
×
1543
        return v.VisitChildren(ctx)
×
1544
}
×
1545

1546
func (v *visitor) VisitFrame_single(ctx *sqliteparser.Frame_singleContext) any {
×
1547
        return v.VisitChildren(ctx)
×
1548
}
×
1549

1550
func (v *visitor) VisitOffset(ctx *sqliteparser.OffsetContext) any {
×
1551
        return v.VisitChildren(ctx)
×
1552
}
×
1553

1554
func (v *visitor) VisitDefault_value(ctx *sqliteparser.Default_valueContext) any {
×
1555
        return v.VisitChildren(ctx)
×
1556
}
×
1557

1558
func (v *visitor) VisitPartition_by(ctx *sqliteparser.Partition_byContext) any {
×
1559
        return v.VisitChildren(ctx)
×
1560
}
×
1561

1562
func (v *visitor) VisitOrder_by_expr(ctx *sqliteparser.Order_by_exprContext) any {
×
1563
        return v.VisitChildren(ctx)
×
1564
}
×
1565

1566
func (v *visitor) VisitOrder_by_expr_asc_desc(ctx *sqliteparser.Order_by_expr_asc_descContext) any {
×
1567
        return v.VisitChildren(ctx)
×
1568
}
×
1569

1570
func (v *visitor) VisitUnary_operator(ctx *sqliteparser.Unary_operatorContext) any {
×
1571
        return v.VisitChildren(ctx)
×
1572
}
×
1573

1574
func (v *visitor) VisitError_message(ctx *sqliteparser.Error_messageContext) any {
×
1575
        return v.VisitChildren(ctx)
×
1576
}
×
1577

1578
func (v *visitor) VisitModule_argument(ctx *sqliteparser.Module_argumentContext) any {
×
1579
        return v.VisitChildren(ctx)
×
1580
}
×
1581

1582
func (v *visitor) VisitKeyword(ctx *sqliteparser.KeywordContext) any {
×
1583
        return v.VisitChildren(ctx)
×
1584
}
×
1585

UNCOV
1586
func (v *visitor) VisitName(ctx *sqliteparser.NameContext) any {
×
UNCOV
1587
        return v.VisitChildren(ctx)
×
UNCOV
1588
}
×
1589

1590
func (v *visitor) VisitFunction_name(ctx *sqliteparser.Function_nameContext) any {
×
1591
        return v.VisitChildren(ctx)
×
1592
}
×
1593

1594
func (v *visitor) VisitSchema_name(ctx *sqliteparser.Schema_nameContext) any {
×
1595
        return v.VisitChildren(ctx)
×
1596
}
×
1597

UNCOV
1598
func (v *visitor) VisitTable_name(ctx *sqliteparser.Table_nameContext) any {
×
UNCOV
1599
        return v.VisitChildren(ctx)
×
UNCOV
1600
}
×
1601

1602
func (v *visitor) VisitTable_or_index_name(ctx *sqliteparser.Table_or_index_nameContext) any {
×
1603
        return v.VisitChildren(ctx)
×
1604
}
×
1605

UNCOV
1606
func (v *visitor) VisitColumn_name(ctx *sqliteparser.Column_nameContext) any {
×
UNCOV
1607
        return v.VisitChildren(ctx)
×
UNCOV
1608
}
×
1609

1610
func (v *visitor) VisitCollation_name(ctx *sqliteparser.Collation_nameContext) any {
×
1611
        return v.VisitChildren(ctx)
×
1612
}
×
1613

1614
func (v *visitor) VisitForeign_table(ctx *sqliteparser.Foreign_tableContext) any {
×
1615
        return v.VisitChildren(ctx)
×
1616
}
×
1617

1618
func (v *visitor) VisitIndex_name(ctx *sqliteparser.Index_nameContext) any {
×
1619
        return v.VisitChildren(ctx)
×
1620
}
×
1621

1622
func (v *visitor) VisitTrigger_name(ctx *sqliteparser.Trigger_nameContext) any {
×
1623
        return v.VisitChildren(ctx)
×
1624
}
×
1625

1626
func (v *visitor) VisitView_name(ctx *sqliteparser.View_nameContext) any {
×
1627
        return v.VisitChildren(ctx)
×
1628
}
×
1629

1630
func (v *visitor) VisitModule_name(ctx *sqliteparser.Module_nameContext) any {
×
1631
        return v.VisitChildren(ctx)
×
1632
}
×
1633

1634
func (v *visitor) VisitPragma_name(ctx *sqliteparser.Pragma_nameContext) any {
×
1635
        return v.VisitChildren(ctx)
×
1636
}
×
1637

1638
func (v *visitor) VisitSavepoint_name(ctx *sqliteparser.Savepoint_nameContext) any {
×
1639
        return v.VisitChildren(ctx)
×
1640
}
×
1641

1642
func (v *visitor) VisitTable_alias(ctx *sqliteparser.Table_aliasContext) any {
×
1643
        return v.VisitChildren(ctx)
×
1644
}
×
1645

1646
func (v *visitor) VisitTransaction_name(ctx *sqliteparser.Transaction_nameContext) any {
×
1647
        return v.VisitChildren(ctx)
×
1648
}
×
1649

1650
func (v *visitor) VisitWindow_name(ctx *sqliteparser.Window_nameContext) any {
×
1651
        return v.VisitChildren(ctx)
×
1652
}
×
1653

UNCOV
1654
func (v *visitor) VisitAlias(ctx *sqliteparser.AliasContext) any {
×
UNCOV
1655
        return v.VisitChildren(ctx)
×
UNCOV
1656
}
×
1657

1658
func (v *visitor) VisitFilename(ctx *sqliteparser.FilenameContext) any {
×
1659
        return v.VisitChildren(ctx)
×
1660
}
×
1661

1662
func (v *visitor) VisitBase_window_name(ctx *sqliteparser.Base_window_nameContext) any {
×
1663
        return v.VisitChildren(ctx)
×
1664
}
×
1665

1666
func (v *visitor) VisitSimple_func(ctx *sqliteparser.Simple_funcContext) any {
×
1667
        return v.VisitChildren(ctx)
×
1668
}
×
1669

1670
func (v *visitor) VisitAggregate_func(ctx *sqliteparser.Aggregate_funcContext) any {
×
1671
        return v.VisitChildren(ctx)
×
1672
}
×
1673

1674
func (v *visitor) VisitWindow_func(ctx *sqliteparser.Window_funcContext) any {
×
1675
        return v.VisitChildren(ctx)
×
1676
}
×
1677

1678
func (v *visitor) VisitTable_function_name(ctx *sqliteparser.Table_function_nameContext) any {
×
1679
        return v.VisitChildren(ctx)
×
1680
}
×
1681

UNCOV
1682
func (v *visitor) VisitIdentifier(ctx *sqliteparser.IdentifierContext) any {
×
UNCOV
1683
        v.quoteIdentifier(ctx)
×
UNCOV
1684
        return v.VisitChildren(ctx)
×
UNCOV
1685
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc