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

Class EmbeddedShell

tools/shell/include/embedded_shell.h:23–88  ·  view source on GitHub ↗

* Embedded shell simulate a session that directly connects to the system. */

Source from the content-addressed store, hash-verified

21 * Embedded shell simulate a session that directly connects to the system.
22 */
23class EmbeddedShell {
24
25public:
26 EmbeddedShell(std::shared_ptr<Database> database, std::shared_ptr<Connection> conn,
27 ShellConfig& shellConfig);
28
29 void run();
30
31 std::vector<std::unique_ptr<QueryResult>> processInput(std::string input);
32
33 void printErrorMessage(std::string input, QueryResult& queryResult);
34
35 static void interruptHandler(int signal);
36
37private:
38 int processShellCommands(std::string lineStr);
39
40 static void printHelp();
41
42 void printExecutionResult(QueryResult& queryResult) const;
43
44 void printTruncatedExecutionResult(QueryResult& queryResult) const;
45
46 std::string printJsonExecutionResult(QueryResult& queryResult) const;
47
48 std::string printHtmlExecutionResult(QueryResult& queryResult) const;
49
50 std::string printLatexExecutionResult(QueryResult& queryResult) const;
51
52 std::string printLineExecutionResult(QueryResult& queryResult) const;
53
54 void updateTableNames();
55
56 void updateFunctionAndTypeNames();
57
58 void setMaxRows(const std::string& maxRowsString);
59
60 void setMaxWidth(const std::string& maxWidthString);
61
62 void setMode(const std::string& modeString);
63
64 void setStats(const std::string& statsString);
65
66 void setLinenoiseMode(int mode);
67
68 void setHighlighting(const std::string& highlightingString);
69
70 void setErrors(const std::string& errorsString);
71
72 void setComplete(const std::string& completeString);
73
74 void printSchema();
75
76 void checkConfidentialStatement(const std::string& query, QueryResult* queryResult,
77 std::string& input);
78
79private:
80 std::shared_ptr<Database> database;

Callers 1

mainFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected