Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x 1x 2x 2x 2x 2x 1x 3x 3x 3x 3x 5x 5x 3x 3x 3x 3x 1x 1x 3x 3x 1x | import * as Expressions from "../../2_statements/expressions"; import {StatementNode} from "../../nodes"; import {Source} from "../expressions/source"; import {ScopeType} from "../_scope_type"; import {StructureType} from "../../types/basic"; import {TypedIdentifier} from "../../types/_typed_identifier"; import {Identifier} from "../../1_lexer/tokens/identifier"; import {DatabaseTable} from "../expressions/database_table"; import {Dynamic} from "../expressions/dynamic"; import {StatementSyntax} from "../_statement_syntax"; import {SyntaxInput} from "../_syntax_input"; export class UpdateDatabase implements StatementSyntax { public runSyntax(node: StatementNode, input: SyntaxInput): void { const dbtab = node.findFirstExpression(Expressions.DatabaseTable); if (dbtab !== undefined) { new DatabaseTable().runSyntax(dbtab, input); } const tableName = node.findDirectExpression(Expressions.DatabaseTable); const tokenName = tableName?.getFirstToken(); if (tableName && tokenName) { // todo, this also finds structures, it should only find transparent tables const found = input.scope.getDDIC().lookupTable(tokenName.getStr()); if (found instanceof StructureType) { input.scope.push(ScopeType.OpenSQL, "UPDATE", tokenName.getStart(), input.filename); for (const field of found.getComponents()) { const fieldToken = new Identifier(node.getFirstToken().getStart(), field.name); const id = new TypedIdentifier(fieldToken, input.filename, field.type); input.scope.addIdentifier(id); } } } for (const s of node.findAllExpressions(Expressions.Source)) { new Source().runSyntax(s, input); } for (const s of node.findAllExpressions(Expressions.SimpleSource3)) { new Source().runSyntax(s, input); } for (const d of node.findAllExpressions(Expressions.Dynamic)) { new Dynamic().runSyntax(d, input); } if (input.scope.getType() === ScopeType.OpenSQL) { input.scope.pop(node.getLastToken().getEnd()); } } } |