Automatically generated rules

By default, the factory default mapping_rules setting contains an INCLUDE_AUTO_RULES directive. This directive includes automatically generated mapping rules from active type definitions for the type of client that is currently running.

For example, you can define an msword type with two patterns that match .doc and .dot suffixes on a Windows client. On a Windows client, the auto-generated rules include the following two rules at the point where the INCLUDE_AUTO_RULES directives are specified:

WHEN %name =~ '.*\\.[Dd][Oo][Cc]$' SET type TO 'msword'

WHEN %name =~ '.*\\.[Dd][Oo][Tt]$' SET type TO 'msword'

The benefit of using automatically generated rules is that the type-based rules are defined on the corresponding type definition. Moreover, if the type definition is exported from one database and imported to another, so are the corresponding migrate rules. This is especially useful if you are using DCM and replicating type definitions between databases.

The mapping rules setting or file completely controls the ordering of migrate rules. You can remove the INCLUDE_AUTO_RULES directive so that the migrate rules file explicitly defines every rule. You can also move the position of the directive in the file to change the point at which the automatically generated rules are included.

The automatically generated rules are produced using the following process:
  1. Rules from the predefined ascii and binary types are produced first.
  2. Each type that uses ascii or binary as its super type is processed, so that the inheritance tree of types is traversed from top to bottom and left to right. More specific types that are children of some super type generate rules after their parent super type. For example, if the type definition javacc is a subtype of java which is a subtype of ascii, mapping rules for those three types are generated in the order ascii, java, javacc.
  3. Each non-comment entry in the file of the type match list generates a rule of the form:

    WHEN %name =~ regular_expression SET TYPE TO 'type'

  4. Each type that has Ignore set to TRUE generates a rule of the form:

    WHEN %name =~ regular_expression IGNORE

You can view the automatically generated rules that are included by an INCLUDE_AUTO_RULES directive by using the ccm show -mar command.


Feedback