#include "src/trace_processor/sqlite/sqlite_engine.h"
#include <sqlite3.h>
#include <cstdint>
#include <optional>
#include <string>
#include <utility>
#include "perfetto/base/build_config.h"
#include "perfetto/base/logging.h"
#include "perfetto/base/status.h"
#include "perfetto/public/compiler.h"
#include "src/trace_processor/sqlite/scoped_db.h"
#include "src/trace_processor/sqlite/sql_source.h"
#include "src/trace_processor/tp_metatrace.h"
#include "protos/perfetto/trace_processor/metatrace_categories.pbzero.h"
#if PERFETTO_BUILDFLAG(PERFETTO_TP_PERCENTILE)
extern "C" int sqlite3_percentile_init(sqlite3* db,
char** error,
const sqlite3_api_routines* api);
#endif
namespace perfetto::trace_processor {
namespace {
void EnsureSqliteInitialized() { … }
void InitializeSqlite(sqlite3* db) { … }
std::optional<uint32_t> GetErrorOffsetDb(sqlite3* db) { … }
}
SqliteEngine::SqliteEngine() { … }
SqliteEngine::~SqliteEngine() { … }
SqliteEngine::PreparedStatement SqliteEngine::PrepareStatement(SqlSource sql) { … }
base::Status SqliteEngine::RegisterFunction(const char* name,
int argc,
Fn* fn,
void* ctx,
FnCtxDestructor* destructor,
bool deterministic) { … }
base::Status SqliteEngine::RegisterAggregateFunction(
const char* name,
int argc,
AggregateFnStep* step,
AggregateFnFinal* final,
void* ctx,
FnCtxDestructor* destructor,
bool deterministic) { … }
base::Status SqliteEngine::RegisterWindowFunction(const char* name,
int argc,
WindowFnStep* step,
WindowFnInverse* inverse,
WindowFnValue* value,
WindowFnFinal* final,
void* ctx,
FnCtxDestructor* destructor,
bool deterministic) { … }
base::Status SqliteEngine::UnregisterFunction(const char* name, int argc) { … }
base::Status SqliteEngine::DeclareVirtualTable(const std::string& create_stmt) { … }
void* SqliteEngine::GetFunctionContext(const std::string& name, int argc) { … }
std::optional<uint32_t> SqliteEngine::GetErrorOffset() const { … }
SqliteEngine::PreparedStatement::PreparedStatement(ScopedStmt stmt,
SqlSource source)
: … { … }
bool SqliteEngine::PreparedStatement::Step() { … }
bool SqliteEngine::PreparedStatement::IsDone() const { … }
const char* SqliteEngine::PreparedStatement::original_sql() const { … }
const char* SqliteEngine::PreparedStatement::sql() const { … }
}