Re: Require DB list from sqlturbo directly, HOW?
Posted in 1994
In article <2m36j9$8u5@worak.kaist.ac.kr>, cdlim@tp22.etri.re.kr (ChaeDeok Lim) writes: |> |> On doing my project, I faced with a problem: How can I get db list |> (DB names) from sqlturbo? I tried to use SQL library, but the key |> functions were hidden in front-end tool(isql) and there were just |> basic functions in libsql4.a and libfesql.a. That's not enough to |> use them for me. I heard that there should be other preliminary |> operations and so on. |> |> Is there anybody who knows how to get db list directly, if not, even |> indirectly? |> |> If YOU know, please DON'T HESITATE! |> The Best of Thanx to YOU! |> |> I would be really happy for your informing me. The only way I know of is via this: (From the Informix Archive at mathcs.emort.edu..... /* @(#)File: dbnames.ec @(#)Version: 1.3 @(#)Last changed: 93/07/19 @(#)Purpose: Print list of visible databases @(#)Author: John Cooke/Mark Jeske/Jonathan Leffler */ /* ********************************************************** ** This code is derived from two almost identical ** ** programs with the identifications preserved below: ** ********************************************************** ** dbnames.ec ** ** List all available database names. ** ** Mark J (Informix) 3-13-91 ** ********************************************************** ** From: johnc@obelix (John Cooke) ** ** Quite a coincidence .... I wrote THIS program: ** ** program to get the names of all visible databases ** ********************************************************** ** Compile using: ** ** esql -o dbnames dbnames.ec $INFORMIXDIR/lib/librds.a ** ********************************************************** */ #ifndef lint static char sccs[] = "@(#)dbnames.ec 1.3 93/07/19"; #endif #include <stdio.h> #define MAXDBS 100 #define FASIZ (MAXDBS * 19) main(argc, argv) int argc; char **argv; { int ndbs; int sqlcode; int i; char *dbsname[MAXDBS + 1]; char dbsarea[FASIZ]; if ((sqlcode = sqgetdbs(&ndbs, dbsname, MAXDBS, dbsarea, FASIZ)) != 0) { fprintf(stderr, "%s: error code %d from sqgetdbs\\n", argv[0], sqlcode); exit(1); } else { for (i = 0; i < ndbs; ++i) printf("%s dbarea=%s\\n", dbsname[i], dbsarea); } return (0); } /* ** Routines compact and frmcmpr provided in e-mail from: ** Message-Id: <9209131735.AA01780@spsgate.sps.mot.com> ** From: uunet!hermes1.sps.mot.com!baskett (Bob Baskett) ** Date: Sun, 13 Sep 92 10:27:52 MST */ compact(frm, fcnt) char **frm; int fcnt; { register char **to; register char **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; char **n2; { return(stcmpr(*n1, *n2)); } -- ------------------------------------------------------------------------------- Mike Reetz reetz@ncar.ucar.edu 3450 Mitchell Lane UNIX(tm) Operations Manager (303)497-8881(V) 497-8501(Fax) Building 1 UCAR - University Corporation For Atmospheric Research Boulder, CO 80301