| 41 | } |
| 42 | |
| 43 | void bindExportTableData(ExportedTableData& tableData, const std::string& query, |
| 44 | main::ClientContext* context, Binder* binder) { |
| 45 | auto parsedStatement = Parser::parseQuery(query); |
| 46 | DASSERT(parsedStatement.size() == 1); |
| 47 | auto parsedQuery = parsedStatement[0]->constPtrCast<RegularQuery>(); |
| 48 | context->setUseInternalCatalogEntry(true /* useInternalCatalogEntry */); |
| 49 | auto boundQuery = binder->bindQuery(*parsedQuery); |
| 50 | context->setUseInternalCatalogEntry(false /* useInternalCatalogEntry */); |
| 51 | auto columns = boundQuery->getStatementResult()->getColumns(); |
| 52 | for (auto& column : columns) { |
| 53 | auto columnName = column->hasAlias() ? column->getAlias() : column->toString(); |
| 54 | tableData.columnNames.push_back(columnName); |
| 55 | tableData.columnTypes.push_back(column->getDataType().copy()); |
| 56 | } |
| 57 | tableData.regularQuery = std::move(boundQuery); |
| 58 | } |
| 59 | |
| 60 | static std::string getExportNodeTableDataQuery(const TableCatalogEntry& entry) { |
| 61 | return std::format("match (a:`{}`) return a.*", entry.getName()); |
no test coverage detected