1414// You should have received a copy of the GNU General Public License
1515// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
17+ #include < signal.h>
18+
1719#include < algorithm>
1820#include < cstdio>
1921#include < iostream>
2022#include < optional>
2123#include < thread>
2224
23- #include < signal.h>
24-
2525#ifdef _WIN32
2626
2727#include < cstdlib>
@@ -58,6 +58,8 @@ DEFINE_bool(term_colors, false, "Use terminal colors syntax highlighting.");
5858DEFINE_string (output_format, " tabular" ,
5959 " Query output format. Can be csv/tabular. If output format is "
6060 " other than tabular `fit-to-screen` flag is ignored." );
61+ DEFINE_bool (verbose_execution_info, false ,
62+ " Output the additional information about query such is query cost, parsing, planning and execution times." );
6163DEFINE_validator (output_format, [](const char *, const std::string &value) {
6264 if (value == constants::kCsvFormat || value == constants::kTabularFormat ) {
6365 return true ;
@@ -252,13 +254,11 @@ int main(int argc, char **argv) {
252254 if (query->empty ()) {
253255 continue ;
254256 }
255-
256257 try {
257258 auto ret = query::ExecuteQuery (session.get (), *query);
258259 if (ret.records .size () > 0 ) {
259260 Output (ret.header , ret.records , output_opts, csv_opts);
260261 }
261-
262262 if (console::is_a_tty (STDIN_FILENO)) {
263263 std::string summary;
264264 if (ret.records .size () == 0 ) {
@@ -268,7 +268,7 @@ int main(int argc, char **argv) {
268268 } else {
269269 summary = std::to_string (ret.records .size ()) + " rows in set" ;
270270 }
271- std::printf (" %s (%.3lf sec)\n " , summary.c_str (), ret.wall_time .count ());
271+ std::printf (" %s (round trip in %.3lf sec)\n " , summary.c_str (), ret.wall_time .count ());
272272 auto history_ret = save_history ();
273273 if (history_ret != 0 ) {
274274 cleanup_resources ();
@@ -280,6 +280,9 @@ int main(int argc, char **argv) {
280280 if (ret.stats ) {
281281 console::EchoStats (ret.stats .value ());
282282 }
283+ if (FLAGS_verbose_execution_info && ret.execution_info ) {
284+ console::EchoExecutionInfo (ret.execution_info .value ());
285+ }
283286 }
284287 } catch (const utils::ClientQueryException &e) {
285288 if (!console::is_a_tty (STDIN_FILENO)) {
0 commit comments