MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / schemaOnly

Function schemaOnly

src/binder/bind/bind_export_database.cpp:122–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122static 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
145std::unique_ptr<BoundStatement> Binder::bindExportDatabaseClause(const Statement& statement) {
146 auto& exportDB = statement.constCast<ExportDB>();

Callers 1

Calls 5

getDataTypeMethod · 0.80
eraseMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected