Changeset 20056
- Timestamp:
- 04/12/21 09:15:58 (4 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/root2sql.cc
r19968 r20056 532 532 } 533 533 534 Database connection(uri );534 Database connection(uri, print_connection); 535 535 536 536 if (verbose>0) -
trunk/FACT++/src/rootifysql.cc
r20011 r20056 25 25 control.add_options() 26 26 ("uri,u", var<string>()->required(), "Database link as in\n\tuser:password@server[:port]/database[?compress=0|1].") 27 ("query,q", var<string>(""), "MySQL query (overwrites --file )")27 ("query,q", var<string>(""), "MySQL query (overwrites --file, used as table name if without spaces)") 28 28 ("file", var<string>("rootify.sql"), "An ASCII file with the MySQL query (overwrites --query)") 29 29 ("ignore-null,i", po_switch(), "Do not skip rows containing any NULL field") … … 95 95 "\n" 96 96 "The default is to read the query from a file called rootify.sql. Except if a different " 97 "filename is specified by the --file option or a query is given with --query.\n" 97 "filename is specified by the --file option or a query is given with --query. " 98 "A special case is if the 'query' does not contain any whitespace. Then the " 99 "query is considered as a table name and the query 'SELECT * FROM table' is " 100 "executed.\n" 98 101 "\n" 99 102 "As a trick, the rootify.sql file can be made excutable (chmod u+x rootify.sql). " … … 469 472 void Convert(FileEntry::Container &container, const mysqlpp::String &col) 470 473 { 471 *reinterpret_cast<T*>(container.ptr) = static_cast<T>(col);474 *reinterpret_cast<T*>(container.ptr) = col.is_null() ? T(0) : static_cast<T>(col); 472 475 } 473 476 … … 534 537 535 538 string query = conf.Get<string>("query"); 539 if (!query.empty() && query.find_first_of(' ')==string::npos) 540 query.insert(0, "SELECT * FROM "); 541 536 542 if (query.empty()) 537 543 { … … 635 641 } 636 642 637 Database connection(uri ); // Keep alive while fetching rows643 Database connection(uri, print_connection); // Keep alive while fetching rows 638 644 639 645 if (verbose>0)
Note:
See TracChangeset
for help on using the changeset viewer.