Database Solutions - Hints & Tips

Tip 29:
Wildcards in Assignment Files

The use of wildcards in assignment files is well documented in the UNIFACE reference manual. There are, however, a few additional uses for wildcards which may not be familiar.

Using wildcards to allow logical entity groupings within the same environment

Assume two developers are working within the same physical database, but wish to use their own test data. Using wildcards, this can be achieved as follows;

In developer one’s assignment file, the entities section redirects all entities from application models beginning "TEST" to database entities beginning with "PS".

[ENTITIES]
*.TEST* = $DEF:PS_*.*

Similarly, in developer two’s assignment file;

[ENTITIES]
*.TEST* = $DEF:SW_*.*

This allows both developers to use the same environment and physical data model structure but allows them to create their own test data. For example, an entity "CUSTOMER" for developer one would be redirected to an entity "PS_CUSTOMER".

Using wildcards to cater for explicit paths

In assignment files, entries such as

*.exp ..\Imp_Exp\*.exp

are used so that if someone types in the name of an export file, UNIFACE knows where to find it.

This all works well until someone uses the browse button next to the filename to specify a full path. Unfortunately, UNIFACE will use the full path to match the asterisk wildcard in the example above, and so a filename such as

c:\uniface\export\test.exp

will be resolved as

..\Imp_Exp\c:\uniface\export\test.exp

This consequently produces an error.

However if the assignment file is changed to

*\*.exp *\*.exp
*.exp ..\Imp_Exp\*.exp

the path name is correctly resolved, allowing the developer to place the file anywhere they choose using the browse button, or direct it to the default location just be specifying a name.

Additional notes on wildcard behaviour

On the whole, the behaviour of the two wildcard characters ("*" and "?") can be easily predicted, however the following should be noted;

Assignments such as

Bob* = Bobs* and Bob* = Bobs?

both give the same result, so a profile of "Bobtest" would result in "Bobstest" in both cases.

An assignment such as

*_*f* = *.f*

would result in the second wildcard character of the profile being ignored, so "bob_1.frm" would be mapped to "bob.frm".

A sequence of wildcards in a profile is replaced by a single wildcard in the target. For example,

*.f?? = c:\temp\*.e*

would result in "bob.frm" being mapped to "c:\temp\bob.erm"

compuware_01.gif (3977 bytes)


Copyright ©2000 OCS Consulting plc

dbs_block_logo.gif (2150 bytes)
Refresh Frames