| 24 | } |
| 25 | |
| 26 | void ImportDB::executeInternal(ExecutionContext* context) { |
| 27 | auto clientContext = context->clientContext; |
| 28 | if (query.empty()) { // Export empty database. |
| 29 | appendMessage("Imported database successfully.", |
| 30 | storage::MemoryManager::Get(*clientContext)); |
| 31 | return; |
| 32 | } |
| 33 | // TODO(Guodong): this is special for "Import database". Should refactor after we support |
| 34 | // multiple DDL and COPY statements in a single transaction. |
| 35 | // Currently, we split multiple query statements into single query and execute them one by one, |
| 36 | // each with an auto transaction. |
| 37 | auto transactionContext = transaction::TransactionContext::Get(*clientContext); |
| 38 | if (transactionContext->hasActiveTransaction()) { |
| 39 | transactionContext->commit(); |
| 40 | } |
| 41 | auto res = clientContext->queryNoLock(query); |
| 42 | validateQueryResult(res.get()); |
| 43 | if (!indexQuery.empty()) { |
| 44 | res = clientContext->queryNoLock(indexQuery); |
| 45 | validateQueryResult(res.get()); |
| 46 | } |
| 47 | appendMessage("Imported database successfully.", storage::MemoryManager::Get(*clientContext)); |
| 48 | } |
| 49 | |
| 50 | } // namespace processor |
| 51 | } // namespace lbug |
nothing calls this directly
no test coverage detected