Writer Mode Specification

The Access writer allows the user to specify a writer mode, which determines what database command should be issued for each feature received. Valid writer modes are INSERT, UPDATE, and DELETE.

Writer Modes

In INSERT mode, the attribute values of each received feature are written as a new database record.

In UPDATE mode, the attribute values of each received feature are used to update existing records in the database. The records which are updated are determined via the mdb_update_key_columnsDEF line parameter, or via the fme_where attribute on the feature.

In DELETE mode, existing database records are deleted according to the information specified in the received feature. Records are selected for deletion using the same technique as records are selected for updating in UPDATE mode.

Writer Mode Constraints

In UPDATE and DELETE mode, the fme_where attribute always takes precedence over the mdb_update_key_columns DEF line parameter. If both the fme_where attribute and the mdb_update_key_columns DEF line parameter are not present, then UPDATE or DELETE mode will generate an error.

When the fme_where attribute is present, it is used verbatim as the WHERE clause on the generated UPDATE or DELETE command. For example, if fme_where were set to ‘id<5’, then all database records with field ID less than 5 will be affected by the command.

When the fme_where attribute is not present, the writer looks for the mdb_update_key_columns DEF line parameter and uses it to determine which records should be affected by the command. Please refer to DEF for more information about the mdb_update_key_columns DEF line parameter.

Writer Mode Selection

The writer mode can be specified at three unique levels. It may be specified on the writer level, on the feature type or on individual features.

At the writer level, the writer mode is specified by the WRITER_MODE directive. This directive can be superseded by the feature type writer mode specification. For more information on this directive, see the chapter Database Writer Mode.

At the feature type level, the writer mode is specified by the mdb_writer_mode DEF line parameter. This parameters supersedes the WRITER_MODE directive. Unless this parameter is set to INSERT, it may be superseded on individual features by the fme_db_operation attribute. Please refer to the DEF line documentation for more information about this parameter.

At the feature level, the writer mode is specified by the fme_db_operation attribute. Unless the parameter at the feature type level is set to INSERT, the writer mode specified by this attribute always supersedes all other values. Accepted values for the fme_db_operation attribute are INSERT, UPDATE, or DELETE.