Dynamic Database in 4gl?
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Is it possible to change the databse in 4gl based on a passed parameter? The problem I'm running into is that I have "LIKE systables." DEFINES in my code and they are cuasing errors because I have no *explicit* DATABASE statement. Thanks :) Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.
strangiato@my-deja.com wrote: > Is it possible to change the databse in 4gl based on a passed parameter? > > The problem I'm running into is that I have "LIKE systables." DEFINES > in my code and they are cuasing errors because I have no *explicit* > DATABASE statement. You have to specify a database against which the code can be compiled if (and only if) you use the LIKE notation to define variables in the module. You can either arrange for the MAIN program to be: MAIN DEFER INTERRUPT DEFER QUIT CALL select_database() CALL main_program() END MAIN Where what you've currently called MAIN is renamed to FUNCTION main_program(), or you can accept the overhead of the application openeing the compilation database by default and then closing it and opening the real database at runtime. I'd use the specialized MAIN program I showed., -- Yours, Jonathan Leffler (jleffler@informix.com) #include Guardian of DBD::Informix v0.60 (v0.61_02) -- http://www.perl.com/CPAN Informix IDN for D4GL & Linux -- http://www.informix.com/idn
The only way you can do it with LIKE Defines is like so:: DATABASE abc DEFINE LIKE statement for table which exists in abc just to get definition set up. DEFINE new_db CHAR(50) MAIN new_db = arg_val(1) DATABASE new_db ... do the bizz ... END MAIN <strangiato@my-deja.com> wrote in message news:7mnq24$lg8$1@nnrp1.deja.com... > Is it possible to change the databse in 4gl based on a passed parameter? > > The problem I'm running into is that I have "LIKE systables." DEFINES > in my code and they are cuasing errors because I have no *explicit* > DATABASE statement. > > Thanks :) > > > Sent via Deja.com http://www.deja.com/ > Share what you know. Learn what you don't.