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

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!emory!emory.mathcs.emory.edu
  2. From: widener!obelix.informix.com!johnl@emory.mathcs.emory.edu (Jonathan Leffler)
  3. Newsgroups: comp.databases.informix
  4. Subject: Re: Way to get list of databases ?
  5. Message-ID: <9243@emory.mathcs.emory.edu>
  6. Date: 29 Jul 92 22:13:06 GMT
  7. Sender: walt@mathcs.emory.edu
  8. Reply-To: widener!obelix.informix.com!johnl@emory.mathcs.emory.edu (Jonathan Leffler)
  9. Lines: 93
  10. X-Informix-List-ID: <list.1346>
  11.  
  12.  
  13. I enclose a shell archive of dbnames.ec.
  14. Compile using: esql -o dbnames dbnames.ec
  15.  
  16. Probably won't wok with ESQL/C 4.10 unless you can find the file rfnmanip.o
  17. in one of the other libraries you have installed, but try it and see.
  18. Works OK with ESQL/C 4.00 and ESQL/C 5.00.
  19.  
  20. This is totally unsupported, and not guaranteed on any platform whatsoever!
  21.  
  22. Yours,
  23. Jonathan Leffler (johnl@obelix.informix.com) #include <disclaimer.h>
  24.  
  25. :    "@(#)shar.sh    1.8"
  26. #! /bin/sh
  27. #
  28. #    This is a shell archive.
  29. #    Remove everything above this line and run sh on the resulting file.
  30. #    If this archive is complete, you will see this message at the end:
  31. #    "All files extracted"
  32. #
  33. #    Created: Wed Jul 29 22:23:04 GMT 1992 by johnl at Informix Software Ltd.
  34. #    Files archived in this archive:
  35. #    dbnames.ec
  36. #
  37. #--------------------
  38. if [ -f dbnames.ec -a "$1" != "-c" ]
  39. then echo shar: dbnames.ec already exists
  40. else
  41. echo 'x - dbnames.ec (1625 characters)'
  42. sed -e 's/^X//' >dbnames.ec <<'SHAR-EOF'
  43. X/*
  44. X@(#)File:            dbnames.ec
  45. X@(#)Version:         1.1
  46. X@(#)Last changed:    91/03/14
  47. X@(#)Purpose:         Print list of visible databases
  48. X@(#)Author:          John Cooke/Mark Jeske/Jonathan Leffler
  49. X*/
  50. X
  51. X/*
  52. X**********************************************************
  53. X**    This code is derived from two almost identical      **
  54. X**    programs with the identifications preserved below:  **
  55. X**********************************************************
  56. X**    dbnames.ec                                          **
  57. X**    List all available database names.                  **
  58. X**    Mark J (Informix) 3-13-91                           **
  59. X**********************************************************
  60. X**    From: johnc@obelix (John Cooke)                     **
  61. X**    Quite a coincidence ....  I wrote THIS program:     **
  62. X**    program to get the names of all visible databases   **
  63. X**********************************************************
  64. X**    Compile using:                                      **
  65. X**    esql -o dbnames dbnames.ec $INFORMIXDIR/lib/librds.a       **
  66. X**********************************************************
  67. X*/
  68. X
  69. X#ifndef lint
  70. Xstatic char     sccs[] = "@(#)dbnames.ec    1.1 91/03/14";
  71. X#endif
  72. X
  73. X#include <stdio.h>
  74. X
  75. X#define MAXDBS    100
  76. X#define FASIZ     (MAXDBS * 19)
  77. X
  78. Xmain()
  79. X{
  80. X    int             ndbs;
  81. X    int             sqlcode;
  82. X    int             i;
  83. X    char           *dbsname[MAXDBS + 1];
  84. X    char            dbsarea[FASIZ];
  85. X
  86. X    if ((sqlcode = sqgetdbs(&ndbs, dbsname, MAXDBS, dbsarea, FASIZ)) != 0)
  87. X        fprintf(stderr, "error code %d from sqgetdbs\n", sqlcode);
  88. X    else
  89. X    {
  90. X        for (i = 0; i < ndbs; ++i)
  91. X            printf("%d %s\n", i, dbsname[i]);
  92. X    }
  93. X
  94. X    return (0);
  95. X}
  96. SHAR-EOF
  97. chmod 444 dbnames.ec
  98. if [ `wc -c <dbnames.ec` -ne 1625 ]
  99. then echo shar: dbnames.ec unpacked with wrong size
  100. fi
  101. # end of overwriting check
  102. fi
  103. echo All files extracted
  104. exit 0
  105.