Changeset 19126
- Timestamp:
- 08/03/18 13:46:37 (6 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fits2sql.cc
r19125 r19126 72 72 ("dry-run", po_switch(), "Skip any query which changes the databse (might result in consecutive failures)") 73 73 ("print-extensions", po_switch(), "Print extensions (tables) from fits file") 74 ("print-connection", po_switch(), "Print database connection information") 74 75 ("print-columns", po_switch(), "Print columns in fits table") 75 76 ("print-insert", po_switch(), "Print the INSERT query (note that it contains all data)") … … 300 301 const bool ignore_errors = conf.Get<bool>("ignore-errors"); 301 302 303 const bool print_connection = conf.Get<bool>("print-connection"); 302 304 const bool print_extensions = conf.Get<bool>("print-extensions"); 303 305 const bool print_columns = conf.Get<bool>("print-columns"); … … 461 463 Database connection(uri); 462 464 465 if (print_connection) 466 { 467 try 468 { 469 const auto &res1 = connection.query("SHOW STATUS LIKE 'Compression'").store(); 470 cout << "Compression of databse connection is " << string(res1[0][1]) << endl; 471 472 const auto &res2 = connection.query("SHOW STATUS LIKE 'Ssl_cipher'").store(); 473 cout << "Connection to databases is " << (string(res2[0][1]).empty()?"UNENCRYPTED":"ENCRYPTED ("+string(res2[0][1])+")") << endl; 474 } 475 catch (const exception &e) 476 { 477 cerr << "\nSHOW STATUS LIKE COMPRESSION\n\n"; 478 cerr << "SQL query failed:\n" << e.what() << endl; 479 return 6; 480 } 481 } 482 463 483 try 464 484 { -
trunk/FACT++/src/root2sql.cc
r19125 r19126 74 74 ("no-insert", po_switch(), "Does not insert any data into the table") 75 75 ("dry-run", po_switch(), "Skip any query which changes the databse (might result in consecutive failures)") 76 ("print-connection", po_switch(), "Print database connection information") 76 77 ("print-branches", po_switch(), "Print the branches found in the tree") 77 78 ("print-leaves", po_switch(), "Print the leaves found in the tree (this is what is processed)") … … 316 317 const bool ignore_errors = conf.Get<bool>("ignore-errors"); 317 318 319 const bool print_connection = conf.Get<bool>("print-connection"); 318 320 const bool print_branches = conf.Get<bool>("print-branches"); 319 321 const bool print_leaves = conf.Get<bool>("print-leaves"); … … 478 480 cerr << "SQL connection failed: " << e.what() << '\n' << endl; 479 481 return 3; 482 } 483 484 if (print_connection) 485 { 486 try 487 { 488 const auto &res1 = connection.query("SHOW STATUS LIKE 'Compression'").store(); 489 cout << "Compression of databse connection is " << string(res1[0][1]) << endl; 490 491 const auto &res2 = connection.query("SHOW STATUS LIKE 'Ssl_cipher'").store(); 492 cout << "Connection to databases is " << (string(res2[0][1]).empty()?"UNENCRYPTED":"ENCRYPTED ("+string(res2[0][1])+")") << endl; 493 } 494 catch (const exception &e) 495 { 496 cerr << "\nSHOW STATUS LIKE COMPRESSION\n\n"; 497 cerr << "SQL query failed:\n" << e.what() << endl; 498 return 6; 499 } 480 500 } 481 501 -
trunk/FACT++/src/rootifysql.cc
r19121 r19126 24 24 po::options_description control("Rootify SQL"); 25 25 control.add_options() 26 ("uri,u", var<string>()->required(), "Database link as in\n\tuser:password@server[:port]/database .")26 ("uri,u", var<string>()->required(), "Database link as in\n\tuser:password@server[:port]/database[/comp].") 27 27 ("query,q", var<string>(""), "MySQL query (overwrites --file)") 28 28 ("file", var<string>("rootify.sql"), "An ASCII file with the MySQL query (overwrites --query)") … … 44 44 ("env.*", vars<string>(), "Predefined environment for substitutions in the query ($ENV)") 45 45 ("list.*", var<string>(), "Predefined environment for substitutions in the query ($ENV). The list is read from the given file (one list entry per line)") 46 ("print-connection", po_switch(), "Print database connection information") 46 47 ("verbose,v", var<uint16_t>(1), "Verbosity (0: quiet, 1: default, 2: more, 3, ...)") 47 48 ; … … 384 385 const string delimiter = conf.Get<string>("delimiter"); 385 386 const vector<string> _ignore = conf.Vec<string>("ignore"); 387 const bool print_connection = conf.Get<bool>("print-connection"); 386 388 //const vector<Map> mymap = conf.Vec<Map>("map"); 387 389 … … 494 496 495 497 Database connection(uri); // Keep alive while fetching rows 498 499 if (print_connection) 500 { 501 try 502 { 503 const auto &res1 = connection.query("SHOW STATUS LIKE 'Compression'").store(); 504 cout << "Compression of databse connection is " << string(res1[0][1]) << endl; 505 506 const auto &res2 = connection.query("SHOW STATUS LIKE 'Ssl_cipher'").store(); 507 cout << "Connection to databases is " << (string(res2[0][1]).empty()?"UNENCRYPTED":"ENCRYPTED ("+string(res2[0][1])+")") << endl; 508 } 509 catch (const exception &e) 510 { 511 cerr << "\nSHOW STATUS LIKE COMPRESSION\n\n"; 512 cerr << "SQL query failed:\n" << e.what() << endl; 513 return 6; 514 } 515 } 496 516 497 517 try
Note:
See TracChangeset
for help on using the changeset viewer.