Changeset 19110 for trunk


Ignore:
Timestamp:
07/31/18 20:43:59 (6 years ago)
Author:
tbretz
Message:
Implemented row-format and now using the database default engine if not specified.
File:
1 edited

Legend:

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

    r19108 r19110  
    6464        ("first",          var<int64_t>(int64_t(0)),  "First event to start with (default: 0), mainly for test purpose")
    6565        ("max",            var<int64_t>(int64_t(0)),  "Maximum number of events to process (0: all), mainly for test purpose")
    66         ("engine",         var<string>("InnoDB"),     "Database engine to be used when a new table is created")
     66        ("engine",         var<string>(""),           "Database engine to be used when a new table is created")
     67        ("row-format",     var<string>(""),           "Defines the ROW_FORMAT keyword for table creation")
    6768        ("duplicate",      var<string>(""),           "Specifies an assignment_list for an 'ON DUPLICATE KEY UPDATE' expression")
    6869        ("ignore-errors",  po_switch(),               "Adds the IGNORE keyword to the INSERT query (turns errors into warnings, ignores rows with errors)")
     
    149150        "once. Note that the combination of these columns must be unique.\n"
    150151        "\n"
    151         "All columns are created as NOT NULL as default and the table is created as "
    152         "InnoDB (default).\n"
     152        "All columns are created as NOT NULL as default. To force a database engine "
     153        "and/or a storage format, use --engine and --rot-format.\n"
    153154        "\n"
    154155        "Usually, the INSERT query would fail if the PRIMARY key exists already. "
     
    308309
    309310    const string engine          = conf.Get<string>("engine");
     311    const string row_format      = conf.Get<string>("row-format");
    310312    const string duplicate       = conf.Get<string>("duplicate");
    311313
     
    486488    query +=
    487489        ")\n"
    488         "DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci\n"
    489         "ENGINE="+engine+"\n"
    490         "COMMENT='created by "+conf.GetName()+"'\n";
     490        "DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci\n";
     491    if (!engine.empty())
     492        query += "ENGINE="+engine+"\n";
     493    if (!row_format.empty())
     494        query += "ROW_FORMAT="+row_format+"\n";
     495    query += "COMMENT='created by "+conf.GetName()+"'\n";
    491496
    492497    // FIXME: Can we omit the catching to be able to print the
Note: See TracChangeset for help on using the changeset viewer.