Changes between Version 13 and Version 14 of DatabaseBasedAnalysis/table2sql


Ignore:
Timestamp:
08/14/18 22:21:48 (6 years ago)
Author:
tbretz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DatabaseBasedAnalysis/table2sql

    v13 v14  
    147147Sometimes it might be necessary to insert a constant value for each file which is processed (for example a file ID which is not part of the stored data). This can be achieved by the `--fixed.COLUMN=VALUE` directive where '''COLUMN''' the column name and '''VALUE''' is the value filled into the column. As default, the column is create as '''INT UNSIGNED''' but this can be overwritten as usual with the `--sql-type` directive.
    148148
    149 A special case is when '''VALUE''' has the form `/regex/[N]/`. In this case the given regular expressen is searched with boost::regex_search in the given filename. If '''N''' is specified it is the number of the subsequent match. For example, if
    150 {{{
    151 --const.mycolumn=/_([0-9]+)_/1/
    152 }}}
    153 would be matched with ''file_12345_name.ext'', the first sub-sequence (0) would be '_12345_' and the second sub-sequence (1) would be '12345'. Therefore, '12345' would be inserted. Because it is not always apparent which sub-sequence gets which number, a verbosity level of 3 can be used to print the match result.
     149A special case is when '''VALUE''' has the form `/regex/[format]/`. In this case the filename is replaced given the regular expressen by the format using boost::regex_replace. Replacement uses the standard formatting rules to replace matches (those used by ECMAScript's replace method). If the format is omitted, the default is `$0` which corresponds to just taking the match. For example, if
     150{{{
     151--const.mycolumn=/_([0-9]+)_/$1/
     152}}}
     153would be match the _1234_ in the filename ''file_12345_name.ext''. It would be replaced by the first sub-sequence (%1) which is '12345'. ($0 is the whole match ''_12345_'').
    154154
    155155== Conditional execution ==