chromium/third_party/perfetto/src/trace_processor/sqlite/sqlite_utils.cc

/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "src/trace_processor/sqlite/sqlite_utils.h"

#include <cstddef>
#include <cstdint>
#include <limits>
#include <optional>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#include "perfetto/base/logging.h"
#include "perfetto/base/status.h"
#include "perfetto/ext/base/status_or.h"
#include "perfetto/ext/base/string_utils.h"
#include "perfetto/trace_processor/basic_types.h"
#include "src/trace_processor/sqlite/scoped_db.h"

namespace perfetto::trace_processor::sqlite::utils {
namespace internal {
namespace {
std::string ToExpectedTypesString(ExpectedTypesSet expected_types) {}
}  // namespace

base::Status InvalidArgumentTypeError(const char* argument_name,
                                      size_t arg_index,
                                      SqlValue::Type actual_type,
                                      ExpectedTypesSet expected_types) {}

base::StatusOr<SqlValue> ExtractArgument(size_t argc,
                                         sqlite3_value** argv,
                                         const char* argument_name,
                                         size_t arg_index,
                                         ExpectedTypesSet expected_types) {}
}  // namespace internal

std::wstring SqliteValueToWString(sqlite3_value* value) {}

base::Status GetColumnsForTable(
    sqlite3* db,
    const std::string& raw_table_name,
    std::vector<std::pair<SqlValue::Type, std::string>>& columns) {}

const char* SqliteTypeToFriendlyString(SqlValue::Type type) {}

base::Status CheckArgCount(const char* function_name,
                           size_t argc,
                           size_t expected_argc) {}

base::StatusOr<int64_t> ExtractIntArg(const char* function_name,
                                      const char* arg_name,
                                      sqlite3_value* sql_value) {}

base::StatusOr<double> ExtractDoubleArg(const char* function_name,
                                        const char* arg_name,
                                        sqlite3_value* sql_value) {}

base::StatusOr<std::string> ExtractStringArg(const char* function_name,
                                             const char* arg_name,
                                             sqlite3_value* sql_value) {}

base::Status TypeCheckSqliteValue(sqlite3_value* value,
                                  SqlValue::Type expected_type) {}

base::Status TypeCheckSqliteValue(sqlite3_value* value,
                                  SqlValue::Type expected_type,
                                  const char* expected_type_str) {}

template <typename T>
base::Status ExtractFromSqlValueInt(const SqlValue& value,
                                    std::optional<T>& out) {}

base::Status ExtractFromSqlValue(const SqlValue& value,
                                 std::optional<int64_t>& out) {}
base::Status ExtractFromSqlValue(const SqlValue& value,
                                 std::optional<int32_t>& out) {}
base::Status ExtractFromSqlValue(const SqlValue& value,
                                 std::optional<uint32_t>& out) {}
base::Status ExtractFromSqlValue(const SqlValue& value,
                                 std::optional<double>& out) {}
base::Status ExtractFromSqlValue(const SqlValue& value,
                                 std::optional<const char*>& out) {}

base::Status MissingArgumentError(const char* argument_name) {}

base::Status ToInvalidArgumentError(const char* argument_name,
                                    size_t arg_index,
                                    const base::Status& error) {}

}  // namespace perfetto::trace_processor::sqlite::utils