Skip to content

Demonstration of connection pool for libpqxx. Port from https://github.com/borisovs/pool to work with libpqxx. Tested on Ubuntu 16.04.

License

Notifications You must be signed in to change notification settings

abzico/pqxx_pool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pqxx_pool

This project works on top of great work by borisovs (https://github.com/borisovs/pool) which directly use libpq's API via libpq-fe.h but now this project call APIs through libpqxx.

Tehnical

The implementation focuses on having connection pool which its number of available connection is set via POOL_SIZE in PGPool.h file. In main.cpp, it simulates creating a new 10 threads holding of each available connection from the pool to execute DB related task. Ideally, the concurrency model at this point is up to your app implementation. See more detail for possible ways at http://pqxx.org/development/libpqxx/wiki/Threading .

What to do?

Create a database namely demo first by log in to your postgres console, and execute create database demo. Then execute SQL statements from provided file (pool.sql) to insert necessary tables into such database as follows

psql -U postgres demo < pool.sql

Then compile, link and make executable file via the following

make

It will produce an executable called pool at the same directory.

Finally run with

PGDATABASE=demo PGUSER=postgres PGPASSWORD="...your password if any..." ./pool

License

MIT, Abzi.co

About

Demonstration of connection pool for libpqxx. Port from https://github.com/borisovs/pool to work with libpqxx. Tested on Ubuntu 16.04.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published