• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1--
2-- Copyright 2023 The Android Open Source Project
3--
4-- Licensed under the Apache License, Version 2.0 (the "License");
5-- you may not use this file except in compliance with the License.
6-- You may obtain a copy of the License at
7--
8--     https://www.apache.org/licenses/LICENSE-2.0
9--
10-- Unless required by applicable law or agreed to in writing, software
11-- distributed under the License is distributed on an "AS IS" BASIS,
12-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-- See the License for the specific language governing permissions and
14-- limitations under the License.
15
16-- Returns the formatted value of a given argument.
17-- Similar to EXTRACT_ARG, but instead of returning the raw value, it returns
18-- the value formatted according to the 'value_type' column (e.g. for booleans,
19-- EXTRACT_ARG will return 0 or 1, while FORMATTED_ARG will return 'true' or
20-- 'false').
21CREATE PERFETTO FUNCTION formatted_arg(
22  -- Id of the arg set.
23  arg_set_id INT,
24  -- Key of the argument.
25  arg_key STRING
26)
27-- Formatted value of the argument.
28RETURNS STRING AS
29SELECT display_value
30FROM args
31WHERE arg_set_id = $arg_set_id AND key = $arg_key;