Re: Backup DB ontape, fgl_xxx list and sqlcmd From Sam Leffler.
Posted in 1997
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.
---559023410-851401618-879353231=:11347
Content-Type: TEXT/PLAIN; charset=US-ASCII
On Wed, 12 Nov 1997, Christian Hernoux wrote:
> About Q2:
> >No. But I attach some code and a manual page that gives you a C
> >implementation that could be given an I4GL-callable interface
> >with a minimum of difficulty.
> I haven't no files attached to your E-MAil. Problems ?
Oops! Forgetfulness, I think...
Sorry.
Yours,
Jonathan Leffler (johnl@informix.com) #include <witticism.h>
> -----Message d'origine-----
> De : Jonathan Leffler <johnl@informix.com>
> From : Christian Hernoux <cnhx@polisoft.fr>
> Cc : Informix List <informix-list@rmy.emory.edu>
> Date : mardi 11 novembre 1997 23:37
> Objet : Re: Backup DB ontape, fgl_xxx list and sqlcmd From Sam Leffler.
>
> >On Tue, 11 Nov 1997, Christian Hernoux wrote:
> >
> >> Q1 :
> >> ====
> >> In a dbspace I have 3 databases.
> >> When I backup a dbspace, I save these databases.
> >> If I have a problem on a database is it possible to backup this database
> and
> >> restore it ?
> >> (dbunload or dbexport on tape drive ? some examples ?)
> >> I work with Informix ON-Line 5.01 on SCO with a 2GB tape drive.
> >
> >OnLine 5.x does not support dbspace-level restores, let alone
> >database-within-dbspace restores. You would have to upgrade to
> >7.2x, I think, to get that functionality.
> >
> >> Q2 :
> >> ====
> >> With the fgl_getenv("xxx") I get back an environment variable.
> >> does it exist a similar function to set an environment variable ?
> >
> >No. But I attach some code and a manual page that gives you a C
> >implementation that could be given an I4GL-callable interface
> >with a minimum of difficulty.
> >
> >> How can I get the list of fgl_xxx function and their description ?
> >
> >Manuals? I've not checked, but there aren't all that many.
> >
> >> Q3 :
> >> ====
> >> Where i can obtain the software : sqlcmd
> >> (a freeware SQL command interpreter from Sam Leffler)
> >
> >Maybe I should change my name by deed poll.
> >
> >http://www.iiug.org/software/
> >
> >Yours,
> >Jonathan Leffler (johnl@informix.com) #include <witticism.h>
> >
> >
>
>
>
---559023410-851401618-879353231=:11347
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="setenv.c"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.GSO.3.96.971112084711.11347B@anubis.mp.informix.com>
Content-Description: C Source Code
/*
@(#)File: $RCSfile: setenv.c,v $
@(#)Version: $Revision: 1.5 $
@(#)Last changed: $Date: 1997/06/02 16:41:57 $
@(#)Purpose: setenv(3) -- an alternative to putenv(3)
@(#)Author: J Leffler
@(#)Copyright: (C) JLSS 1995,1997
@(#)Product: :PRODUCT:
*/
/*TABSTOP=4*/
/*
** SETENV(3) -- an alternative to putenv(3)
**
** The basic problems with putenv(3) are manifest in its definition.
** It is given a string which it makes into part of the environment.
** If you overwrite that string subsequently, you modify the environment.
** If the string was allocated and you subsequently reset the environment
** variable without modifying the previous string, you have a memory leak.
**
** setenv() deals with these problems in the following ways:
** 1. It makes a copy of the string it is passed and places the copy in
** the environment.
** 2. It tracks the environment variables it has set and releases
** previously allocated versions of the variable.
**
** setenv() is implemented in two flavours. The default flavour is to
** completely replace putenv() by providing a putenv() entry point which is
** actually the same as setenv(). The alternative flavour continues to use
** putenv() to manage the environment but keeps separate records of what it
** has allocated.
*/
/* -- Include Files */
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include "setenv.h"
/* -- Constant Definitions */
#define SETENV_FAILURE -1
#define SETENV_SUCCESS 0
#define INCREMENT_SIZE 16
/* -- Configuration Definitions */
/* If defined conservative, override radical; else define radical */
#ifdef CONSERVATIVE_SETENV
#undef RADICAL_SETENV
#else
#define RADICAL_SETENV
#endif /* CONSERVATIVE_SETENV */
/* -- Macro Definitions */
#ifdef RADICAL_SETENV
#define PUTENV(val) fix_env(val)
#else
#define PUTENV(val) putenv(val)
#endif /* RADICAL_SETENV */
#ifdef NDEBUG
#define ENV_CHECK() ((void)0)
#else
#define ENV_CHECK() env_check()
#endif /* NDEBUG */
#ifdef PROFILING
#define NO_EXECUTE
#define PRINTF(x) ((void)0)
#else
#define PRINTF(x) printf x
#endif /* PROFILING */
/* -- Declarations */
extern char **environ;
#ifdef RADICAL_SETENV
static char **env_base = (char **)0;
static int env_size = 0;
static int env_used = 0;
#endif /* RADICAL_SETENV */
static char **alloc_base = (char **)0;
static int alloc_size = 0;
static int alloc_used = 0;
#ifndef lint
static const char rcs[] = "@(#)$Id: setenv.c,v 1.5 1997/06/02 16:41:57 johnl Exp $";
#endif
#ifdef RADICAL_SETENV
/* Environment comparison -- compare two environment entries by name */
static int env_compare(const char *s1, const char *s2)
{
char *eq;
const char *ref;
size_t len;
int rc;
/* One of the strings comes from the environment and contains an '=' */
ref = s1;
eq = strchr(ref, '=');
if (eq == (char *)0)
{
ref = s2;
eq = strchr(ref, '=');
}
assert(eq != (char *)0);
len = eq - ref;
/* Compare up to but excluding equals sign */
rc = strncmp(s1, s2, len);
if (rc == 0)
{
/* Check that we are dealing with distinct variable names */
if (s1[len] != '\\0' && s1[len] != '=')