| 143 | } |
| 144 | |
| 145 | std::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 |
nothing calls this directly
no test coverage detected