|
1 | 1 | /** |
2 | | - * \example insert_spatial_data_to_a_hyper_file.cpp |
| 2 | + * \example insert_geospatial_data_to_a_hyper_file.cpp |
3 | 3 | * |
4 | | - * An example of how to insert spatial data into a single-table Hyper file. |
| 4 | + * An example of how to insert geospatial data into a single-table Hyper file. |
5 | 5 | */ |
6 | 6 |
|
7 | 7 | #include <hyperapi/hyperapi.hpp> |
|
14 | 14 | static const hyperapi::TableDefinition extractTable{ |
15 | 15 | {"Extract", "Extract"}, |
16 | 16 | {hyperapi::TableDefinition::Column{"Name", hyperapi::SqlType::text(), hyperapi::Nullability::NotNullable}, |
17 | | - hyperapi::TableDefinition::Column{"Location", hyperapi::SqlType::geography(), hyperapi::Nullability::NotNullable}}}; |
| 17 | + hyperapi::TableDefinition::Column{"Location", hyperapi::SqlType::tabgeography(), hyperapi::Nullability::NotNullable}}}; |
18 | 18 |
|
19 | 19 | static void runInsertSpatialDataToAHyperFile() { |
20 | | - std::cout << "EXAMPLE - Insert spatial data into a single table within a new Hyper file" << std::endl; |
| 20 | + std::cout << "EXAMPLE - Insert geospatial data into a single table within a new Hyper file" << std::endl; |
21 | 21 | const std::string pathToDatabase = "data/spatial_data.hyper"; |
22 | 22 |
|
23 | 23 | // Starts the Hyper Process with telemetry enabled to send data to Tableau. |
@@ -56,15 +56,15 @@ static void runInsertSpatialDataToAHyperFile() { |
56 | 56 | hyperapi::TableDefinition::Column{"Location_as_text", hyperapi::SqlType::text(), hyperapi::Nullability::NotNullable}}; |
57 | 57 |
|
58 | 58 | // Column 'Name' is inserted into "Extract"."Extract" as-is. |
59 | | - // Column 'Location' in "Extract"."Extract" of geography type is computed from Column 'Location_as_text' of text type |
60 | | - // using the expression 'CAST("Location_as_text") AS GEOGRAPHY'. |
| 59 | + // Column 'Location' in "Extract"."Extract" of `tableau.tabgeography` type is computed from Column 'Location_as_text' of `text` type |
| 60 | + // using the expression 'CAST("Location_as_text") AS TABLEAU.TABGEOGRAPHY'. |
61 | 61 | // hyperapi::Inserter::ColumnMapping is used for mapping the CAST expression to Column 'Location'. |
62 | | - std::string textToGeographyCastExpression = "CAST(" + hyperapi::escapeName("Location_as_text") + " AS GEOGRAPHY)"; |
| 62 | + std::string textToGeographyCastExpression = "CAST(" + hyperapi::escapeName("Location_as_text") + " AS TABLEAU.TABGEOGRAPHY)"; |
63 | 63 | std::vector<hyperapi::Inserter::ColumnMapping> columnMappings{ |
64 | 64 | hyperapi::Inserter::ColumnMapping{"Name"}, |
65 | 65 | hyperapi::Inserter::ColumnMapping{"Location", textToGeographyCastExpression}}; |
66 | 66 |
|
67 | | - // Insert spatial data into the "Extract"."Extract" table using CAST expression. |
| 67 | + // Insert geospatial data into the "Extract"."Extract" table using CAST expression. |
68 | 68 | { |
69 | 69 | hyperapi::Inserter inserter(connection, extractTable, columnMappings, inserterDefinition); |
70 | 70 | inserter.addRow("Seattle", "point(-122.338083 47.647528)"); |
|
0 commit comments