Extracts analyzed query SQL text from the plan field.
| 811 | |
| 812 | // Extracts analyzed query SQL text from the plan field. |
| 813 | string QueryProfileToolAccessor::GetAnalyzedQuery() const { |
| 814 | const Value* summary = GetSummaryPtr(); |
| 815 | if (summary != nullptr && summary->HasMember("Plan") && (*summary)["Plan"].IsString()) { |
| 816 | const Value& plan_value = (*summary)["Plan"]; |
| 817 | re2::StringPiece plan(plan_value.GetString(), plan_value.GetStringLength()); |
| 818 | re2::StringPiece match; |
| 819 | if (re2::RE2::PartialMatch(plan, ANALYZED_RE, &match)) { |
| 820 | const string_view analyzed = |
| 821 | TrimWhiteSpace(string_view(match.data(), match.length())); |
| 822 | return string(analyzed); |
| 823 | } |
| 824 | } |
| 825 | return string(); |
| 826 | } |
| 827 | |
| 828 | // Reads query type from the Summary section. |
| 829 | string_view QueryProfileToolAccessor::GetQueryType(const Value& query_obj) const { |
no test coverage detected