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

Method Print

tools/shell/shell.cpp:339–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337const string EVAL_SQL_EMPTY = "#EMPTY#";
338
339void ShellState::Print(PrintOutput output, const char *str, idx_t len) {
340 if (seenInterrupt) {
341 // no more printing after seeing an interrupt
342 return;
343 }
344
345#if defined(_WIN32) || defined(WIN32)
346 if ((stdout_is_console && (out == stdout || out == stderr)) && !pager_is_active) {
347 // convert from utf8 to utf16
348 string data_str = str ? string(str, len) : "";
349 auto unicode_text = ShellState::Win32Utf8ToUnicode(data_str);
350 auto out_handle = GetStdHandle(output == PrintOutput::STDOUT ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE);
351 // use WriteConsoleW to write the unicode codepoints to the console
352 WriteConsoleW(out_handle, unicode_text.c_str(), unicode_text.size(), NULL, NULL);
353 return;
354 }
355#endif
356 fwrite((const void *)str, len, 1, output == PrintOutput::STDOUT ? out : stderr);
357}
358
359void ShellState::Print(PrintOutput output, const char *str) {
360 if (seenInterrupt) {

Callers 14

mainFunction · 0.45
PrintTextMethod · 0.45
PrintErrorMethod · 0.45
SetColorMethod · 0.45
RunShellCommandFunction · 0.45
DisplayColorsFunction · 0.45
SetReadLineVersionFunction · 0.45
SetPagerFunction · 0.45
RunArrowComparisonMethod · 0.45
CHECK_COLUMNFunction · 0.45
test_runnerFunction · 0.45

Calls 4

c_strMethod · 0.80
sizeMethod · 0.45
GetDataMethod · 0.45
GetSizeMethod · 0.45

Tested by 4

RunArrowComparisonMethod · 0.36
CHECK_COLUMNFunction · 0.36
test_runnerFunction · 0.36
test_deserializationFunction · 0.36