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

Method bindExportDatabaseClause

src/binder/bind/bind_export_database.cpp:145–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145std::unique_ptr<BoundStatement> Binder::bindExportDatabaseClause(const Statement& statement) {
146 auto& exportDB = statement.constCast<ExportDB>();
147 auto parsedOptions = bindParsingOptions(exportDB.getParsingOptionsRef());
148 auto fileTypeInfo = getFileType(parsedOptions);
149 switch (fileTypeInfo.fileType) {
150 case FileType::CSV:
151 case FileType::PARQUET:
152 break;
153 default:
154 throw BinderException("Export database currently only supports csv and parquet files.");
155 }
156 auto exportSchemaOnly = schemaOnly(parsedOptions, exportDB);
157 if (!exportSchemaOnly && fileTypeInfo.fileType != FileType::CSV && parsedOptions.size() != 0) {
158 throw BinderException{"Only export to csv can have options."};
159 }
160 auto exportData =
161 getExportInfo(*Catalog::Get(*clientContext), clientContext, this, fileTypeInfo);
162 auto boundFilePath = VirtualFileSystem::GetUnsafe(*clientContext)
163 ->expandPath(clientContext, exportDB.getFilePath());
164 return std::make_unique<BoundExportDatabase>(boundFilePath, fileTypeInfo, std::move(exportData),
165 std::move(parsedOptions), exportSchemaOnly);
166}
167
168} // namespace binder
169} // namespace lbug

Callers

nothing calls this directly

Calls 6

getFileTypeFunction · 0.85
schemaOnlyFunction · 0.85
getExportInfoFunction · 0.85
sizeMethod · 0.45
expandPathMethod · 0.45
getFilePathMethod · 0.45

Tested by

no test coverage detected