Hyper API for C++
0.0.16638
Hyper client library for C++ applications
|
Go to the documentation of this file.
5 #ifndef TABLEAU_HYPER_CONNECTION_HPP
6 #define TABLEAU_HYPER_CONNECTION_HPP
15 #include <hyperapi/impl/infra.hpp>
21 #include <hyperapi/hyperapi.h>
28 None = HYPER_DO_NOT_CREATE,
43 using CatalogPimpl = std::unique_ptr<Catalog>;
55 Connection(
const Endpoint& endpoint,
const std::unordered_map<std::string, std::string>& parameters = {});
70 const std::string& databasePath,
72 const std::unordered_map<std::string, std::string>& parameters = {});
169 template <typename T>
208 bool isOpen() const noexcept {
return m_handle !=
nullptr; }
214 virtual void close() noexcept;
247 hyper_connection_t* m_handle =
nullptr;
249 CatalogPimpl m_catalog;
251 std::unique_ptr<internal::NoticeReceiver> noticeReceiver{
new internal::NoticeReceiver()};
253 std::unique_ptr<internal::AsyncResultCallback> asyncResultCallback{
new internal::AsyncResultCallback()};
255 friend class Catalog;
256 friend class Inserter;
257 friend void internal::setNoticeReceiver(
Connection& connection, internal::NoticeReceiver noticeReceiver) noexcept;
258 friend void internal::setAsyncResultCallback(
Connection& connection, internal::AsyncResultCallback asyncResultCallback) noexcept;
259 friend const internal::AsyncResultCallback& internal::getAsyncResultCallback(
Connection& connection) noexcept;
260 friend hyper_connection_t* internal::getHandle(
Connection&) noexcept;
264 #include <hyperapi/impl/Catalog.impl.hpp>
265 #include <hyperapi/impl/Connection.impl.hpp>
HYPER_API_NODISCARD Result executeQuery(const std::string &sql)
Executes a SQL query and returns the result.
Create the database. Method will fail if the database already exists.
Create the database. If it already exists, drop the old one first.
CreateMode
Database creation behavior during connection establishing.
static std::vector< HyperServiceVersion > querySupportedHyperServiceVersionRange(const Endpoint &endpoint)
Connects to the Hyper endpoint and determines which Hyper Service version numbers are common between ...
bool isOpen() const noexcept
Checks whether the connection is open.
T executeScalarQuery(const std::string &sql)
Executes a SQL query that returns exactly one row with one column.
bool isCapabilityActive(const std::string &capabilityFlag)
Returns true if the capability flag is active on this connection.
virtual ~Connection() noexcept
Destructor.
Do not create the database. Method will fail if database doesn't exist.
void cancel() noexcept
Issues an asynchronous cancel request for the running query on the given connection.
bool isReady()
Checks whether the connection is ready, i.e., if the connection can be used.
Base class for a result of a query.
The catalog class gives access to the metadata of the attached databases of a connection.
HyperServiceVersion getHyperServiceVersion()
Returns the Hyper Service version of this connection.
Defines a Hyper connection.
Describes a network endpoint at which a Hyper server is accessible.
int64_t executeCommand(const std::string &sql)
Executes a SQL command and returns the affected row count, if any.
Connection() noexcept
Constructs a Connection object that does not represent a connection.
The primary namespace of the Hyper API for C++.
virtual void close() noexcept
Closes the connection.
Create the database if it doesn't exist.
A Hyper Service version number of the form 'major.minor'.
Catalog & getCatalog() noexcept
Returns the catalog of this connection.