mariadb-cli 0.1.1

One-shot agent-native command line client for MariaDB servers
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
//! The commands that reach a server, and what their answers carry.
//!
//! Held by `payload_shape_server.rs`, which runs only where a destination is
//! declared. See the sibling `local` module for why the split follows who
//! checks an entry rather than where it falls in the alphabet.

use super::{Fields, NAME_CASE};

/// The published fields of every command that reaches a destination.
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")],
    )];