MCPcopy Create free account
hub / github.com/duckdb/duckdb / ExecuteSQL

Method ExecuteSQL

tools/shell/shell_prompt.cpp:312–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310}
311
312string Prompt::ExecuteSQL(ShellState &state, const string &query) {
313 string query_result;
314 auto &con = GetConnection(state);
315 auto exec_result = state.ExecuteSQLSingleValue(con, query, query_result);
316 switch (exec_result) {
317 case ExecuteSQLSingleValueResult::SUCCESS:
318 return query_result;
319 case ExecuteSQLSingleValueResult::EMPTY_RESULT:
320 return "#EMPTY#";
321 case ExecuteSQLSingleValueResult::MULTIPLE_ROWS:
322 return "#MULTIPLE_ROWS#";
323 case ExecuteSQLSingleValueResult::MULTIPLE_COLUMNS:
324 return "#MULTIPLE_COLUMNS#";
325 case ExecuteSQLSingleValueResult::NULL_RESULT:
326 return "#NULL#";
327 case ExecuteSQLSingleValueResult::EXECUTION_ERROR:
328 default:
329 return "#ERROR";
330 }
331}
332
333string Prompt::GeneratePrompt(ShellState &state) {
334 string prompt;

Callers

nothing calls this directly

Calls 1

ExecuteSQLSingleValueMethod · 0.80

Tested by

no test coverage detected