| 120 | } |
| 121 | |
| 122 | static bool schemaOnly(case_insensitive_map_t<Value>& parsedOptions, |
| 123 | const parser::ExportDB& exportDB) { |
| 124 | auto isSchemaOnlyOption = [](const std::pair<std::string, Value>& option) -> bool { |
| 125 | if (option.first != PortDBConstants::SCHEMA_ONLY_OPTION) { |
| 126 | return false; |
| 127 | } |
| 128 | if (option.second.getDataType() != LogicalType::BOOL()) { |
| 129 | throw common::BinderException{std::format("The '{}' option must have a BOOL value.", |
| 130 | PortDBConstants::SCHEMA_ONLY_OPTION)}; |
| 131 | } |
| 132 | return option.second.getValue<bool>(); |
| 133 | }; |
| 134 | auto exportSchemaOnly = |
| 135 | std::count_if(parsedOptions.begin(), parsedOptions.end(), isSchemaOnlyOption) != 0; |
| 136 | if (exportSchemaOnly && exportDB.getParsingOptionsRef().size() != 1) { |
| 137 | throw common::BinderException{std::format("When '{}' option is set to true in export " |
| 138 | "database, no other options are allowed.", |
| 139 | PortDBConstants::SCHEMA_ONLY_OPTION)}; |
| 140 | } |
| 141 | parsedOptions.erase(PortDBConstants::SCHEMA_ONLY_OPTION); |
| 142 | return exportSchemaOnly; |
| 143 | } |
| 144 | |
| 145 | std::unique_ptr<BoundStatement> Binder::bindExportDatabaseClause(const Statement& statement) { |
| 146 | auto& exportDB = statement.constCast<ExportDB>(); |
no test coverage detected