- Timestamp:
- 07/24/18 10:33:45 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/rootifysql.cc
r19075 r19079 36 36 ("no-fill", po_switch(), "Do not fill events into the root file (mainly for debugging purposes, e.g. performance studies)") 37 37 ("delimiter", var<string>(""), "The delimiter used if contents are displayed with --display (default=\\t)") 38 ("var.*", var<string>(), "Predefined user variables") 38 ("var.*", var<string>(), "Predefined SQL user variables (@VAR)") 39 ("env.*", vars<string>(), "Predefined environment for substitutions in the query ($ENV)") 39 40 ("verbose,v", var<uint16_t>(1), "Verbosity (0: quiet, 1: default, 2: more, 3, ...)") 40 41 ; … … 80 81 "You can use variables in your sql query like @MyVar and define them on the " 81 82 "command line. In this example with --var.MyVar=5\n" 83 "\n" 84 "You can use environment definitions for substitutions in your SQL query. " 85 "For example --env.TEST=5 would replace $TEST or ${TEST} in your query by 5." 86 "If you specifiy one environmentvariable more than once, a list is created. " 87 "For example --env.TEST=1 --env.TEST=2 --env.TEST=3 would substitute " 88 "$TEST or ${TEST} by '1, 2, 3'. This is useful for the SQL `IN` keyword.\n" 82 89 "\n" 83 90 "Comments in the query-file can be placed according to the SQL standard inline " … … 121 128 const vector<string> _ignore = conf.Vec<string>("ignore"); 122 129 //const vector<Map> mymap = conf.Vec<Map>("map"); 130 123 131 // ------------------------------------------------------------------------- 124 132 … … 129 137 variables.emplace_back('@'+var.substr(4)+":="+Tools::Trim(conf.Get<string>(var))); 130 138 139 // ------------------------------------------------------------------------- 140 131 141 if (verbose>0) 132 142 cout << "\n--------------------- Rootify SQL ----------------------" << endl; … … 151 161 cerr << "No query specified." << endl; 152 162 return 2; 163 } 164 165 // ------------------------------------------------------------------------- 166 167 const auto envs = conf.GetWildcardOptions("env.*"); 168 169 for (const auto &env : envs) 170 { 171 regex r1("\\$\\{"+env.substr(4)+"\\}"); 172 regex r2("\\$"+env.substr(4)+"\\b"); 173 174 const string repl = boost::join(conf.Vec<string>(env), ", "); 175 176 query = regex_replace(query, r1, repl); 177 query = regex_replace(query, r2, repl); 153 178 } 154 179
Note:
See TracChangeset
for help on using the changeset viewer.