{# The SQL console, as one swappable section. Read-only by default: the checkbox is the explicit mode="write" the API demands, so nothing writes by accident. The keyword courtesy check, the read-only transaction, the single-statement rule and the audit line all live in the API and its managers; this fragment only carries the form and shows the engine's own output, verbatim, in mono. A refused statement renders at 200 with the refusal inline and the statement preserved, so the operator corrects it instead of retyping it. #} {% import "_macros.html" as m %}
Ran in {{ console.result.mode }} mode - {{ console.result.returned_rows }} line{{ "" if console.result.returned_rows == 1 else "s" }}{% if console.result.truncated %}, output truncated{% endif %}.
{{ console.result.output }}
{% else %}
{{ m.problem("The engine refused the statement. Its own words:",
console.result.output) }}
{% endif %}
{% endif %}
{% else %}
{{ m.empty("The console needs a running engine",
"Install or start an engine and create a database, then run statements here.",
command="wasm db install postgresql") }}
{% endif %}