Changeset 19204
- Timestamp:
- 09/03/18 13:00:33 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/rootifysql.cc
r19186 r19204 29 29 ("display,d", po_switch(), "Displays contents on the screen (most usefull in combination with mysql statements as SHOW or EXPLAIN)") 30 30 ("write,w", var<string>(""), "Write output to an ascii file") 31 ("delimiter", var<string>( ""),"The delimiter used if contents are displayed with --display (default=\\t)")31 ("delimiter", var<string>(), "The delimiter used if contents are displayed with --display (default=\\t)") 32 32 ("explain", po_switch(), "Requests an EXPLAIN from the server (shows the server optimized query)\nsee also https://dev.mysql.com/doc/refman/explain-output.html") 33 33 ("profiling", po_switch(), "Turn on profiling and print profile") … … 480 480 const uint16_t verbose = conf.Get<uint16_t>("verbose"); 481 481 const uint16_t compression = conf.Get<uint16_t>("compression"); 482 const string delimiter = conf. Get<string>("delimiter");482 const string delimiter = conf.Has("delimiter") ? conf.Get<string>("delimiter") : "\t"; 483 483 const vector<string> _ignore = conf.Vec<string>("ignore"); 484 484 const bool print_connection = conf.Get<bool>("print-connection"); … … 868 868 { 869 869 cout << endl; 870 cout << "#"; 871 for (size_t i=0; i<l.size(); i++) 872 cout << ' ' << l[i].c_str(); 873 cout << endl; 870 cout << "# " << row.field_list(delimiter.c_str()) << endl; 874 871 } 875 872 876 873 if (!write.empty()) 877 { 878 fout << "#"; 879 for (size_t i=0; i<l.size(); i++) 880 fout << ' ' << l[i].c_str(); 881 fout << endl; 882 } 874 fout << "# " << row.field_list(delimiter.c_str()) << endl; 883 875 884 876 // ---------------------- Fill TTree with DB data -------------------------- … … 889 881 count++; 890 882 891 ostringstream sout; 883 if (display) 884 cout << row.value_list(delimiter.c_str(), mysqlpp::do_nothing) << '\n'; 885 if (!write.empty()) 886 fout << row.value_list(delimiter.c_str(), mysqlpp::do_nothing) << '\n'; 892 887 893 888 size_t idx=0; 894 889 for (auto col=row.begin(); col!=row.end(); col++, idx++) 895 890 { 896 if (display || !write.empty())897 {898 if (idx>0)899 sout << (delimiter.empty()?"\t":delimiter);900 sout << col->c_str();901 }902 903 891 if (!ignorenull && col->is_null()) 904 892 { … … 932 920 } 933 921 934 if (idx==row.size()) 935 { 936 if (!nofill) 937 ttree->Fill(); 938 939 if (display) 940 cout << sout.str() << endl; 941 if (!write.empty()) 942 fout << sout.str() << '\n'; 943 } 922 if (idx==row.size() && !nofill) 923 ttree->Fill(); 944 924 945 925 row = res.fetch_row();
Note:
See TracChangeset
for help on using the changeset viewer.