MCPcopy Create free account
hub / github.com/apache/cloudberry / ExplainProperty

Function ExplainProperty

src/backend/commands/explain.c:5490–5538  ·  view source on GitHub ↗

* Explain a simple property. * * If "numeric" is true, the value is a number (or other value that * doesn't need quoting in JSON). * * If unit is non-NULL the text format will display it after the value. * * This usually should not be invoked directly, but via one of the datatype * specific routines ExplainPropertyText, ExplainPropertyInteger, etc. */

Source from the content-addressed store, hash-verified

5488 * specific routines ExplainPropertyText, ExplainPropertyInteger, etc.
5489 */
5490static void
5491ExplainProperty(const char *qlabel, const char *unit, const char *value,
5492 bool numeric, ExplainState *es)
5493{
5494 switch (es->format)
5495 {
5496 case EXPLAIN_FORMAT_TEXT:
5497 ExplainIndentText(es);
5498 if (unit)
5499 appendStringInfo(es->str, "%s: %s %s\n", qlabel, value, unit);
5500 else
5501 appendStringInfo(es->str, "%s: %s\n", qlabel, value);
5502 break;
5503
5504 case EXPLAIN_FORMAT_XML:
5505 {
5506 char *str;
5507
5508 appendStringInfoSpaces(es->str, es->indent * 2);
5509 ExplainXMLTag(qlabel, X_OPENING | X_NOWHITESPACE, es);
5510 str = escape_xml(value);
5511 appendStringInfoString(es->str, str);
5512 pfree(str);
5513 ExplainXMLTag(qlabel, X_CLOSING | X_NOWHITESPACE, es);
5514 appendStringInfoChar(es->str, '\n');
5515 }
5516 break;
5517
5518 case EXPLAIN_FORMAT_JSON:
5519 ExplainJSONLineEnding(es);
5520 appendStringInfoSpaces(es->str, es->indent * 2);
5521 escape_json(es->str, qlabel);
5522 appendStringInfoString(es->str, ": ");
5523 if (numeric)
5524 appendStringInfoString(es->str, value);
5525 else
5526 escape_json(es->str, value);
5527 break;
5528
5529 case EXPLAIN_FORMAT_YAML:
5530 ExplainYAMLLineStarting(es);
5531 appendStringInfo(es->str, "%s: ", qlabel);
5532 if (numeric)
5533 appendStringInfoString(es->str, value);
5534 else
5535 escape_yaml(es->str, value);
5536 break;
5537 }
5538}
5539
5540static void
5541ExplainPropertyStringInfo(const char *qlabel, ExplainState *es, const char *fmt,...)

Callers 5

ExplainPropertyTextFunction · 0.85
ExplainPropertyIntegerFunction · 0.85
ExplainPropertyUIntegerFunction · 0.85
ExplainPropertyFloatFunction · 0.85
ExplainPropertyBoolFunction · 0.85

Calls 12

ExplainIndentTextFunction · 0.85
appendStringInfoFunction · 0.85
appendStringInfoSpacesFunction · 0.85
ExplainXMLTagFunction · 0.85
escape_xmlFunction · 0.85
appendStringInfoStringFunction · 0.85
appendStringInfoCharFunction · 0.85
ExplainJSONLineEndingFunction · 0.85
escape_jsonFunction · 0.85
ExplainYAMLLineStartingFunction · 0.85
escape_yamlFunction · 0.85
pfreeFunction · 0.50

Tested by

no test coverage detected