Re: Engine Database List
Posted in 1996
Mark D. Stock (marks@west.co.za) wrote: : Marius Dreyer wrote: : > : > Romulo Albuquerque wrote: : > > : > > Hi All, : > > : > > I'm using Informix Online 5.x. Anyone knows how can I get a list of : > > databases from a .4GL program ? : > > : > > TIA, : > > : > > Romulo Albuquerque : > > : > select from sysdatabases ? : No, that's version 6.x onwards you are thinking of using the SMI database : sysmaster. There is no way before version 6.x. I beg to differ. It is possible. Here's some ESQL/C source code (which can be modified to call from 4GL). I think it only handles local databases, not ones you can reach via the network. I'm currently using this from 5.x engines (don't know how far back you can go with this). #include <stdio.h> $include sqlca; #define MAXDBS 100 #define FASIZ MAXDBS * 19 main() { int fcnt ; char *frmname[MAXDBS+1] ; char farea[FASIZ] ; int i ; sqgetdbs( &fcnt, frmname, MAXDBS, farea, FASIZ ) ; for( i=0; i<fcnt; ++i ) { printf( "%d %s\\n", i, frmname[i] ) ; } } compact(frm, fcnt) char **frm; int fcnt; { register char **to, **from; register char *last = " "; int same; from = to = frm; while (fcnt-- > 0) { same = stcmpr(last, *from); last = *from; if (same != 0) *to++ = *from++; else from++; } return(to-frm); } frmcmpr( n1, n2 ) char **n1, **n2 ; { return( stcmpr( *n1, *n2 ) ) ; } __________________________________________________________________________ Joel Schumacher JCPenney Co. - UNIX Network Systems jschumac@uns-dv1.jcpenney.com 12700 Park Central Pl (972) 591-7543 Dallas TX 75251