Changeset 19986 for trunk/FACT++/src


Ignore:
Timestamp:
08/17/20 13:37:22 (4 years ago)
Author:
tbretz
Message:
The selector for the data is required as there is always an AND in the query, in both selectors, the conditions are concatenated by a logical AND and therefore need parenthesis.
File:
1 edited

Legend:

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

    r19985 r19986  
    153153        ("analysis",    var<string>("analysis.sql"),   "File with the analysis query. A default file is created automatically in the <prefix> directory it does not exist.")
    154154        ("source-key", var<uint16_t>(5),          "Source key to be used in data file selection.")
    155         ("selector",   vars<string>(),            "WHERE clause to be used in data file selection.")
     155        ("selector",   vars<string>()->required(),"WHERE clause to be used in data file selection.")
    156156        ("selsim",     vars<string>(),            "WHERE clause to be used in monte carlo file selection.")
    157157        ("estimator",  var<string>()->required(), "Energy estimator to be used.")
     
    648648
    649649    const uint16_t source_key = conf.Get<uint16_t>("source-key");
    650     const string   where      = boost::join(conf.Vec<string>("selector"), " AND\n      ");
    651     const string   where_sim  = boost::join(conf.Vec<string>("selsim"), " AND\n      ");
     650    const string   where      = boost::join(conf.Vec<string>("selector"), ") AND\n      (");
     651    const string   where_sim  = boost::join(conf.Vec<string>("selsim"),   ") AND\n      (");
    652652    const string   estimator  = conf.Get<string>("estimator");
    653653    const string   spectrum   = conf.Get<string>("spectrum");
     
    787787        "   WHERE\n"
    788788        "      fRunTypeKEY=1 AND fSourceKEY=%100:source AND\n"
    789         "      %101:where\n"
     789        "      (%101:where)\n"
    790790        "   ORDER BY\n"
    791791        "      FileId\n"  // In order: faster
     
    906906    //    query3.template_defaults[it->first.c_str()] = it->second.c_str();
    907907
    908     query3.template_defaults["where"] = where_sim.empty()? "" : ("AND\n      "+where_sim).c_str();
     908    query3.template_defaults["where"] = where_sim.empty()? "" : ("AND\n      ("+where_sim+")").c_str();
    909909
    910910    if (print_queries)
Note: See TracChangeset for help on using the changeset viewer.