PROGRAM GenerateModules; {-- *************************************************************************** -- ** Descr. : Batch compiles all selected modules and reports any compile -- ** errors. -- ** -- ** MINVERS: requires FormsAPI Master 1.0 Build 228 and up -- *************************************************************************** -- ** 29/12/01 1.001.00 Initial Creation, muellers@orcl-toolbox.com -- ** 08/04/05 1.002.00 Added support for Oracle Reports modules -- ***************************************************************************} {*Global Variable Declaration*} VAR v_filename : varchar2; j : number; frm : number; files : TStringList; files_unsort : TStringList; ps : TParamScreen; pb : TParamBoard; {*Main Program Block*} BEGIN //build together a nice parameter screen ... ps := TParamScreen.create; pb := ps.AddBoard('Modules',picModules); pb.addparam(parLabel,'MYLABEL','Script to batch compile selected modules and report any errors','',''); pb.addparam(parFiles,'SRC','Source Files','','Oracle Source Modules (*.fmb;*.mmb;*.pll;*.rdf)|*.fmb;*.mmb;*.pll;*.rdf|'+ 'Forms Modules (*.fmb)|*.fmb|'+ 'Menu Modules (*.mmb)|*.mmb|'+ 'Reports Modules (*.rdf)|*.rdf|'+ 'Library Modules (*.pll)|*.pll'); pb.addparam(parDatabaseLogon,'MYDB','Database','scott/tiger',''); //show the parameter screen and wait for inputs if ps.ShowParamScreen('Generate Modules ...') then begin //connect to the database ... api_connect(ps.Paramvalue('MYDB')); //sort the selected modules, first pll's then mmb's and at the end fmb's //if we don't do this we might run into compilation problems! files := tstringlist.create; files_unsort := tstringlist.create; files_unsort.text := ps.ParamValue('SRC'); //first get the pll's for j := 0 to files_unsort.count-1 do if upper(ExtractFileExt(files_unsort.strings[j]))='.PLL' then files.add(files_unsort.strings[j]); //... now get the mmb's for j := 0 to files_unsort.count-1 do if upper(ExtractFileExt(files_unsort.strings[j]))='.MMB' then files.add(files_unsort.strings[j]); //... and the fmb's for j := 0 to files_unsort.count-1 do if upper(ExtractFileExt(files_unsort.strings[j]))='.FMB' then files.add(files_unsort.strings[j]); //... and at last the rdf's for j := 0 to files_unsort.count-1 do if upper(ExtractFileExt(files_unsort.strings[j]))='.RDF' then files.add(files_unsort.strings[j]); //free the old unsorted module list from memory, we don't need this anymore! files_unsort.free; //now loop through the sorted filelist and try to compile the modules for j := 0 to files.count-1 do begin v_filename := files.strings[j]; logadd('Changing '+to_char(j+1)+'/'+to_char(files.count)+' '+v_filename); try if upper(extractfileext(v_filename))='.RDF' then begin if RepAPI_GenerateModule(v_filename) = false then begin logadd(' => compilation failed!',LogError); end; end else begin //load the formsmodule frm := API_LoadModule(v_filename); if api_generatemodule(frm) = false then begin logadd(' => compilation failed!',LogError); end; //now release the module from memory API_FreeModule(frm); end; except // ups! an error happened, so just log it and proceed to the next module logadd(' =>'+GetError,LogError); end; end; end else begin //user must have pressed cancel on parameterscreen logadd('Canceled on parameterscreen!'); end; // free the parameter screen ps.free; END.