Re: Online database_names list
Posted in 1993
Madi <gtm@mallard.uucp> writes: > I need some help regarding getting a list of available database name in an > Online environment. ... stuff deleted > Is there a way I can get the database names without going thru' all these > difficulties in an Online environment. > (I found a object file in lib/libfesql.a named iqgetdbs.o. Does this function > gets the database names?) > Thanks in advance. The following program dbnames was posted to the list some time ago, so I think it's ok to repost. ---CUT HERE--- : "@(#)shar.sh 1.8" #! /bin/sh # # This is a shell archive. # Remove everything above this line and run sh on the resulting file. # If this archive is complete, you will see this message at the end: # "All files extracted" # # Created: Wed Jul 29 22:23:04 GMT 1992 by johnl at Informix Software Ltd. # Files archived in this archive: # dbnames.ec # #-------------------- if [ -f dbnames.ec -a "$1" != "-c" ] then echo shar: dbnames.ec already exists else echo 'x - dbnames.ec (1625 characters)' sed -e 's/^X//' >dbnames.ec <<'SHAR-EOF' X/* X@(#)File: dbnames.ec X@(#)Version: 1.1 X@(#)Last changed: 91/03/14 X@(#)Purpose: Print list of visible databases X@(#)Author: John Cooke/Mark Jeske/Jonathan Leffler X*/ X X/* X********************************************************** X** This code is derived from two almost identical ** X** programs with the identifications preserved below: ** X********************************************************** X** dbnames.ec ** X** List all available database names. ** X** Mark J (Informix) 3-13-91 ** X********************************************************** X** From: johnc@obelix (John Cooke) ** X** Quite a coincidence .... I wrote THIS program: ** X** program to get the names of all visible databases ** X********************************************************** X** Compile using: ** X** esql -o dbnames dbnames.ec $INFORMIXDIR/lib/librds.a ** X********************************************************** X*/ X X#ifndef lint Xstatic char sccs[] = "@(#)dbnames.ec 1.1 91/03/14"; X#endif X X#include <stdio.h> X X#define MAXDBS 100 X#define FASIZ (MAXDBS * 19) X Xmain() X{ X int ndbs; X int sqlcode; X int i; X char *dbsname[MAXDBS + 1]; X char dbsarea[FASIZ]; X X if ((sqlcode = sqgetdbs(&ndbs, dbsname, MAXDBS, dbsarea, FASIZ)) != 0) X fprintf(stderr, "error code %d from sqgetdbs\\n", sqlcode); X else X { X for (i = 0; i < ndbs; ++i) X printf("%d %s\\n", i, dbsname[i]); X } X X return (0); X} SHAR-EOF chmod 444 dbnames.ec if [ `wc -c <dbnames.ec` -ne 1625 ] then echo shar: dbnames.ec unpacked with wrong size fi # end of overwriting check fi echo All files extracted exit 0 ---CUT HERE--- -- ----\\ Pro Informatic Aps. Niels Berner <berner@proinf.dk> | O | Jagtvej 111A, DK-2200 Copenhagen N. Denmark +-|-/ Phone: +45 35 82 36 36 Fax: +45 35 82 36 37 | | #include <disclaimer.h>