Polypheny C++ Driver

The Polypheny C++ driver 2.0.0 runs SQL, MongoQL and Cypher over the Prism protocol. It supports prepared SQL statements, batches, entity metadata and paged graph results. The default build uses Prism 2.3. Use a Prism 2.3 server with Cypher enabled for the graph examples.

Build from a release

Install a C++17 compiler, Meson 1.0 or newer, Ninja, pkg-config, GMP with its C++ interface, OpenSSL, and the Protobuf compiler and C++ library from the same installation. On Debian-based distributions the corresponding packages are g++, meson, ninja-build, pkg-config, libgmp-dev, libssl-dev, protobuf-compiler and libprotobuf-dev.

Download the 2.0.0 release archive and its SHA-256 file to the same directory. The archive bundles the pinned Prism schemas and Catch2 3 sources. Meson generates the Prism 2.3 C++ bindings used by the graph examples. On Linux, verify the download and build it with the bundled dependencies.

sha256sum -c Polypheny-CPP-Driver-2.0.0.tar.gz.sha256
tar -xzf Polypheny-CPP-Driver-2.0.0.tar.gz
cd Polypheny-CPP-Driver-2.0.0
meson setup build --wrap-mode=nodownload
meson compile -C build
meson test -C build --print-errorlogs

The default tests run without a Polypheny server. The build also compiles the driver repository’s examples in build/examples.

Build from source

To build the same release from Git, install the build dependencies listed above and check out its versioned tag. Meson checks the released Prism schema archive before generating the C++ bindings.

git clone --branch v2.0.0 --depth 1 https://github.com/polypheny/Polypheny-CPP-Driver.git
cd Polypheny-CPP-Driver
meson setup build
meson compile -C build
meson test -C build --print-errorlogs

Use the driver in a Meson application

From the directory containing the downloaded archive, create an application directory and extract the release into its subprojects directory.

mkdir -p polypheny-example/subprojects/Polypheny-CPP-Driver
tar -xzf Polypheny-CPP-Driver-2.0.0.tar.gz \
    --strip-components=1 --directory polypheny-example/subprojects/Polypheny-CPP-Driver
cp -R polypheny-example/subprojects/Polypheny-CPP-Driver/subprojects/packagecache \
    polypheny-example/subprojects/
cd polypheny-example

Meson looks for dependency archives in the application’s top-level subprojects/packagecache, so copy the bundled cache as shown above. Save the integration example as main.cpp in the application root. In the same directory, create the following meson.build file.

project('polypheny-example', 'cpp', default_options : ['cpp_std=c++17'])

driver = subproject('Polypheny-CPP-Driver')
driver_dep = driver.get_variable('polypheny_cpp_driver_dep')
executable('polypheny-example', 'main.cpp', dependencies : driver_dep)

Build from the application root and start the executable with the Prism server running.

meson setup build --wrap-mode=nodownload
meson compile -C build
./build/polypheny-example

The dependency supplies the include paths for PolyphenyCPPDriver.h and the linked driver and system libraries.

Upgrade from 1.0.0

  • Keep each result in its owning std::unique_ptr and move the pointer to transfer ownership.
  • Copying a cursor creates an independent cursor on the same connection with the same fetch size. Prepare statements separately on the new cursor.
  • Interval months and milliseconds are signed int64_t values.
  • Use as_decimal_string() to read the exact decimal text.

Experimental streaming build

Applications targeting the experimental Prism 5.1 protocol can use a separate build directory. Use a compatible experimental server for live streaming. See connection compatibility and streaming in the API reference.

meson setup build-streaming -Dprism_streaming=true
meson compile -C build-streaming
meson test -C build-streaming --print-errorlogs

Acknowledgments

Tobias Hafner developed the initial driver as part of his master’s project at the University of Basel. Tobias Hafner

© Polypheny GmbH. All Rights Reserved.