Ignore:
Timestamp:
08/03/18 20:53:39 (6 years ago)
Author:
tbretz
Message:
Output some more connection information with print-connect
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/rootifysql.cc

    r19134 r19136  
    3535        ("ignore",        vars<string>(),              "Ignore the given columns")
    3636        ("display,d",     po_switch(),                 "Displays contents on the screen (most usefull in combination with mysql statements as SHOW or EXPLAIN)")
    37         ("write",         var<string>(""),             "Write output to an ascii file")
     37        ("write,w",       var<string>(""),             "Write output to an ascii file")
    3838        ("null,n",        po_switch(),                 "Redirect the output file to /dev/null (mainly for debugging purposes, e.g. performance studies)")
    3939        ("no-fill",       po_switch(),                 "Do not fill events into the root file (mainly for debugging purposes, e.g. performance studies)")
     
    446446            if (!l.empty() && l[0]!='#')
    447447                envs[ident].push_back(line);
     448        }
    448449
    449450        if (verbose>0)
     
    499500    Database connection(uri); // Keep alive while fetching rows
    500501
     502    if (verbose>0)
     503    {
     504        cout << "Client Version: " << connection.client_version() << '\n';
     505        cout << "Server Version: " << connection.server_version() << endl;
     506    }
     507
    501508    if (print_connection)
    502509    {
     
    511518        catch (const exception &e)
    512519        {
    513             cerr << "\nSHOW STATUS LIKE COMPRESSION\n\n";
     520            cerr << "\nSHOW STATUS LIKE 'Compression'\n\n";
    514521            cerr << "SQL query failed:\n" << e.what() << endl;
    515522            return 6;
     
    650657
    651658    if (verbose>0)
    652         cout << "Opening file '" << path << "' [compression=" << compression << "]..." << endl;
     659    {
     660        cout << "Opening file '" << path << "' [compression=" << compression << "]...\n";
     661        cout << "Writing data to tree '" << tree << "'" << endl;
     662    }
    653663
    654664    // ----------------------------- Open output file --------------------------
     
    931941    }
    932942
     943    if (print_connection)
     944    {
     945        try
     946        {
     947            const auto &res1 = connection.query("SHOW STATUS LIKE 'Bytes_%'").store();
     948            cout << left << setw(16) << res1[0]["Variable_name"] << ' ' << Tools::Scientific(res1[0]["Value"]) << endl;
     949            cout << left << setw(16) << res1[1]["Variable_name"] << ' ' << Tools::Scientific(res1[1]["Value"]) << endl;
     950            cout << endl;
     951        }
     952        catch (const exception &e)
     953        {
     954            cerr << "\nSHOW STATUS LIKE 'Bytes_%'\n\n";
     955            cerr << "SQL query failed:\n" << e.what() << endl;
     956            return 6;
     957        }
     958    }
     959
    933960    return 0;
    934961}
Note: See TracChangeset for help on using the changeset viewer.