pg_async is an unofficial PostreSQL database asynchronous client library written in modern C++ (std=c++11) on top of boost::asio library used for asynchronous network input-output.
Features
- Asynchronous operations
- Connection pooling
- Database aliases
- Standard container-compliant resultset interface
- Execution of prepared statements
- Query queuing
- Multiple result sets for simple query mode
- Data row extraction to tuples
- Flexible datatype conversion
- Compile-time statement parameter types binding and checking
- Extensible datatypes input-output system
- TCP or UNIX socket connection
Short usage overview
All classes are located in namespace tip::db::pg, if not specified other way.
Registering a connection
using namespace tip::db::pg;
- See Also
- Connection string and database alias
-
tip::db::pg::db_service reference
Transactions
db_service::begin(
"main"_db,
{
tran->commit();
},
[](db_error const& error)
{
}
);
- See Also
- Transactions
-
Connection string and database alias
-
Threads and thread safety
-
tip::db::pg::transaction for reference
Querying
query("main"_db, "select * from pg_catalog.pg_types").run_async(
},
[&](db_error const& err) {
});
- See Also
- Running queries for more information
-
Errors and exceptions
-
Callback types
-
Values input/output
-
tip::db::pg::query for reference
Processing query results
resultset res;
if (res) {
for (auto row : res) {
for (auto field : row) {
}
}
}
- See Also
- Processing query results for more information
-
Values input/output
-
tip::db::pg::resultset for reference
-
tip::db::pg::resultset::row for reference
-
tip::db::pg::resultset::field for reference