A C++ utility for inserting game event data (such as leaderboard "kills") into a PostgreSQL database. Designed for high-performance, reliable data handling in the competitive environment of Eve Frontier.
Insertion is a tool for reliably inserting game events into a PostgreSQL database, with special attention to efficiency and extensibility. It is used for environments such as Eve Frontier where statistical updates and accuracy are critical.
- Fast and safe insertion of leaderboard events.
- Uses industry-standard libraries: libpqxx (PostgreSQL), nlohmann/json (JSON), libcurl (HTTP).
- Configurable PostgreSQL connection via environment variables.
- Modular code for easy extension (e.g., support other event types).
- Simple CLI for manual or automated use.
Ensure you have these installed:
- C++17 compatible compiler (g++, clang++)
libpqxx— PostgreSQL C++ librarynlohmann/json— Modern C++ JSON librarylibcurl— For HTTP requests- PostgreSQL server — For the actual leaderboard database
Ubuntu/Debian:
sudo apt-get update
sudo apt-get install g++ libpqxx-dev nlohmann-json3-dev libcurl4-openssl-devTo compile the main program (e.g., kill_update.cpp):
g++ -std=c++17 kill_update.cpp -o kill_update -lpqxx -lpq -lcurlIf nlohmann/json is not system-installed:
wget https://github.com/nlohmann/json/releases/latest/download/json.hpp
# Place json.hpp in the project directory or set the include path appropriatelySet these environment variables before running:
PGHOST— PostgreSQL server host (e.g.,localhost)PGPORT— PostgreSQL port (default:5432)PGUSER— Database usernamePGPASSWORD— Database passwordPGDATABASE— Database name
Example:
export PGHOST=localhost
export PGPORT=5432
export PGUSER=myuser
export PGPASSWORD=mypassword
export PGDATABASE=leaderboard- Ensure your PostgreSQL server is running and accessible.
- Set required environment variables.
- Run the compiled binary:
./kill_update
- The program may accept command-line arguments or read JSON input—see source code for details.
- For automated usage, integrate this binary with your event system of choice.
- kill_update.cpp — Main program logic, handles input, processes events, inserts into database.
All other file follow a similar logic. You may either do this with CMakeLists.txt to create executables and services or run everything on containers with the Docker Engine.
- Connection errors: Double-check environment variables and database credentials.
- Missing dependencies: Install all required libraries and headers, especially PostgreSQL and cURL.
- Segmentation faults: Ensure correct input format and valid pointers.
- How do I add a new event type?
Extend the parsing and insertion logic in the main source files respective of their proper functions.
Contributions are welcome!
- Fork the repository.
- Create a feature branch.
- Submit pull requests with clear descriptions.
- Open issues for bugs or feature requests.
This project is licensed under the GNU General Public License v2.0.
For questions or support, open an issue on GitHub.