16static void copy(
const std::string& sourcePath,
const std::string& destinationPath) {
17 std::ifstream source(sourcePath, std::ios::binary);
18 std::ofstream destination(destinationPath, std::ios::binary);
19 destination << source.rdbuf();
24static void runDeleteDataInExistingHyperFile() {
25 std::cout <<
"EXAMPLE - Delete data from an existing Hyper file" << std::endl;
29 const std::string pathToSourceDatabase =
"data/superstore_sample.hyper";
32 const std::string pathToDatabase =
"data/superstore_sample_delete.hyper";
33 copy(pathToSourceDatabase, pathToDatabase);
44 std::cout <<
"Delete all rows from customer with the name 'Dennis Kane' from table " <<
hyperapi::escapeName(
"Orders") <<
"." << std::endl;
46 int64_t rowCount = connection.executeCommand(
50 std::cout <<
"The number of deleted rows in table " <<
hyperapi::escapeName(
"Orders") <<
" is " << rowCount <<
"." << std::endl
53 std::cout <<
"Delete all rows from customer with the name 'Dennis Kane' from table " <<
hyperapi::escapeName(
"Customer") <<
"." << std::endl;
54 rowCount = connection.executeCommand(
58 std::cout <<
"The number of deleted rows in table Customer is " << rowCount <<
"." << std::endl;
60 std::cout <<
"The connection to the Hyper file has been closed." << std::endl;
62 std::cout <<
"The Hyper Process has been shut down." << std::endl;
67 runDeleteDataInExistingHyperFile();
69 std::cout << e.
toString() << std::endl;
Defines a Hyper connection.
Defines an exception object that is thrown on failure by the functions in the Hyper API C++ library.
std::string toString() const
Returns a formatted string containing the message and hint of the error and all causes.
The main header of the Hyper API for C++.
@ SendUsageDataToTableau
Telemetry data will be sent to tableau to help improve the Hyper API.
std::string escapeName(string_view input)
Escapes the given string for safe usage in SQL query or command strings as an identifier.
std::string escapeStringLiteral(string_view input)
Escapes the given string for safe usage in SQL query or command strings as a string literal.