Changes between Version 15 and Version 16 of DatabaseBasedAnalysis/table2sql


Ignore:
Timestamp:
08/15/18 09:32:56 (6 years ago)
Author:
tbretz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DatabaseBasedAnalysis/table2sql

    v15 v16  
    129129Note that the combination of these columns must be unique.
    130130
    131 == Ignore duplicate entries ==
     131== Duplicate Entries ==
     132
     133=== Ignore ===
    132134
    133135Usually, the `INSERT` query would fail if another row with the same primary key exists already.  This can be avoided adding the `IGNORE` keyword to the `INSERT` query by `--ignore-errors`, which essentially ignores all errors and turns them into warnings which are printed after the query succeede.
    134136
    135 == Update duplicate entries ==
     137=== Update ===
    136138
    137139Another option is to update duplicate entries. This can be done using the `ON DUPLICATE KEY UPDATE` directive. Giving `-duplicate`, you can specify what should be updated in case of a duplicate key. To keep the row untouched, you can just update the primary key with the identical primary key, e.g.
     
    143145The `--duplicate` resource can be specified more than once to add more expressions to the assignment_list. For more details, see the MySQL manual.
    144146
    145 == Insert constant values ==
     147== Constant value columns ==
     148=== Add a constant value ===
    146149
    147150Sometimes 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.
     
    153156would 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_'').
    154157
    155 == Conditional execution ==
     158=== Conditional execution ===
    156159
    157160Based on the constant values, conditional execution can be enable with `--conditional`. After dropping/creating the table, it is checked by a `SELECT` query whether at least one entry which fits the constant value columns exists. If at least one exists, further execution is stopped.
    158161
    159 == Pre-deleting entries ==
     162=== Pre-deleting entries ===
    160163
    161164Usually the previously defined constant values are helpful to create an index which relates unambiguously the inserted data to the file. It might be useful to delete all data which belongs to this particular file before new data is entered. This can be achieved with the `--delete` directive. It deletes all data from the table before inserting new data which fulfills the condition defined by the `--const` directives.
    162165
    163 == Corresponding Index ==
     166=== Corresponding Index ===
    164167
    165168To do the pre-deleting efficiently, it makes sense to have an INDEX created for a fast access. This can be achieved with the `--index` directive which adds the corresponding statement to the table creation (`CREATE TABLE`)