home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!emory!hermes1.sps.mot.com
- From: baskett@hermes1.sps.mot.com (Bob Baskett)
- Newsgroups: comp.databases.informix
- Subject: db names
- Message-ID: <9525@emory.mathcs.emory.edu>
- Date: 13 Sep 92 18:08:07 GMT
- Sender: walt@mathcs.emory.edu
- Reply-To: baskett@hermes1.sps.mot.com (Bob Baskett)
- Lines: 74
- X-Informix-List-ID: <list.1442>
-
-
- here is a program that should dump the database names for an online instance:
- -----------------------------------------------------------------------------
-
- /*
- ===============================================================================
- program : dbnames.ec
- compile : esql -o dbnames dbnames.ec
- short description :
- list all available database names in an online system
- long description :
- program created (by Informix) for a customer to get all the
- database names, makes unsupported library calls, use at your own risk
- notes : modified printf so that it pipe delimits the output so it
- can be loaded into a db table
- ===============================================================================
- */
-
- #include <sqlhdr.h>
- #include <sqlca.h>
- #include <stdio.h>
-
- #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("%s~\n",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));
- }
-
- ------------------------------------------------------------------------------
-
- like it says, it makes unsupported calls - use at own risk, may not work with
- all version or upgrades.
-
- ------------------------------------------------------------------------------
- Bob Baskett
- Motorola, Inc
-
-