Changeset 7134


Ignore:
Timestamp:
Apr 21, 2016, 2:21:55 PM (7 years ago)
Author:
Nicklas Nordborg
Message:

References #2000: Batch API for annotation handling

Fixes a major bug where the annotation batcher executed the SQL for INSERT before DELETE causing newly inserted annotation values to be deleted immediately. This affected the case when updating an existing annotation since this is the only case where both the delete and insert statements are used.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/AnnotationBatcher.java

    r7133 r7134  
    284284        String valuesTableName = t.getTableName();
    285285
     286        // IMPORTANT! The DELETE must be before the INSERT or the
     287        // batecher will insert new values before deleting old (and also delete the new)
     288        this.deleteValues[t.ordinal()] = createUpdateBatcher(c,
     289          PredefinedQuery.getQueryString("AB_DELETE_FROM_VALUES", valuesTableName),
     290          Types.INTEGER /* ParameterValue.id */
     291          );
     292       
    286293        this.insertValues[t.ordinal()] = createUpdateBatcher(c,
    287294          PredefinedQuery.getQueryString("AB_INSERT_INTO_VALUES", valuesTableName),
    288295          Types.INTEGER, /* ParameterValue.id */
    289296          t.getSQLType() /* value */
    290           );
    291 
    292         this.deleteValues[t.ordinal()] = createUpdateBatcher(c,
    293           PredefinedQuery.getQueryString("AB_DELETE_FROM_VALUES", valuesTableName),
    294           Types.INTEGER /* ParameterValue.id */
    295297          );
    296298      }
Note: See TracChangeset for help on using the changeset viewer.