Skip to content
This repository was archived by the owner on Jun 3, 2026. It is now read-only.

alpha-strike-space/Insertion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Insertion

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.


Table of Contents


Overview

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.

Features

  • 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.

Getting Started

Dependencies

Ensure you have these installed:

  • C++17 compatible compiler (g++, clang++)
  • libpqxx — PostgreSQL C++ library
  • nlohmann/json — Modern C++ JSON library
  • libcurl — 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-dev

Building

To compile the main program (e.g., kill_update.cpp):

g++ -std=c++17 kill_update.cpp -o kill_update -lpqxx -lpq -lcurl

If 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 appropriately

Configuration

Set these environment variables before running:

  • PGHOST — PostgreSQL server host (e.g., localhost)
  • PGPORT — PostgreSQL port (default: 5432)
  • PGUSER — Database username
  • PGPASSWORD — Database password
  • PGDATABASE — Database name

Example:

export PGHOST=localhost
export PGPORT=5432
export PGUSER=myuser
export PGPASSWORD=mypassword
export PGDATABASE=leaderboard

Usage

  1. Ensure your PostgreSQL server is running and accessible.
  2. Set required environment variables.
  3. Run the compiled binary:
    ./kill_update
    • The program may accept command-line arguments or read JSON input—see source code for details.
  4. For automated usage, integrate this binary with your event system of choice.

Code Structure

  • 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.

Troubleshooting & FAQ

  • 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.

Contributing

Contributions are welcome!

  1. Fork the repository.
  2. Create a feature branch.
  3. Submit pull requests with clear descriptions.
  4. Open issues for bugs or feature requests.

License

This project is licensed under the GNU General Public License v2.0.


For questions or support, open an issue on GitHub.

About

Insertion into the proper postgresql table for the leaderboard.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors