# XWUIDBQueryEditor

A database query console mirroring KEYSTONE's `/query` page: a code editor (Monaco-backed `super/XWUIScriptEditor` when bundled, falling back to `basic/XWUIInputTextarea`), Execute and Reset buttons, and a `enterprise/XWUIDataGrid` that renders the returned rows with inferred columns. The query language is opaque - the host's `onRun(text)` callback returns an `{ ok, rows, meta, error }` result; `grammar`, `height`, `forceTextarea`, `title`, and `statusText` configure the editor, and `initialQuery`/`initialResult` seed it.

## Basic Usage

A JSON-grammar console seeded with an XWQuery predicate whose `onRun` simulates a 120ms round-trip and returns three result rows (including `$guid` and `$dt` envelope objects so the JSON-aware cell renderer engages).

```example
file: examples/BasicUsage.ts
html: examples/BasicUsage.html
title: Basic Usage
description: A query console with a seeded JSON predicate and a mock onRun that returns three KEYSTONE-shaped result rows.
```

## SQL Aggregation

The same console driving a SQL backend, seeded with a GROUP BY revenue-by-region query and a pre-loaded four-group aggregation result.

```example
file: examples/SqlAggregation.ts
html: examples/SqlAggregation.html
title: SQL Aggregation
description: A SQL-grammar console (textarea-forced) with a GROUP BY query and an initialResult of four revenue-by-region aggregate rows.
```

## Slow Query Timeout

Demonstrates the failure path: an unbounded scan whose `onRun` returns an `{ ok: false, error }` result, rendered as a budget-exceeded message instead of a grid.

```example
file: examples/SlowQueryTimeout.ts
html: examples/SlowQueryTimeout.html
title: Slow Query Timeout
description: A query console whose seeded unbounded scan is rejected by onRun with a query-budget error, exercising the error-rendering path.
```

```api
```
