Consultor Eletrônico



Kbase 16499: Example using CREATE ALIAS to re-use code for 2 databases
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/10/1998
Example using CREATE ALIAS to re-use code for 2 databases

Following is an example of using CREATE ALIAS to use the same code
for two identical databases that are connected at the same time.

Step 1: Create 2 copies of the sports database with different
physical names, for example testdb1 and testdb2.

Step 2: Connect a session to one of them, using the logical
name x:

pro testdb1 -ld x

Step 3: Create the following program and save it as up.p.

/* up.p */

FIND FIRST x.customer.
UPDATE x.customer.name.

Step 4: Compile and save up.p as follows:

COMPILE up.p SAVE.

Step 5. Exit the Progress editor, and start again, connecting
the 2 databases, the first with logical name aaa, and the
second with logical name bbb.

pro testdb1 -ld aaa testdb2 -ld bbb

Step 6. You can now access both databases with the up.p code as
follows:

CREATE ALIAS x FOR DATABASE aaa.
RUN up.p.
DELETE ALIAS x.
CREATE ALIAS x FOR DATABASE bbb.
RUN up.p.


Progress Software Technical Support Note # 16499