ajout code pour analyser les interactions
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
.vscode
|
||||
build
|
||||
36
CMakeLists.txt
Normal file
36
CMakeLists.txt
Normal file
@@ -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)
|
||||
6
include/database.h
Normal file
6
include/database.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef DATABASE_H
|
||||
#define DATABASE_H
|
||||
|
||||
|
||||
|
||||
#endif // DATABASE_H
|
||||
33
src/main.cpp
Normal file
33
src/main.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
|
||||
#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<string> 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<std::chrono::milliseconds>(end - begin).count() << "ms elasped" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user