Consultor Eletrônico



Kbase 15819: Determining Database / Dataserver Type at Compile time
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/10/1998
Determining Database / Dataserver Type at Compile time


User who want to have one set of Progress source code to run against
a Progress Database or a Foreign database like Oracle, Sybase, C-ISAM
etc may find the ability to determine the Database/Dataserver type
at compile time very useful. This leads to conditional compilation of
source based on dataserver type.

Since there's no way to check automatically at compile-time the type
of a connected database (the DBTYPE function is not enabled within pre
processor expressions). You can do it programmatically though. Below
is a simple example:

header.i
&SCOPED-DEFINE Dataserver-Type Oracle

program.p
{header.i}
&IF (&Dataserver-Type) = "Oracle" &THEN
/* use oracle code */
&ELSE
/* use other code */
&ENDIF


/* This sample program will work with a Progress and Oracle database*/

{header.i}

FOR EACH customer WHERE address
&IF (&Dataserver-Type) = "Oracle" &THEN
Matches "*Main St*": /* this works for Oracle */
&ELSE
CONTAINS "main st*": /* Contains does not work in Oracle cause */
&ENDIF /* it does not support word indexex */

Progress Software Technical Support Note # 15819