Re: Way to get list of databases ?
Posted in 1992
Tony Heskett writes: } Jeff White writes: } } } Does someone know of a way (easy or not, but needs to be executeable } } from command line, not interactive) to return a list of all the available } } databases? } } Well, someone does. From Ken Evilsizor a little while ago: } ... } I get the feeling that this *hasn't* been posted, but that you'd get } a fair way by playing with sqgetdbs(). Otherwise, mail him & grovel ;-) I didn't ever post it since there was a copyright message at the top of the page I had. The information was posted in X-Informix-List-Id: <list.1287> by Steven J. Richardson. Here it is: } Recently, I referred to a function which tells one the names of the } databases of which an Informix engine knows; that function is "sqgetdbs()" } and its use is illustrated below. } } #define MAXDBNAMES 64 } #define AREA_SIZE 128 } } main() } { } int ndb, sqlcode, i; } char *fnames[MAXDBNAMES], area[AREA_SIZE]; } } if (sqlcode = sqgetdbs(&ndb, fnames, MAXDBNAMES, area, AREA_SIZE)) } printf("sqgetdbs() returned %d\\n", sqlcode); } else } { } printf("%d databases\\n", ndb); } for (i = 0; i < ndb; i++) } printf("%s\\n", fnames[i]); } } } exit(sqlcode); } } } } } Steven J. Richardson/Merit Network, Inc. --------------------------------------------------------------------------- Ken Evilsizor Email: uunet!uceng!cinnet!carsinfo!ken CARS Information Systems 4000 Executive Park Dr. Disclaimer: All opinions expressed are Cincinnati, OH 45241 definitely my own.