home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / database / informix / 1633 < prev    next >
Encoding:
Internet Message Format  |  1992-07-30  |  2.0 KB

  1. Path: sparky!uunet!europa.asd.contel.com!emory!uunet.UU.NET
  2. From: carsmax!carshp.!ken@uunet.UU.NET (Ken Evilsizor)
  3. Newsgroups: comp.databases.informix
  4. Subject: Re: Way to get list of databases ?
  5. Message-ID: <9245@emory.mathcs.emory.edu>
  6. Date: 30 Jul 92 13:53:13 GMT
  7. Sender: walt@mathcs.emory.edu
  8. Reply-To: carsmax!carshp.!ken@uunet.UU.NET (Ken Evilsizor)
  9. Lines: 47
  10. X-Informix-List-ID: <list.1347>
  11.  
  12. Tony Heskett writes:
  13. } Jeff White writes:
  14. } }   Does someone know of a way (easy or not, but needs to be executeable
  15. } } from command line, not interactive) to return a list of all the available
  16. } } databases?  
  17. } Well, someone does.   From Ken Evilsizor a little while ago:
  18. } ...
  19. } I get the feeling that this *hasn't* been posted, but that you'd get
  20. } a fair way by playing with sqgetdbs().   Otherwise, mail him & grovel ;-)
  21.  
  22. I didn't ever post it since there was a copyright message at the top of the
  23. page I had.  The information was posted in X-Informix-List-Id: <list.1287>
  24. by Steven J. Richardson.  Here it is:
  25.  
  26. }   Recently, I referred to a function which tells one the names of the
  27. } databases of which an Informix engine knows; that function is "sqgetdbs()"
  28. } and its use is illustrated below.
  29. } #define MAXDBNAMES 64
  30. } #define AREA_SIZE 128
  31. } main()
  32. } {
  33. }        int ndb, sqlcode, i;
  34. }        char *fnames[MAXDBNAMES], area[AREA_SIZE];
  35. }        if (sqlcode = sqgetdbs(&ndb, fnames, MAXDBNAMES, area, AREA_SIZE))
  36. }                printf("sqgetdbs() returned %d\n", sqlcode);
  37. }        else
  38. }        {
  39. }                printf("%d databases\n", ndb);
  40. }                for (i = 0; i < ndb; i++)
  41. }                        printf("%s\n", fnames[i]);
  42. }        }
  43. }        exit(sqlcode);
  44. } }
  45. } Steven J. Richardson/Merit Network, Inc.
  46.  
  47. ---------------------------------------------------------------------------
  48. Ken Evilsizor             Email: uunet!uceng!cinnet!carsinfo!ken
  49. CARS Information Systems
  50. 4000 Executive Park Dr.        Disclaimer: All opinions expressed are
  51. Cincinnati, OH 45241            definitely my own.
  52.