Changeset 19112


Ignore:
Timestamp:
07/31/18 20:51:34 (6 years ago)
Author:
tbretz
Message:
Implemented --engine and --row-format.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/calcsource.cc

    r19107 r19112  
    3030        ("table.source",   var<string>("Source"),     "Name of the table where the sources are stored")
    3131        ("table.position", var<string>("Position"),   "Name of the table where the calculated posiiton will be stored")
     32        ("engine",         var<string>(""),           "Database engine to be used when a new table is created")
     33        ("row-format",     var<string>(""),           "Defines the ROW_FORMAT keyword for table creation")
    3234        ("ignore-errors",  po_switch(),               "Adds the IGNORE keyword to the INSERT query (turns errors into warnings, ignores rows with errors)")
    3335        ("force",          po_switch(),               "Force processing even if there is no database connection")
     
    160162    const string   tab_position = conf.Get<string>("table.position");
    161163
     164    const string engine         = conf.Get<string>("engine");
     165    const string row_format     = conf.Get<string>("row-format");
    162166    const bool ignore_errors    = conf.Get<bool>("ignore-errors");
    163167
     
    530534            cout << "Creating table `" << tab_position << "`" << endl;
    531535
    532         const string query2 =
     536        string query2 =
    533537            "CREATE TABLE IF NOT EXISTS `"+tab_position+"`\n"
    534538            "(\n"
     
    539543            "   PRIMARY KEY (FileId, EvtNumber)\n"
    540544            ")\n"
    541             "DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci\n"
    542             "ENGINE=MyISAM\n"
    543             "COMMENT='created by "+conf.GetName()+"'\n";
     545            "DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci\n";
     546        if (!engine.empty())
     547            query2 += "ENGINE="+engine+"\n";
     548        if (!row_format.empty())
     549            query2 += "ROW_FORMAT="+row_format+"\n";
     550        query2 += "COMMENT='created by "+conf.GetName()+"'\n";
    544551
    545552        try
     
    10191026
    10201027*/
    1021 
Note: See TracChangeset for help on using the changeset viewer.