{"id":20602341,"url":"https://github.com/jbaldwin/libpriamcql","last_synced_at":"2026-04-19T17:33:41.220Z","repository":{"id":54666808,"uuid":"133183492","full_name":"jbaldwin/libpriamcql","owner":"jbaldwin","description":"Safe and easy to use C++17 CQL (Cassandra/ScyllaDB) client library. ","archived":false,"fork":false,"pushed_at":"2021-02-04T19:49:25.000Z","size":315,"stargazers_count":2,"open_issues_count":2,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-17T01:50:21.604Z","etag":null,"topics":["async","cassandra","client","cpp","cpp17","cql","scylladb"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jbaldwin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-12T21:07:28.000Z","updated_at":"2024-03-26T07:58:35.000Z","dependencies_parsed_at":"2022-08-13T23:20:17.836Z","dependency_job_id":null,"html_url":"https://github.com/jbaldwin/libpriamcql","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbaldwin%2Flibpriamcql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbaldwin%2Flibpriamcql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbaldwin%2Flibpriamcql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbaldwin%2Flibpriamcql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbaldwin","download_url":"https://codeload.github.com/jbaldwin/libpriamcql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242243482,"owners_count":20095719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","cassandra","client","cpp","cpp17","cql","scylladb"],"created_at":"2024-11-16T09:13:35.415Z","updated_at":"2026-04-19T17:33:41.191Z","avatar_url":"https://github.com/jbaldwin.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"libpriamcql - Safe Easy to use C++17 CQL Client library\n=======================================================\n\n[![CI](https://github.com/jbaldwin/libpriamcql/workflows/build/badge.svg)](https://github.com/jbaldwin/libpriamcql/workflows/build/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/jbaldwin/libpriamcql/badge.svg?branch=master)](https://coveralls.io/github/jbaldwin/libpriamcql?branch=master)\n[![language][badge.language]][language]\n[![license][badge.license]][license]\n\n[badge.language]: https://img.shields.io/badge/language-C%2B%2B17-yellow.svg\n[badge.license]: https://img.shields.io/badge/license-Apache--2.0-blue\n\n[language]: https://en.wikipedia.org/wiki/C%2B%2B17\n[license]: https://en.wikipedia.org/wiki/Apache_License\n\nhttps://github.com/jbaldwin/libpriamcql\n\n**libpriamcql** is a C++17 client library that provides an easy, memory safe, and fast wrapper around the DataStax cpp-driver.\n\n**libpriamcql** is licensed under the Apache 2.0 license.\n\n# Overview #\n* Easy to use Synchronous and Asynchronous CQL Query Request Support.\n* Supports ad-hoc queries and prepared statements.\n* Safe C++17 client library API, modern memory move semantics.\n* Type Safe and easy conversions using Result/Row/Column objects to iterate over query results.\n* Leverages the [Datastax](https://github.com/datastax/cpp-driver) C driver internally.  This library is compiled and statically linked in the default build.\n** Its possible to use and link against your own build of the cpp-driver, see CMake option `PRIAM_BUILD_EMBEDDED_DATASTAX_DRIVER`.\n\n# Usage #\n\n## Examples\n\nSee all of the examples under the examples/ directory.\nBelow are some simple examples to get you started on using libpriamcql.\n\n### Simple Synchronous Prepared Statement\n\n```C++\n#include \u003cpriam/priam.hpp\u003e\n\n#include \u003cchrono\u003e\n#include \u003ciostream\u003e\n\nusing namespace std::chrono_literals;\n\nint main()\n{\n    // Start by creating a new cluster with settings on how to connect to Cassandra.\n    auto cluster_ptr = priam::cluster::make_unique();\n    cluster_ptr\n        -\u003eadd_host(\"localhost\")\n        .port(9042)\n        .username_and_password(\"username\", \"password\");\n\n    // Next create a client session to issue queries to Cassandra.  This requires\n    // moving ownership of the Cluster object into the Client instance.\n    auto client_ptr = std::make_unique\u003cpriam::client\u003e(std::move(cluster_ptr));\n\n    // Create a statement with a single primary key to be bound.\n    priam::statement stmt{\"SELECT val1, val2 FROM table_name WHERE primary_key = ?\"};\n    // Bind the 'primary_key' parameter, note that this can also be done by parameter index.\n    stmt.bind_int(5, \"primary_key\");\n\n    // Execute the statement synchronously, async queries are also supported.\n    auto result = client_ptr-\u003eexecute_statement(\n        stmt,                           // The statement to execute, can be re-used via reset().\n        std::chrono::seconds{5},        // An optional timeout.\n        priam::consistency::local_one   // An optional query consistency.\n    );\n\n    // Now that we have the result we can work with the data.\n    std::cout \u003c\u003c \"Status code: \" \u003c\u003c priam::to_string(result.status()) \u003c\u003c \"\\n\";\n    std::cout \u003c\u003c \"Row count: \" \u003c\u003c result.row_count() \u003c\u003c \"\\n\";\n    std::cout \u003c\u003c \"Columns count: \" \u003c\u003c result.column_count() \u003c\u003c \"\\n\";\n\n    for(const auto\u0026 row : result)\n    {\n        auto val1 = row[0];         // Fetch column value by name.\n        auto val2 = row[\"val2\"];    // Fetch column value by index.\n\n        // All the returned columns can also be iterator over.\n        for(const auto\u0026 value : row)\n        {\n            switch(value.type())\n            {\n                case priam::data_type::int_t:\n                    // All values in C* can be nullable and are returned as an optional.\n                    std::cout \u003c\u003c \"int value = \" \u003c\u003c value.as_int().value_or(0) \u003c\u003c \"\\n\";\n                    break;\n            }\n\n            if(value.is\u003cpriam::data_type::boolean\u003e())\n            {\n                std::cout \u003c\u003c \"bool value = \" \u003c\u003c value.as_boolean().value_or(false) \u003c\u003c \"\\n\";\n            }\n        }\n    }\n\n    return 0;\n}\n```\n\n## Requirements\n    C++17 compiler (g++/clang++)\n    CMake\n    make and/or ninja\n    pthreads/std::thread\n    libuv devel\n    openssl devel\n    zlib devel\n\n## Instructions\n\n### Building\n    # This will produce the libpriamcql.a and all of the examples and tests.\n\n    mkdir Release \u0026\u0026 cd Release\n    cmake -DCMAKE_BUILD_TYPE=Release ..\n    cmake --build . -- -j$(nproc)\n\nCMake options:\n\n| Name                                 | Default         | Description                                                                                                                                                        |\n|:-------------------------------------|:----------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| PRIAM_BUILD_EXAMPLES                 | ON              | Should the examples be built?                                                                                                                                      |\n| PRIAM_BUILD_TESTS                    | ON              | Should the tests be built?                                                                                                                                         |\n| PRIAM_CODE_COVERAGE                  | OFF             | Should code coverage be enabled?                                                                                                                                   |\n| PRIAM_USER_LINK_LIBRARIES            | uv pthread z dl | Override priam's target link libraries.                                                                                                                            |\n| PRIAM_BUILD_EMBEDDED_DATASTAX_DRIVER | ON              | By default priam will build an embedded datastax cpp driver.  Set this to OFF and provide a target via `PRIAM_USER_LINK_LIBRARIES` to link to your own cpp driver. |\n\n## Support\n\nFile bug reports, feature requests and questions using [GitHub Issues](https://github.com/jbaldwin/libpriamcql/issues)\n\nCopyright © 2017-2020, Josh Baldwin\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbaldwin%2Flibpriamcql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbaldwin%2Flibpriamcql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbaldwin%2Flibpriamcql/lists"}