Changeset 19101 for trunk/FACT++/src/root2sql.cc
- Timestamp:
- 07/31/18 12:07:31 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/root2sql.cc
r19089 r19101 61 61 ("max", var<int64_t>(int64_t(0)), "Maximum number of events to process (0: all), mainly for test purpose") 62 62 ("engine", var<string>("InnoDB"), "Database engine to be used when a new table is created") 63 ("duplicate", var<string>(""), "Specifies an assignment_list for an 'ON DUPLICATE KEY UPDATE' expression") 63 64 ; 64 65 … … 114 115 "\n" 115 116 "Sometimes it might also be convenient to skip a leaf. This can be done with " 116 "the --ignore resource. If the given regular expresion yield a match, the "117 "leaf will be ignored. Note that the regular expression work on the raw-name "117 "the --ignore resource. If the given regular expresion yields a match, the " 118 "leaf will be ignored. Note that the regular expression works on the raw-name " 118 119 "of the leaf not the readily mapped SQL column names. Example:\n" 119 120 " --ignore=ThetaSq\\..*\n" … … 144 145 "\n" 145 146 "All columns are created as NOT NULL as default and the table is created as " 146 "MyISAM (default).\n" 147 "InnoDB (default).\n" 148 "\n" 149 "Usually, the INSERT query would fail if the PRIMARY key exists already. " 150 "This can be avoided using the 'ON DUPLICATE KEY' directive. With the " 151 "--duplicate,you can specify what should be updated in case of a duplicate key. " 152 "For detaily, see the MySQL manual.\n" 147 153 "\n" 148 154 "For debugging purpose, or to just create or drop a table, the final insert " … … 291 297 292 298 const string engine = conf.Get<string>("engine"); 299 const string duplicate = conf.Get<string>("duplicate"); 293 300 294 301 const bool print_branches = conf.Get<bool>("print-branches"); … … 550 557 query += " /* "+c->column+" -> "+c->branch+" */"; 551 558 } 552 query += "\n)"; // ON DUPLICATE KEY UPDATE\n";559 query += "\n)"; 553 560 554 561 count ++; 555 562 } 563 564 if (!duplicate.empty()) 565 query += "\nON DUPLICATE KEY UPDATE\n " + duplicate; 556 566 557 567 if (verbose>0) … … 596 606 cout << count << " row(s) inserted.\n\n"; 597 607 cout << "Total execution time: " << Time().UnixTime()-start.UnixTime() << "s\n" << endl; 598 } 608 /* 609 try 610 { 611 const auto resw = 612 connection.query("SHOW WARNINGS").store(); 613 614 if (resw.num_rows()>0) 615 cout << "\nWARNINGS:\n\n"; 616 617 for (size_t i=0; i<resw.num_rows(); i++) 618 { 619 const mysqlpp::Row &roww = resw[i]; 620 621 cout << roww["Level"] << '[' << roww["Code"] << "]: "; 622 cout << roww["Message"] << '\n' << endl; 623 } 624 625 } 626 catch (const exception &e) 627 { 628 cerr << "\nSHOW WARNINGS\n\n"; 629 cerr << "SQL query failed:\n" << e.what() << endl; 630 return 6; 631 }*/ 632 } 633 599 634 600 635 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.