Class DdlStatusMessage

java.lang.Object
dev.frostlake.executor.DdlStatusMessage

public final class DdlStatusMessage extends Object
The sentence a statement that produces no rows of its own answers with. Live returns it as a single row of one VARCHAR column named status — but only through executeQuery: through Statement.execute the driver reports no result set at all and an update count of 0, which is why this had to be measured on a raw connection rather than through the test harness.
   CREATE TABLE t (a INT)          Table T successfully created.
   CREATE OR REPLACE VIEW v AS …   View V successfully created.
   CREATE TABLE "lower" (a INT)    Table lower successfully created.
   DROP TABLE t                    T successfully dropped.
   ALTER SESSION SET TIMEZONE = …  Statement executed successfully.
 

★ ONLY CREATE NAMES THE KIND. A DROP says just the name, and everything else — USE, ALTER (session or object), TRUNCATE, COMMENT, GRANT — is the one flat sentence. So the vocabulary is small, and its shape is per STATEMENT rather than per object.

★ THE KIND WORDS ARE SENTENCE-CASE AND TWO OF THEM ARE SURPRISES: a STAGE is "Stage area", and a PROCEDURE is "Function". A multi-word kind capitalises only its first word — "File format", "Materialized view", "Masking policy". TEMPORARY and TRANSIENT do not appear at all: both are "Table".

★ THE NAME IS THE BARE, CANONICAL ONE — never qualified, upper-cased when written unquoted and kept verbatim when quoted.

  • Field Details

    • EXECUTED

      public static final String EXECUTED
      The sentence every statement without a kind-specific wording gets.
      See Also:
  • Method Details

    • forStatement

      public static String forStatement(FrostlakeParser.StatementContext statement)
      The status sentence for one statement.
      Parameters:
      statement - the parsed statement
      Returns:
      live's sentence for it
    • forStatement

      public static String forStatement(FrostlakeParser.StatementContext statement, ConditionalDdlBranch branch)
      The status sentence for one statement, given the conditional branch its handler reported.

      ★ THE TWO CONDITIONAL SENTENCES DEPEND ON WHAT THE CATALOG HELD BEFORE THE STATEMENT RAN (live-verified across table, view, stage, schema and sequence — the wording is kind-blind):

         CREATE … IF NOT EXISTS, object present    T2 already exists, statement succeeded.
         DROP … IF EXISTS, object absent           Drop statement executed successfully
                                                   (NOSUCHTABLE already dropped).
       

      The name is the written identifier canonicalised — the DROP form upper-cases even a name that never existed, and a quoted one keeps its case — so it comes off the tree, not off a catalog lookup. CREATE OR REPLACE over an existing object never says "already exists": it is the ordinary created sentence.

      Parameters:
      statement - the parsed statement
      branch - the conditional branch the handler took, or null when it took neither
      Returns:
      live's sentence for it