feat(hint): H2 Phase C batch 4 — advanced-mode SQL tier-3 hints (ADR-0053)
Distinct SQL-syntax hints for the 11 advanced-mode forms: sql create table / alter table / create index / drop index / drop table / insert / update / delete, select, with, explain. hint_ids wired on all 11 nodes. Hardened hint_key_for_input_in_mode for shared entry words: a bare multi-form entry word defers to tier-2; when the second token isn't a form word (insert into / update … set), it falls back to the mode-primary key — so advanced mode resolves to the SQL form and simple mode to the DSL form. catalogue + keys.rs registered. +2 spot tests + grammar mode-disambiguation asserts; 2495 pass / 1 ignored, clippy clean.
This commit is contained in:
@@ -545,6 +545,52 @@ hint:
|
||||
what: "Re-run the commands recorded in a history file."
|
||||
example: "replay session.log"
|
||||
concept: "Every successful command is journalled, so replaying re-applies them in order to reproduce a project's state — handy for scripting or redoing a sequence."
|
||||
# Advanced-mode SQL forms (Phase C batch 4). Examples are SQL, the
|
||||
# advanced surface — distinct from their simple-mode siblings.
|
||||
sql_create_table:
|
||||
what: "Create a table using SQL syntax (advanced mode)."
|
||||
example: "create table Customers (id int primary key, name text, email text)"
|
||||
concept: "Advanced mode speaks SQL: constraints go inline (`primary key`, `not null`, `unique`, `check`). This is the raw form of simple mode's `create table … with pk …`."
|
||||
sql_alter_table:
|
||||
what: "Change a table's structure with SQL `alter table` (advanced mode)."
|
||||
example: "alter table Customers add column phone text"
|
||||
concept: "`alter table` adds or drops columns, renames, and adds constraints — the SQL equivalent of simple mode's `add column` / `drop column` / `change column`."
|
||||
sql_create_index:
|
||||
what: "Create an index with SQL (advanced mode)."
|
||||
example: "create index ix_email on Customers (email)"
|
||||
concept: "Add `unique` to also forbid duplicate values. The simple-mode equivalent is `add index`."
|
||||
sql_drop_index:
|
||||
what: "Remove an index with SQL (advanced mode)."
|
||||
example: "drop index ix_email"
|
||||
concept: "Only the lookup shortcut goes; the data is untouched. Add `if exists` to ignore a missing index."
|
||||
sql_drop_table:
|
||||
what: "Remove a table with SQL (advanced mode)."
|
||||
example: "drop table Customers"
|
||||
concept: "Add `if exists` to avoid an error when the table might not be there. Relationships pointing at it may block the drop."
|
||||
sql_insert:
|
||||
what: "Insert rows with SQL (advanced mode)."
|
||||
example: "insert into Customers (name, email) values ('Ann', 'ann@example.io')"
|
||||
concept: "Naming the columns lets you supply them in any order and skip ones that have a default — the SQL form of simple mode's `insert`."
|
||||
sql_update:
|
||||
what: "Update rows with SQL (advanced mode)."
|
||||
example: "update Customers set email = 'new@example.io' where id = 1"
|
||||
concept: "`set` lists the new values; `where` picks which rows change. The SQL form of simple mode's `update`."
|
||||
sql_delete:
|
||||
what: "Delete rows with SQL (advanced mode)."
|
||||
example: "delete from Orders where status = 'cancelled'"
|
||||
concept: "`where` picks the rows to remove; foreign-key rules still apply. The SQL form of simple mode's `delete`."
|
||||
select:
|
||||
what: "Query rows with SQL `select` (advanced mode)."
|
||||
example: "select name, email from Customers where id = 1"
|
||||
concept: "`select` is read-only: choose columns (or `*`), filter with `where`, sort with `order by`, cap with `limit`. This is the heart of SQL — and the reason advanced mode exists."
|
||||
with:
|
||||
what: "Name a sub-query (a CTE) and read from it in a `select` (advanced mode)."
|
||||
example: "with recent as (select * from Orders where id > 100) select * from recent"
|
||||
concept: "A `with` clause (Common Table Expression) names a query so the main `select` can use it like a temporary table — handy for breaking a complex query into readable steps."
|
||||
explain_sql:
|
||||
what: "Show how the database will run a SQL query, without running it (advanced mode)."
|
||||
example: "explain select * from Customers where email = 'a@example.io'"
|
||||
concept: "Like simple mode's `explain`, but wraps a raw SQL statement. It reveals whether an index is used, and never executes."
|
||||
err:
|
||||
foreign_key:
|
||||
child_side:
|
||||
|
||||
Reference in New Issue
Block a user