Re: How do you choose database at RUNTIME in r4gl?
Posted in 1994
> SCENERIO: > We have two systems, production and development. > ISTAR is installed on both systems so we can perform remote queries. > > We have scores of 4gl reports that share a common 4gl GLOBAL header file. > When we wish to access data that is on production, we change the > statement database lotsadata > to > database lotsadata@production > > and recompile the program. When we run the program on development, we > willget production data. ... Some text removed ... > > Is there a way that we can specify the database name at run time, instead > of compile time? Maybe make r4gl look at the contents of a UN > environmental variable, DBNAME? > > I have done some playing around and haven't found a nice solution. > If you put the "database" statement in the MAIN block, you can change > databases in the program, but I don't want to do this to 200 programs. I > would rather find a way to put the database selection in the shar > GLOBAL header... The environment variable approach is I believe the only one open to you. However, you will have to have a static database statement in the globals section to get it to compile; then override this at run time by having a second database statement before you query anything. I'd suggest that the static one points to the production d/b, just in case you ever run the progs without access to the development d/b. akent@cix.compulink.co.uk (Andy Kent) -------------------------------------