# DbExplainRenderer

> Renders a database EXPLAIN plan with the shared debugger table contract.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Panel](/docs/extensions/debug-core/reference/panel/index.md) › [Db](/docs/extensions/debug-core/reference/panel/db/index.md) › DbExplainRenderer

| final class | `PHPForge\Debug\Panel\Db\DbExplainRenderer` |
| --- | --- |
| Source | [`src/Panel/Db/DbExplainRenderer.php`](https://github.com/php-forge/debug-core/blob/main/src/Panel/Db/DbExplainRenderer.php#L21) |

Renders a database EXPLAIN plan with the shared debugger table contract.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`render()`](#method-render) static | Renders the explained SQL statement and its driver-specific result rows. | `DbExplainRenderer` |
| [`renderError()`](#method-renderError) static | Renders a failed EXPLAIN attempt without escaping the shared panel contract. | `DbExplainRenderer` |

## Method details

### render() <span id="method-render"></span>

```php
public static function render(string $query, array<array-key, array<array-key, mixed>> $results): string
```

Renders the explained SQL statement and its driver-specific result rows.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$query` | `string` | SQL statement passed to EXPLAIN. |
| `$results` | `array<array-key, array<array-key, mixed>>` | Driver result rows. |

**Returns**

`string`

### renderError() <span id="method-renderError"></span>

```php
public static function renderError(string $query, string $message): string
```

Renders a failed EXPLAIN attempt without escaping the shared panel contract.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$query` | `string` |  |
| `$message` | `string` |  |

**Returns**

`string`