diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6a8bc10 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vscode +build \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..5c51623 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.14) +project(analyze) + +# https://github.com/sjinks/sqlite3-cmake/ +include(FetchContent) +FetchContent_Declare( + sqlite3_amalgamation + URL https://sqlite.org/2025/sqlite-amalgamation-3500200.zip + URL_HASH SHA3_256=75c118e727ee6a9a3d2c0e7c577500b0c16a848d109027f087b915b671f61f8a + DOWNLOAD_EXTRACT_TIMESTAMP TRUE +) +FetchContent_MakeAvailable(sqlite3_amalgamation) + +add_library(sqlite3 STATIC + ${sqlite3_amalgamation_SOURCE_DIR}/sqlite3.c +) +target_include_directories(sqlite3 PUBLIC + ${sqlite3_amalgamation_SOURCE_DIR} +) +add_library(SQLite::SQLite3 ALIAS sqlite3) + +FetchContent_Declare( + sqlite3pp + GIT_REPOSITORY https://github.com/iwongu/sqlite3pp.git + GIT_TAG master +) +FetchContent_MakeAvailable(sqlite3pp) + +file(GLOB SOURCES src/*.cpp) +add_executable(${PROJECT_NAME} ${SOURCES}) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14) +target_include_directories(${PROJECT_NAME} PUBLIC + include + ${sqlite3pp_SOURCE_DIR}/headeronly_src +) +target_link_libraries(${PROJECT_NAME} PRIVATE SQLite::SQLite3) diff --git a/include/database.h b/include/database.h new file mode 100644 index 0000000..ddca155 --- /dev/null +++ b/include/database.h @@ -0,0 +1,6 @@ +#ifndef DATABASE_H +#define DATABASE_H + + + +#endif // DATABASE_H diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..f04cf91 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,33 @@ +#include +#include +#include +#include + +#include "sqlite3pp.h" + +using namespace std; + +int main(int argc, char const *argv[]) +{ + chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); + + sqlite3pp::database db("../uwu2x.db"); + + sqlite3pp::query qry(db, "SELECT identifier FROM interaction;"); + + set identifiers; + + for (auto v : qry) { + string identifier; + v.getter() >> identifier; + identifiers.insert(identifier); + } + + cout << identifiers.size() << " users" << endl; + + std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); + + cout << chrono::duration_cast(end - begin).count() << "ms elasped" << endl; + + return 0; +} diff --git a/uwu2x.db b/uwu2x.db new file mode 100644 index 0000000..3780be5 Binary files /dev/null and b/uwu2x.db differ