Subject Re: [IBO] OnMacroSubstitute: how to use?
Author Helen Borrie
At 10:44 PM 09-10-01 -0700, you wrote:
>I'm trying to execute a IB_script, but use a macro in the CREATE
>DATABASE statement for the file/path name and the password.
>I looked but could not find an example of how to properly impliment
>I assume that I would have something like this in the script:
>create database <filename> user 'SYSDBA' password <mpassword>;
>but what do I do in OnMacroSubstitute? I'm a little confused because its
>listed as an event, but in the help shown as a property. There is no

It's just an event - you can do what you like in response to the call.

You can use it to call a method (or start a chain of method calls) and you can optionally pass a string back containing text to substitute into the script.

An example might be where you want to call a procedure that opens an ini file and reads some value into the place where the macro token is located; or that attaches to an external text file and reads data into some tables.

In app for recreating a database, you might even have a datapump set up, with a macro token to invoke it..

Use the MacroBegin and MacroEnd properties to set the characters that are to be recognised as the tag markers for a macro token.

>Is there sample code to show how to use this?

Look at the (Sys)MacroSubstitute method in IB_RPL_Base.pas to see what the replication module does with it. The replication module makes extensive use of a "macro language" (or parser) to "genericise" some rather complex setup and processing.


All for Open and Open for All
InterBase Developer Initiative ยท