Functions


PG(3)

PG -- seting up esh-interface to PostgreSQL

SYNOPSIS

#include <DB/PG.h>

EfiType Type_PG;

void PG_setup (void);

DESCRIPTION

The function PG_setup expands the esh-Interpreter with the frontend to PostgreSQL.

SEE ALSO

refdata(3), PG_connect(3), PG_exec(3), PG_open(3), PG_query(3), PG(7).
PostgreSQL Programmer's Guide.

COPYRIGHT

Copyright (C) 2001 Erich Frühstück

PG_connect(3)

PG_connect -- database connection type

SYNOPSIS

#include <DB/PG.h>

int PG_print (IO *io, PG *pg);

PG *PG_connect (const char *def);

void PG_info (PG *pg, const char *fmt, const char *argdef, ...);

DESCRIPTION

The function PG_connect makes a new connection to a PostgreSQL backend and returns a PG structure.

The function PG_info displays a report to error class PG and level DBG_INFO.

SEE ALSO

refdata(3), PG_exec(3), PG_open(3), PG_query(3), SetupPG(3), PG(7).
PostgreSQL Programmer's Guide.

DIAGNOSTICS

If the connection fails, an error message is displayed and the function PG_connect returns a NULL-pointer.

COPYRIGHT

Copyright (C) 2001 Erich Frühstück

PG_edb(3)

PG_edb -- EDB interface

SYNOPSIS

#include <DB/PG.h>

void PG_edb (void);

DESCRIPTION

COPYRIGHT

Copyright (C) 2006 Erich Frühstück

PG_exec(3)

PG_exec -- query execution functions

SYNOPSIS

#include <DB/PG.h>

int PG_exec (PG *pg, const char *cmd, ExecStatusType stat);

int PG_command (PG *pg, const char *cmd);

void PG_serialize (PG *pg);

void PG_clear (PG *pg);

const char *PG_status (PG *pg);

DESCRIPTION

The functionPG_exec submits the query cmd to the database server with respected return status stat. A value of PGRES_EMPTY_QUERY accepts any return status except errors.

The functionPG_command submits the query cmd to the database server with respected return status PGRES_COMMAND_OK.

The function PG_clear clears the data of the last query.

The Funktion PG_status returns the status of the last query as string.

SEE ALSO

PG_connect(3), PG_open(3), PG_query(3), SetupPG(3), PG(7).
PostgreSQL Programmer's Guide.

DIAGNOSTICS

The functions PG_exec and PG_command returns 1 on success and 0 on failure.

COPYRIGHT

Copyright (C) 2001 Erich Frühstück

PG_mdmat(3)

PG_mdmat -- create mdmat object from tuples

SYNOPSIS

#include <DB/PG.h>

int PG_expandlim;

mdmat *PG_mdmat (PG *pg, const EfiType *type, const char *valdef, const char *axis);

DESCRIPTION

The function PG_mdmat creates a mdmat object from last query.

SEE ALSO

PG_connect(3), PG_query(3), SetupPG(3), PG(7), mdmat(7).
PostgreSQL Programmer's Guide.

COPYRIGHT

Copyright (C) 2001 Erich Frühstück

PG_open(3)

PG_open -- open interface for copying data to/from database server

SYNOPSIS

#include <DB/PG.h>

IO *PG_open (PG *pg, const char *name, const char *mode);

DESCRIPTION

The function PG_open performs a COPY command and returns an IO-structure for copying data to/from the backend. You should not use pg after calling PG_open, except you have incremented the reference counter of pg with rd_refer before.

The parameter mode starts with the key r (read data from server) or w (write data to server) and the optional key o (copy the internal uniq object id for each row).

SEE ALSO

io_getc(3), io_gets(3), io_puts(3), io_xprintf(3), PG_connect(3), PG_exec(3), PG_query(3), SetupPG(3), io(7), PG(7).
PostgreSQL Programmer's Guide.

DIAGNOSTICS

The function PG_open returns a NULL-Pointer on failure. You need not check the return value, a NULL-pointer acts like /dev/null.

NOTES

On closing, all pending data from backend are skipped and the connection is closed on demand. Until the IO-structure is open, the database connection pg is locked for other execution commands.

COPYRIGHT

Copyright (C) 2001 Erich Frühstück

PG_query(3)

PG_query -- send a tuple query to backend

SYNOPSIS

#include <DB/PG.h>

int PG_query (PG *pg, const char *cmd);

int PG_ntuples (PG *pg);

int PG_nfields (PG *pg);

char *PG_fname (PG *pg, int field);

char *PG_value (PG *pg, int tuple, int field);

DESCRIPTION

The function PG_query submits the query cmd to the database server with expected return status PGRES_TUPLES_OK.

The function PG_ntuples returns the number of tuples of last request.

The function PG_nfields returns the number of fields of last request.

The function PG_fname returns the label of field field of last request.

The function PG_value returns the value of field field in tuple tuple of last request.

SEE ALSO

PG_connect(3), PG_exec(3), PG_open(3), SetupPG(3), PG(7).
PostgreSQL Programmer's Guide.

DIAGNOSTICS

The function PG_query returns 1 on success and 0 on failure.

COPYRIGHT

Copyright (C) 2001 Erich Frühstück

PGType(3)

PGType -- data type info

SYNOPSIS

#include <DB/PG.h>

void PGType_clean (void *handle);

void *PGType_create (PG *pg);

char *PGType_name (void *handle, Oid oid);

void PGType_list (void *handle, IO *out);

DESCRIPTION

COPYRIGHT

Copyright (C) 2006 Erich Frühstück


go to next, previous section, start of document, contents, index