| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
High performance C++ PostgreSQL database driver (only tested in Ubuntu and Ubuntu server!)
currently only supports running SQL queries!
Header only lib, so you can just copy the files from "src" folder into your project, and check the CMakeLists in the root folder and make sure you have the dependencies in your project.
The test project uses the following dependency setup...
...
find_package(Threads)
link_libraries(${Threads})
find_package(PostgreSQL)
include_directories(/usr/include/postgresql/current)
target_link_libraries(${PROJECT_NAME} PostgreSQL::PostgreSQL ${CMAKE_THREAD_LIBS_INIT})
Here is some sample code...
// `PGQueryProcessor` is meant to be a long lived object, and when you close your application you should delete it
// connection strings can be a Unix Domain Socket for a performance boost
PGQueryProcessor *p = PGQueryProcessor::createInstance("host=/var/run/postgresql dbname=foo user=bar password=foobar");
// this is the callback after each query is executed
const auto callback = [](PGResultSet&& resultSet) {
for (PGRow& row : resultSet.rows) {
std::cout << row.get("car") << std::endl;
}
};
p->push(
PGQueryParams::createBuilder("select * from bar where car=$1")
.addParam("jaguar")
.build(),
callback
);
delete p;
// connection pool size = 32
// queries per connection = 32
// query queue size = 178000
// response thread pool size = 2
PGQueryProcessor::createInstance("...", 32, 32, 178000, 2);
Results #1: 175,000 - 177,000 queries per second (complete query round trips that return a single row from a user table, and the callback is called)
More details: TODO
// connection pool size = 6
PGQueryProcessor::createInstance("...", 6);
Results #1: TODO
Results #2: TODO
More details: TODO
This project uses the MIT license
Copyright (c) 2023 Vibelife Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| Back | FazBrowse Home | New Git URL |