QueryRow
API reference › Debug Core › Panel › Db › QueryRow
Typed view-model for a single database query row consumed by the queries grid.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
create() static | Creates a captured statement with milliseconds as the common time unit. | QueryRow |
extractType() static | Returns the uppercase leading command verb of a statement, or '' when it starts with no letter. | QueryRow |
findBySequence() static | Returns the row whose sequence matches the requested one exactly, or null when none does. | QueryRow |
fromArray() static | Narrows one persisted statement of the database payload into a typed row. | QueryRow |
fromTiming() static | Builds a typed row from one resolved logger timing. | QueryRow |
getDuplicate() | Returns the number of occurrences of this exact query. | QueryRow |
getDuration() | Returns the execution time in milliseconds. | QueryRow |
getQuery() | Returns the captured SQL statement. | QueryRow |
getRows() | Returns the driver-reported row count, or null when unavailable. | QueryRow |
getSequence() | Returns the zero-based capture sequence. | QueryRow |
getTimestamp() | Returns the capture timestamp in milliseconds since the Unix epoch. | QueryRow |
getTrace() | Returns the captured source frames. | QueryRow |
getTraceHash() | Returns the captured or derived caller hash. | QueryRow |
getType() | Returns the extracted or explicitly captured command verb. | QueryRow |
isExplainable() | Returns whether the statement produces a useful EXPLAIN plan. | QueryRow |
jsonSerialize() | Returns the persisted row contract. | QueryRow |
withDuplicate() | Returns a copy with the given duplicate count. | QueryRow |
withRows() | Returns a copy with the driver-reported row count, or null when the driver did not report one. | QueryRow |
withSequence() | Returns a copy with the given sequence index. | QueryRow |
withTrace() | Returns a copy with the given source frames and the caller hash derived from them. | QueryRow |
withTraceHash() | Returns a copy with an explicitly captured caller hash without changing the source frames. | QueryRow |
withType() | Returns a copy with an explicitly captured SQL command verb without changing the statement. | QueryRow |
Method details
Section titled “Method details”create()
Section titled “create() ”public static function create(string $query, float $duration, float $timestamp): selfCreates a captured statement with milliseconds as the common time unit.
Parameters
| Parameter | Type | Description |
|---|---|---|
$query | string | Full SQL statement. |
$duration | float | Execution time in milliseconds. |
$timestamp | float | Capture timestamp in milliseconds since the Unix epoch. |
Returns
self: Row carrying the extracted command verb, without trace, sequence, or row count.
extractType()
Section titled “extractType() ”public static function extractType(string $sql): stringReturns the uppercase leading command verb of a statement, or '' when it starts with no letter.
Parameters
| Parameter | Type | Description |
|---|---|---|
$sql | string | SQL statement to inspect. |
Returns
string: Uppercase command verb, or ''.
findBySequence()
Section titled “findBySequence() ”public static function findBySequence(list<self> $rows, string $seq): self|nullReturns the row whose sequence matches the requested one exactly, or null when none does.
The sequence is compared as a string, so a padded request such as '02' never matches sequence 2.
Parameters
| Parameter | Type | Description |
|---|---|---|
$rows | list<self> | Captured rows to search. |
$seq | string | Requested sequence number. |
Returns
self|null: Matching row, or null when the sequence was not captured.
fromArray()
Section titled “fromArray() ”public static function fromArray(mixed $data, string $path): selfNarrows one persisted statement of the database payload into a typed row.
Parameters
| Parameter | Type | Description |
|---|---|---|
$data | mixed | Persisted statement, expected to be an object carrying the declared shape. |
$path | string | JSON path of the statement, used to report a malformed payload. |
Returns
self: Row carrying every persisted statement field.
fromTiming()
Section titled “fromTiming() ”public static function fromTiming(array{info: string, category: string, timestamp: float, trace: array<int, array<string, mixed>>, level: int, duration: float, memory: int, memoryDiff: int, traceHash: string} $timing, string $type, int $seq, int|null $rows): selfBuilds a typed row from one resolved logger timing.
Parameters
| Parameter | Type | Description |
|---|---|---|
$timing | array{info: string, | Resolved timing. The duplicate count starts at 1; DbSnapshot::capture() resolves the real occurrences across the request. |
$type | string | Uppercase SQL command verb extracted from the statement. |
$seq | int | Zero-based sequence index. |
$rows | int| | Rows reported by the driver, or null when it reported none. |
Returns
self: Row with the timing scaled to milliseconds.
getDuplicate()
Section titled “getDuplicate() ”public function getDuplicate(): intReturns the number of occurrences of this exact query.
Returns
int
getDuration()
Section titled “getDuration() ”public function getDuration(): floatReturns the execution time in milliseconds.
Returns
float
getQuery()
Section titled “getQuery() ”public function getQuery(): stringReturns the captured SQL statement.
Returns
string
getRows()
Section titled “getRows() ”public function getRows(): int|nullReturns the driver-reported row count, or null when unavailable.
Returns
int|null
getSequence()
Section titled “getSequence() ”public function getSequence(): intReturns the zero-based capture sequence.
Returns
int
getTimestamp()
Section titled “getTimestamp() ”public function getTimestamp(): floatReturns the capture timestamp in milliseconds since the Unix epoch.
Returns
float
getTrace()
Section titled “getTrace() ”public function getTrace(): list<array<string, mixed>>Returns the captured source frames.
Returns
list<array<string, mixed>>: Captured backtrace frames.
getTraceHash()
Section titled “getTraceHash() ”public function getTraceHash(): stringReturns the captured or derived caller hash.
Returns
string
getType()
Section titled “getType() ”public function getType(): stringReturns the extracted or explicitly captured command verb.
Returns
string
isExplainable()
Section titled “isExplainable() ”public function isExplainable(): boolReturns whether the statement produces a useful EXPLAIN plan.
Only single table-touching DML verbs (SELECT, INSERT, UPDATE, DELETE, REPLACE, WITH) qualify;
multi-statement text and other verbs either error or return noise under EXPLAIN.
Returns
bool: true when the statement can be explained; false otherwise.
jsonSerialize()
Section titled “jsonSerialize() ”public function jsonSerialize(): array<string, mixed>Returns the persisted row contract.
Returns
array<string, mixed>: Row fields in their persisted order.
withDuplicate()
Section titled “withDuplicate() ”public function withDuplicate(int $duplicate): selfReturns a copy with the given duplicate count.
Parameters
| Parameter | Type | Description |
|---|---|---|
$duplicate | int | Number of times the exact same statement was emitted in this request (>= 1). |
Returns
self: Copy carrying the duplicate count.
withRows()
Section titled “withRows() ”public function withRows(int|null $rows): selfReturns a copy with the driver-reported row count, or null when the driver did not report one.
Parameters
| Parameter | Type | Description |
|---|---|---|
$rows | int| | Rows returned or affected, or null when the driver reported none. |
Returns
self: Copy carrying the row count.
withSequence()
Section titled “withSequence() ”public function withSequence(int $sequence): selfReturns a copy with the given sequence index.
Parameters
| Parameter | Type | Description |
|---|---|---|
$sequence | int | Zero-based sequence index assigned by the panel. |
Returns
self: Copy carrying the sequence index.
withTrace()
Section titled “withTrace() ”public function withTrace(list<array<string, mixed>> $trace): selfReturns a copy with the given source frames and the caller hash derived from them.
Parameters
| Parameter | Type | Description |
|---|---|---|
$trace | list<array<string, | Argument-free source frames. |
Returns
self: Copy carrying the frames and their derived caller hash.
withTraceHash()
Section titled “withTraceHash() ”public function withTraceHash(string $traceHash): selfReturns a copy with an explicitly captured caller hash without changing the source frames.
Call after QueryRow::withTrace() to preserve a logger-provided hash instead of the derived hash.
A subsequent withTrace() call derives the hash again.
Parameters
| Parameter | Type | Description |
|---|---|---|
$traceHash | string | Captured caller hash, or '' when no caller was captured. |
Returns
self: Copy carrying the hash unchanged.
withType()
Section titled “withType() ”public function withType(string $type): selfReturns a copy with an explicitly captured SQL command verb without changing the statement.
Parameters
| Parameter | Type | Description |
|---|---|---|
$type | string | Captured command verb, preserved without normalization. |
Returns
self: Copy carrying the verb unchanged.