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

Method executeInternal

src/processor/operator/simple/import_db.cpp:26–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26void 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

Callers

nothing calls this directly

Calls 6

validateQueryResultFunction · 0.85
hasActiveTransactionMethod · 0.80
queryNoLockMethod · 0.80
emptyMethod · 0.45
commitMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected