#include "src/trace_processor/sqlite/db_sqlite_table.h"
#include <sqlite3.h>
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <memory>
#include <numeric>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "perfetto/base/compiler.h"
#include "perfetto/base/logging.h"
#include "perfetto/base/status.h"
#include "perfetto/ext/base/small_vector.h"
#include "perfetto/ext/base/status_or.h"
#include "perfetto/ext/base/string_splitter.h"
#include "perfetto/ext/base/string_utils.h"
#include "perfetto/ext/base/string_view.h"
#include "perfetto/public/compiler.h"
#include "perfetto/trace_processor/basic_types.h"
#include "src/trace_processor/containers/row_map.h"
#include "src/trace_processor/db/column/types.h"
#include "src/trace_processor/db/runtime_table.h"
#include "src/trace_processor/db/table.h"
#include "src/trace_processor/perfetto_sql/intrinsics/table_functions/static_table_function.h"
#include "src/trace_processor/sqlite/module_lifecycle_manager.h"
#include "src/trace_processor/sqlite/sqlite_utils.h"
#include "src/trace_processor/tp_metatrace.h"
#include "src/trace_processor/util/regex.h"
#include "protos/perfetto/trace_processor/metatrace_categories.pbzero.h"
namespace perfetto::trace_processor {
namespace {
std::optional<FilterOp> SqliteOpToFilterOp(int sqlite_op) { … }
class SafeStringWriter { … };
std::string CreateTableStatementFromSchema(const Table::Schema& schema,
const char* table_name) { … }
int SqliteValueToSqlValueChecked(SqlValue* sql_val,
sqlite3_value* value,
const Constraint& cs,
sqlite3_vtab* vtab) { … }
inline uint32_t ReadLetterAndInt(char letter, base::StringSplitter* splitter) { … }
inline uint64_t ReadLetterAndLong(char letter, base::StringSplitter* splitter) { … }
int ReadIdxStrAndUpdateCursor(DbSqliteModule::Cursor* cursor,
const char* idx_str,
sqlite3_value** argv) { … }
PERFETTO_ALWAYS_INLINE void TryCacheCreateSortedTable(
DbSqliteModule::Cursor* cursor,
const Table::Schema& schema,
bool is_same_idx) { … }
void FilterAndSortMetatrace(const std::string& table_name,
const Table::Schema& schema,
DbSqliteModule::Cursor* cursor,
metatrace::Record* r) { … }
}
int DbSqliteModule::Create(sqlite3* db,
void* ctx,
int argc,
const char* const* argv,
sqlite3_vtab** vtab,
char**) { … }
int DbSqliteModule::Destroy(sqlite3_vtab* vtab) { … }
int DbSqliteModule::Connect(sqlite3* db,
void* ctx,
int argc,
const char* const* argv,
sqlite3_vtab** vtab,
char**) { … }
int DbSqliteModule::Disconnect(sqlite3_vtab* vtab) { … }
int DbSqliteModule::BestIndex(sqlite3_vtab* vtab, sqlite3_index_info* info) { … }
int DbSqliteModule::Open(sqlite3_vtab* tab, sqlite3_vtab_cursor** cursor) { … }
int DbSqliteModule::Close(sqlite3_vtab_cursor* cursor) { … }
int DbSqliteModule::Filter(sqlite3_vtab_cursor* cursor,
int idx_num,
const char* idx_str,
int,
sqlite3_value** argv) { … }
int DbSqliteModule::Next(sqlite3_vtab_cursor* cursor) { … }
int DbSqliteModule::Eof(sqlite3_vtab_cursor* cursor) { … }
int DbSqliteModule::Column(sqlite3_vtab_cursor* cursor,
sqlite3_context* ctx,
int N) { … }
int DbSqliteModule::Rowid(sqlite3_vtab_cursor*, sqlite_int64*) { … }
DbSqliteModule::QueryCost DbSqliteModule::EstimateCost(
const Table::Schema& schema,
uint32_t row_count,
sqlite3_index_info* info,
const std::vector<int>& cs_idxes,
const std::vector<int>& ob_idxes) { … }
DbSqliteModule::State::State(Table* _table, Table::Schema _schema)
: … { … }
DbSqliteModule::State::State(std::unique_ptr<RuntimeTable> _table)
: … { … }
DbSqliteModule::State::State(
std::unique_ptr<StaticTableFunction> _static_function)
: … { … }
DbSqliteModule::State::State(TableComputation _computation,
Table::Schema _schema)
: … { … }
}