INNER CODE UNIT · TypeScript

boundary

bytebase/dbhub · src/connectors/oracle/index.ts:813

    const boundary = /(?:\s|\/(?=[ \t]*(?:\r?\n|$)))*/y;
    // Plain SQL ends at a `;` or a `/` line.
    const plainEnd = /;|^[ \t]*\/[ \t]*$/gm;
    // PL/SQL block-depth tokens. `begin`, `case` and `compound trigger` open
    // depth; `end if` / `end loop` close constructs that never opened depth,
    // so they are neutral; every other `end` (bare, `end case`, a compound
    // trigger's `end before statement` & co.) closes one level.
    const token = /\b(begin|case|end|compound\s+trigger)\b(?:\s+(if|loop|case))?|;|^[ \t]*\/[ \t]*$/gim;

    const push = (start: number, end: number) => {
      const text = sql.slice(start, end).trim();
      if (text) statements.push(text);
    };

    let i = 0;
    while (i < blanked.length) {
      boundary.lastIndex = i;
      i += boundary.exec(blanked)![0].length;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…