#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) { … }
}
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) { … }
}
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) { … }
}