| 52 | } |
| 53 | |
| 54 | void processRunCommands(EmbeddedShell& shell, const std::shared_ptr<Connection>& conn, |
| 55 | const std::string& filename) { |
| 56 | std::string fileContents; |
| 57 | try { |
| 58 | auto context = conn->getClientContext(); |
| 59 | auto fileInfo = VirtualFileSystem::GetUnsafe(*context)->openFile(filename, |
| 60 | FileOpenFlags(FileFlags::READ_ONLY), context); |
| 61 | auto fileSize = fileInfo->getFileSize(); |
| 62 | fileContents.resize(fileSize); |
| 63 | if (fileSize > 0) { |
| 64 | fileInfo->readFromFile(fileContents.data(), fileSize, 0); |
| 65 | } |
| 66 | } catch (Exception& e) { |
| 67 | if (filename != ".lbugrc") { |
| 68 | std::cerr << "Warning: cannot open init file: " << filename << ": " << e.what() << '\n'; |
| 69 | } |
| 70 | return; |
| 71 | } |
| 72 | |
| 73 | std::cout << "-- Processing: " << filename << '\n'; |
| 74 | std::istringstream stream{fileContents}; |
| 75 | std::string line; |
| 76 | while (std::getline(stream, line)) { |
| 77 | line += '\n'; |
| 78 | auto queryResults = shell.processInput(line); |
| 79 | for (auto& queryResult : queryResults) { |
| 80 | if (!queryResult->isSuccess()) { |
| 81 | shell.printErrorMessage(line, *queryResult); |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | bool isHttpfsLoaded(const std::shared_ptr<Connection>& conn) { |
| 88 | const auto& loadedExtensions = |
no test coverage detected