# Query results, identifiers, and errors

The following data fields appear in a successful numeric code=200 envelope. query_id is for status/cancellation; statement_id is for successful saved-result reading/details/profile. They are not interchangeable.

| Field | Type | Current meaning |
| --- | --- | --- |
| query_id | string | Execution record ID; optional |
| db_name | string | run uses the execution database. /query/result always clears it; read the database from describe |
| statement_id | string | Saved result ID; may be empty on failure |
| status | string | Operation state such as success, failed, running, or killed. Do not check only outer HTTP status |
| err_msg | string | Readable execution error; optional |
| offset / limit | integer | Current scan position and window |
| total | integer | Rows returned this time, not total result cardinality |
| rows_affected | integer | Affected rows |
| truncated | boolean | Whether the result row window truncated the result |
| columns | array (objects) | name and type; type is the database column data type |
| result | array (two-dimensional array) | Every cell contains String and Valid. Valid=false means SQL NULL |
| empty_set | object | Feedback such as no row set; msg is Query OK, N row(s) affected |

Unset rows/columns/empty_set may be omitted. The raw DTO has no elapsed_ms field; a default SDK property value is not evidence of current handler timing. HTTP SQL processing errors usually use integer code/message; identity/generic fallbacks may use string code/msg. WS business errors separately use data.err; do not mix them.

Except dedicated branches such as permission hints, SQL HTTP errors may directly use err.Error(). Current text for a missing result is SQL editor result is not found. Not every message is guaranteed to follow the interface language; identify errors by code/status and use text as readable explanation only.

API result reads default to limit=1000; the helper does not enforce a cap on positive values. This differs from run's first-window algorithm. Saved-result reads first confirm a successful operation owned by the current user, then read through the current actor session. Arbitrary statement_id values are not a public download capability.
