OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QueryExporterGDAL.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
20 
21 #include <string>
22 #include <vector>
23 
24 // forward declare instead of #include GDAL header
25 // to avoid double def of PACKAGE_NAME etc.
26 class GDALDataset;
27 class OGRLayer;
28 
29 namespace import_export {
30 
32  public:
33  explicit QueryExporterGDAL(const FileType file_type);
34  QueryExporterGDAL() = delete;
35  ~QueryExporterGDAL() override;
36 
37  void beginExport(const std::string& file_path,
38  const std::string& layer_name,
39  const CopyParams& copy_params,
40  const std::vector<TargetMetaInfo>& column_infos,
41  const FileCompression file_compression,
42  const ArrayNullHandling array_null_handling) final;
43  void exportResults(const std::vector<AggregatedResult>& query_results) final;
44  void endExport() final;
45 
46  private:
48  GDALDataset* gdal_dataset_;
49  OGRLayer* ogr_layer_;
50  std::vector<int> field_indices_;
52 
53  void cleanUp();
54 };
55 
56 } // namespace import_export
void beginExport(const std::string &file_path, const std::string &layer_name, const CopyParams &copy_params, const std::vector< TargetMetaInfo > &column_infos, const FileCompression file_compression, const ArrayNullHandling array_null_handling) final
void exportResults(const std::vector< AggregatedResult > &query_results) final