Changeset 19114
- Timestamp:
- 07/31/18 21:07:26 (6 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fits2sql.cc
r19109 r19114 63 63 ("engine", var<string>(""), "Database engine to be used when a new table is created") 64 64 ("row-format", var<string>(""), "Defines the ROW_FORMAT keyword for table creation") 65 ("duplicate", var <string>(""),"Specifies an assignment_list for an 'ON DUPLICATE KEY UPDATE' expression")65 ("duplicate", vars<string>(""), "Specifies an assignment_list for an 'ON DUPLICATE KEY UPDATE' expression") 66 66 ("ignore-errors", po_switch(), "Adds the IGNORE keyword to the INSERT query (turns errors into warnings, ignores rows with errors)") 67 67 ; … … 148 148 "Usually, the INSERT query would fail if the PRIMARY key exists already. " 149 149 "This can be avoided using the 'ON DUPLICATE KEY' directive. With the " 150 "--duplicate, you can specify what should be updated in case of a duplicate key. "150 "--duplicate, you can specify what should be updated in case of a duplicate key. " 151 151 "To keep the row untouched, you can just update the primary key " 152 152 "with the identical primary key, e.g. --duplicate='MyPrimary=VALUES(MyPrimary)'. " … … 296 296 const string engine = conf.Get<string>("engine"); 297 297 const string row_format = conf.Get<string>("row-format"); 298 const string duplicate = conf.Get<string>("duplicate");299 298 300 299 const bool ignore_errors = conf.Get<bool>("ignore-errors"); … … 310 309 const vector<string> primary = conf.Vec<string>("primary"); 311 310 311 const vactor<string> duplicate = conf.Vec<string>("duplicate"); 312 312 const vector<string> notsigned = conf.Vec<string>("unsigned"); 313 313 … … 599 599 600 600 if (!duplicate.empty()) 601 query += "\nON DUPLICATE KEY UPDATE\n " + duplicate;601 query += "\nON DUPLICATE KEY UPDATE\n " + boost::join(duplicate, ",\n "); 602 602 603 603 if (verbose>0) -
trunk/FACT++/src/root2sql.cc
r19110 r19114 66 66 ("engine", var<string>(""), "Database engine to be used when a new table is created") 67 67 ("row-format", var<string>(""), "Defines the ROW_FORMAT keyword for table creation") 68 ("duplicate", var <string>(""),"Specifies an assignment_list for an 'ON DUPLICATE KEY UPDATE' expression")68 ("duplicate", vars<string>(""), "Specifies an assignment_list for an 'ON DUPLICATE KEY UPDATE' expression") 69 69 ("ignore-errors", po_switch(), "Adds the IGNORE keyword to the INSERT query (turns errors into warnings, ignores rows with errors)") 70 70 ; … … 310 310 const string engine = conf.Get<string>("engine"); 311 311 const string row_format = conf.Get<string>("row-format"); 312 const string duplicate = conf.Get<string>("duplicate"); 312 313 const vector<string> duplicate = conf.Vec<string>("duplicate"); 313 314 314 315 const bool ignore_errors = conf.Get<bool>("ignore-errors"); … … 586 587 587 588 if (!duplicate.empty()) 588 query += "\nON DUPLICATE KEY UPDATE\n " + duplicate;589 query += "\nON DUPLICATE KEY UPDATE\n " + boost::join(duplicate, ",\n "); 589 590 590 591 if (verbose>0)
Note:
See TracChangeset
for help on using the changeset viewer.