OmniSciDB  8fa3bf436f
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ForeignDataWrapperShared.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 OmniSci, 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 
19 #include <stdexcept>
20 #include <string>
21 
22 namespace foreign_storage {
23 inline void throw_removed_row_error(const std::string& file_path) {
24  throw std::runtime_error{
25  "Refresh of foreign table created with \"APPEND\" update type failed as file "
26  "reduced in size: " +
27  file_path};
28 }
29 
30 inline void throw_removed_file_error(const std::string& file_path) {
31  throw std::runtime_error{
32  "Refresh of foreign table created with \"APPEND\" update type failed as "
33  "file \"" +
34  file_path + "\" was removed."};
35 }
36 inline void throw_number_of_columns_mismatch_error(size_t num_table_cols,
37  size_t num_file_cols,
38  const std::string& file_path) {
39  throw std::runtime_error{"Mismatched number of logical columns: (expected " +
40  std::to_string(num_table_cols) + " columns, has " +
41  std::to_string(num_file_cols) + "): in file '" + file_path +
42  "'"};
43 }
44 } // namespace foreign_storage
std::string to_string(char const *&&v)
void throw_removed_row_error(const std::string &file_path)
void throw_removed_file_error(const std::string &file_path)
void throw_number_of_columns_mismatch_error(size_t num_table_cols, size_t num_file_cols, const std::string &file_path)