use super::{Fields, NAME_CASE};
pub(super) const SHAPES: &[(&str, Fields)] = &[
(
"conn test",
&[
("auth_method", "string, the method the profile declared, and null when it declared none"),
("encrypted_channel_available", "boolean, whether this build can open an encrypted channel"),
("encryption_requested", "boolean, whether this profile asks for one, resolved rather than read from the record"),
("profile", "string, the profile that was tested"),
("reachable", "boolean, whether the server answered"),
("server", "object, what the server said about itself"),
("warning", "string, something worth knowing about this server"),
],
),
(
"query analyze",
&[
("measured", "boolean, whether the plan was measured by running the statement; here it was"),
("predicted_rows", "number, how many rows the server expected to touch"),
("rows", "array, the plan, one entry per step the server takes"),
],
),
(
"query explain",
&[
("measured", "boolean, whether the plan was measured by running the statement; here it was not"),
("rows", "array, the plan, one entry per step the server intends"),
("trace_requested", "boolean, whether the optimiser's own reasoning was asked for"),
],
),
(
"query sample",
&[
("columns", "array, the column names the rows carry, in order"),
("row_count", "number, how many rows came back"),
("rows", "array, the sampled rows"),
],
),
(
"data export",
&[
("bytes", "number, how large the written file is"),
("consistent", "boolean, whether the rows were read as one unchanging picture"),
("content_checksum", "string, a signature of the rows, comparable with one taken by a read"),
("objects", "number, how many objects the file describes"),
("path", "string, the file that was written"),
(
"rows",
"number, how many rows were written. A COUNT and not a listing, as in \
`schema count`: the rows themselves went to the file and never to this answer",
),
],
),
(
"data import",
&[
("columns", "array, the column names read out of the file, in the file's own order"),
("offset", "number, the line to resume from, so a load cut short can carry on"),
(
"rows",
"array, one entry per line the load refused, with the line number and the reason. \
The lines that WERE written are not here: they went into the table",
),
("rows_read", "number, how many lines were read out of the file"),
("rows_rejected", "number, how many of those were refused"),
("rows_written", "number, how many the table now holds that it did not before"),
],
),
(
"history as-of",
&[
("at", "string, the instant the table was read at, echoed as it was understood"),
("database", "string, the database the table lives in"),
(
"earliest_instant",
"string, the oldest instant this table can answer for, which is what makes a \
reading before it a refusal rather than an empty answer",
),
("rows", "array, the rows as they stood at that instant"),
("table", "string, the table that was read"),
],
),
(
"history between",
&[
("database", "string, the database the table lives in"),
(
"earliest_instant",
"string, the oldest instant this table can answer for, travelling here as well \
so a caller refused for asking too far back learns the bound from the refusal \
and from the answer alike",
),
("from", "string, the start of the interval, echoed as it was understood"),
("rows", "array, the versions of each row that were current inside the interval"),
("table", "string, the table that was read"),
("to", "string, the end of the interval, echoed as it was understood"),
],
),
(
"history tables",
&[
("database", "string, the database that was looked through"),
("rows", "array, one entry per table that keeps its own past"),
],
),
(
"query call",
&[
("database", "string, the database the routine ran in"),
(
"output_parameters",
"object, the values the routine handed back through its own parameters, which a \
set of rows has no room for",
),
("routine", "string, the routine that was called"),
(
"sets",
"array, one entry per set of rows the routine produced, kept apart because a \
routine may answer with more than one",
),
("set_count", "number, how many sets came back"),
],
),
(
"query plan",
&[
("connection", "number, the connection whose running statement was read"),
(
"rows",
"array, one entry per step of the plan the server is following right now. \
A reading of somebody else's work in flight, so a second reading a moment \
later may differ without either being wrong",
),
],
),
(
"server kill",
&[
(
"belongs_to_another_user",
"boolean, whether the connection was somebody else's, which is the fact that \
decides how much of this was an ordinary act and how much was an intrusion",
),
("id", "number, the connection that was acted on"),
("owner", "string, the account the connection belonged to"),
(
"statement_only",
"boolean, whether just the running statement was ended and the connection left \
alive, which is what `--query` asks for",
),
(
"still_open",
"boolean, whether the connection survived, so a caller learns what it did rather \
than what it asked for",
),
(
"warning",
"string, what was ended and whose it was, written out because ending another \
session is the kind of act whose record should not have to be reconstructed",
),
],
),
(
"query file",
&[
("rows", "array, one answer per statement the file carried, in the order it carried them"),
("statement_count", "number, how many statements were run"),
],
),
(
"query named run",
&[
("columns", "array, the column names the rows carry, in order"),
("row_count", "number, how many rows came back"),
("rows", "array, the rows themselves"),
],
),
(
"query tx",
&[
(
"confirmed",
"boolean, whether the block was committed. A block that was not confirmed does \
not reach this answer at all, so this is always true where it appears",
),
("rows", "array, one answer per statement in the block, in order"),
("statement_count", "number, how many statements the block carried"),
],
),
(
"query run",
&[
("columns", "array, the column names the rows carry, in order"),
("row_count", "number, how many rows came back"),
("rows", "array, the rows themselves"),
],
),
(
"schema checks",
&[
("name_case", NAME_CASE),
("rows", "array, one entry per value restriction on the table"),
],
),
(
"schema columns",
&[
("name_case", NAME_CASE),
("rows", "array, one entry per column"),
],
),
(
"schema count",
&[
("database", "string, the database the table lives in"),
("elapsed_ms", "number, how long the counting took"),
("estimated", "boolean, whether the number is the catalogue's guess; it is not"),
("exact", "boolean, whether the number was counted row by row; it was"),
("name_case", NAME_CASE),
(
"rows",
"number, how many rows the table holds. This is a COUNT and not a listing: the \
same field name carries an array in every other command of this family, and \
here it carries the answer itself",
),
("table", "string, the table that was counted"),
],
),
(
"schema ddl",
&[
("database", "string, the database the object lives in"),
("definition", "string, the statement that would recreate the object as it stands"),
("kind", "string, what sort of object this is"),
("name", "string, the object asked about"),
],
),
(
"schema indexes",
&[
("name_case", NAME_CASE),
("rows", "array, one entry per index"),
],
),
(
"schema keys",
&[
("name_case", NAME_CASE),
("rows", "array, one entry per key that points at another table"),
],
),
(
"schema partitions",
&[
("name_case", NAME_CASE),
("rows", "array, one entry per partition, which is why a scan reads more than it seems"),
],
),
(
"schema search",
&[
("name_case", NAME_CASE),
("rows", "array, one entry per object whose name matched"),
],
),
(
"schema stats",
&[
("estimated", "boolean, whether the row count is the catalogue's guess; it is"),
("exact", "boolean, whether the row count was counted row by row; it was not"),
("name_case", NAME_CASE),
("rows", "array, one entry per table, with its size and its estimated row count"),
],
),
(
"schema databases",
&[
("name_case", NAME_CASE),
("rows", "array, one entry per database the credential may see"),
],
),
(
"schema events",
&[
("name_case", NAME_CASE),
("rows", "array, one entry per scheduled event"),
(
"scheduler",
"string, whether the server runs scheduled events at all, and null when the \
setting could not be read",
),
],
),
(
"schema grants",
&[
("authenticated_as", "string, the account the server authenticated"),
("can_write", "boolean, whether any permission read here allows a change"),
("connected_as", "string, the account this connection is acting as"),
(
"far_reaching",
"array, the permissions that reach beyond one database, named so a caller can \
see why the credential is broader than it looks",
),
("lines_read", "number, how many permission lines the server answered with"),
(
"lines_understood",
"number, how many of those this product could read; the difference is what it \
could not, and saying so is why both numbers travel",
),
("rows", "array, one entry per permission that was understood"),
],
),
(
"schema map",
&[
("name_case", NAME_CASE),
("rows", "array, one compact entry per object, for finding without describing"),
],
),
(
"schema routines",
&[
("name_case", NAME_CASE),
("rows", "array, one entry per stored routine"),
],
),
(
"schema sequences",
&[
(
"current_value_read",
"boolean, whether the current number was read; it is always false, because \
reading it would move it",
),
("name_case", NAME_CASE),
("rows", "array, one entry per number generator"),
],
),
(
"schema size",
&[
("largest_objects", "array, the biggest objects, heaviest first"),
("name_case", NAME_CASE),
("ranked", "number, how many objects were ranked"),
("rows", "array, one entry per database, with the space it occupies"),
],
),
(
"schema tables",
&[
("name_case", NAME_CASE),
("rows", "array, one entry per table"),
],
),
(
"schema triggers",
&[
("name_case", NAME_CASE),
("rows", "array, one entry per trigger"),
],
),
(
"schema views",
&[
("name_case", NAME_CASE),
("rows", "array, one entry per view"),
],
),
(
"server capabilities",
&[
("meets_minimum_version", "boolean, whether the server is new enough for this product"),
("rows", "array, one entry per capability, with whether the server has it"),
("variant", "string, which server family answered"),
("version", "string, the version the server reports"),
("version_parts", "array, that version split into three numbers for comparing"),
],
),
(
"server locks",
&[
("idle_in_transaction", "object, the sessions holding a transaction open while doing nothing"),
(
"oldest_open_transaction",
"object, the transaction open the longest, and null when none is open; \
the field is always present, because absence of data is not absence of field",
),
("open_transactions", "number, how many transactions are open"),
("rows", "array, one entry per open transaction"),
],
),
(
"server processes",
&[
(
"own_connection_id",
"number, the connection this invocation opened, so a caller can tell its own \
work apart from everyone else's",
),
("rows", "array, one entry per session the credential may see"),
],
),
(
"server queries",
&[
("database", "string, the database the listing was narrowed to"),
("rows", "array, one entry per statement, heaviest first"),
("sorted_by", "string, which measure decided that order"),
("top", "number, how many entries were asked for"),
],
),
(
"server status",
&[
("interval_secs", "number, the window the rates were measured over"),
("rows", "array, one entry per counter the server publishes"),
("summary", "object, the few readings most callers act on"),
],
),
(
"server variables",
&[("rows", "array, one entry per server variable the credential may read")],
)];