I changed some minor stuff in Thomas Good's man page for ecpg and would like
to see this one replace the man page for ecpg we currently have in CVS. It's
attached. Or should this one go to patches too?

Thanks

Michael
-- 
Dr. Michael Meskes, Manager of the Western Branch Office, Datenrevision GmbH
work: Cuxhavener Str. 36, D-21149 Hamburg, Michael.Meskes@datenrevision.de
home: Th.-Heuss-Str. 61, D-41812 Erkelenz, Michael.Meskes@usa.net
Go SF49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!
Sat, 28 Nov 1998 15:18:43 +0100
Michael Meskes <meskes@usa.net>
ecpg man page
> I changed some minor stuff in Thomas Good's man page for ecpg and would like
> to see this one replace the man page for ecpg we currently have in CVS. It's
> attached. Or should this one go to patches too?
> 
> Thanks

Applied to both trees.

Seems this manual page has not been converted to sgml yet.  Thomas, is
that true?  If not, please see the attached file.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

.TH ECPG UNIX 11/28/98 PostgreSQL \fIPostgreSQL\fP
.SH NAME
ecpg - embedded SQL preprocessor for C / PostgreSQL
.SH SYNOPSIS
.\" \fBecpg\fR [-v ] [-t] [-I include-path ] [-o outfile ]  file1 [ file2 ] [ ... ]
\fBecpg\fR [-v ] [-t] [-I include-path ] [-o outfile ]  file1 [ file2 ] [ ... ]
.SH DESCRIPTION
.B \fIecpg\fP
is an embedded SQL preprocessor for C / PostgreSQL. It
enables development of C programs with embedded SQL code.
.PP
.B \fIecpg\fP
is ultimately intended to be as compliant as possible with the         
ANSI SQL-2 standard and existing commercial ESQL/C packages.                                               
.SH OPTIONS
.B \fIecpg\fP
interprets the following flags when it is invoked               
on the command line:
.PP
.PD 0
.TP 10
.BI \-v 
Print version information. 
.PD
.TP
.B \-t
Turn off auto-transactin mode.
.PD
.TP
.PD
.TP
.B \-I include-path
Specify additional include path. Defaults are \.,
/usr/local/include, the PostgreSQL include path which is defined at compile
time (default: /usr/local/pgsql/lib), /usr/include
.PD
.TP
.B \-o
Specifies that ecpg should write all its output to outfile.
If no such option is given the output is written to foo.c
(if the input file was named foo.pgc.)
If the input file was named foo.bar the output file will be
named foo.bar.c. 
.PD
.TP
.B file1, file2...
The files to be processed.
.\" 
.SH INSTALLATION
The
.B \fIecpg\fP
preprocessor is built during the PostgreSQL installation.  Binaries and
libraries are installed into the PGBASE (i.e., /usr/local/pgsql/... ) 
subdirectories.
.SH PREPROCESSING FOR COMPILATION
.B \fIecpg\fP
.\" (-d ) (-o file) file.pgc ( 2> ecpf.log)
(-o file) file.pgc 
.LP
.\" The optional \-d flag turns on debugging and 2> ecpg.log
.\" redirects the debug output.  The .pgc extension is an 
.\" arbitrary means of denoting ecpg source.
The .pgc extension is an arbitrary means of denoting ecpg source.
.SH COMPILING AND LINKING
Assuming the \fIPostgreSQL\fP binaries are in /usr/local/pgsql:
.LP
gcc -g -i /usr/local/pgsql/include (-o file) file.c 
-L /usr/local/pgsql/lib -lecpg -lpq
.SH ECPG GRAMMAR
.LP
.SH LIBRARIES
.LP
The preprocessor will prepend two directives to the source:
.LP
\fI#include <ecpgtype.h>\fP and \fI#include <ecpglib.h>\fP
.SH VARIABLE DECLARATION  
Variables declared within ecpg source code must be prepended with:
.LP
EXEC SQL BEGIN DECLARE SECTION;  
.LP        
Similarly, variable declaration sections must terminate with:
.LP
EXEC SQL END DECLARE SECTION;
.LP        
NOTE: prior to version 2.1.0, each variable had to be declared 
on a separate line.  As of version 2.1.0 multiple variables may
be declared on a single line:
.LP
char  foo(16), bar(16);
.LP       
.SH ERROR HANDLING
The SQL communication area is defined with:
.LP
EXEC SQL INCLUDE sqlca;
.LP
NOTE: the lowercase `sqlca'.  While SQL convention may be 
followed, i.e., using uppercase to separate embedded SQL 
from C statements, sqlca (which includes the sqlca.h 
header file) MUST be lowercase.  This is because the EXEC SQL
prefix indicates that this INCLUDE will be parsed by ecpg.
ecpg observes case sensitivity (SQLCA.h will not be found.)
EXEC SQL INCLUDE can be used to include other header files
as long as case sensitivity is observed.
.LP
The sqlprint command is used with the EXEC SQL WHENEVER
statement to turn on error handling throughout the 
program:
.LP
EXEC SQL WHENEVER sqlerror sqlprint;
.LP
EXEC SQL WHENEVER not found sqlprint;
.LP
PLEASE NOTE: this is *not* an exhaustive example of usage for
the EXEC SQL WHENEVER statement.  Further examples of usage may
be found in SQL manuals (e.g., `The LAN TIMES Guide to SQL' by
Groff and Weinberg.)
.LP
.SH CONNECTING TO THE DATABASE SERVER
Prior to version 2.1.0 the database name was single quoted:
.RS
EXEC SQL CONNECT 'test1';
.RE
.LP
As of version 2.1.0, the syntax has been simplified:
.LP
.RS
EXEC SQL CONNECT test1;
.RE
(The database name is no longer quoted.)
.LP
Specifying a server and port name in the connect statement is also possible
as of version 6.4. of PostgreSQL. The syntax is:
.LP
.RS
dbname[@server][:port]
.RE
.LP
or
.LP
.RS
<tcp|unix>:postgresql://server[:port][/dbname][?options]
.RE
.SH QUERIES
.LP
.SS Create Table:
.LP
EXEC SQL CREATE TABLE foo (number int4, ascii char(16));  
.RS
EXEC SQL CREATE UNIQUE index num1 on foo(number); 
.RE
EXEC SQL COMMIT;
.LP 
.SS Insert:
.LP
EXEC SQL INSERT INTO foo (number, ascii)
.RS
VALUES (9999, 'doodad');
.RE
EXEC SQL COMMIT;
.LP
.SS Delete:
.LP
EXEC SQL DELETE FROM foo
.RS
WHERE number = 9999;   
.RE
EXEC SQL COMMIT;
.LP
.SS Singleton Select:
.LP
EXEC SQL SELECT foo INTO :FooBar FROM table1
.RS
WHERE ascii = 'doodad';  
.RE
.LP
.SS Select using Cursors:
.LP
EXEC SQL DECLARE foo_bar CURSOR FOR     
.RS
SELECT number, ascii FROM foo    
.RS
ORDER BY ascii;
.RE
.RE
EXEC SQL FETCH foo_bar INTO :FooBar, DooDad;
.LP
...
EXEC SQL CLOSE foo_bar;
.RS
EXEC SQL COMMIT;
.RE
.LP
.SS Updates
.LP
EXEC SQL UPDATE foo
.RS
SET ascii = 'foobar'
.RE
.RS
WHERE number = 9999;
.RE
EXEC SQL COMMIT;
.LP
.SH BUGS
.LP
The is no EXEC SQL PREPARE statement.
.LP
The complete structure definition MUST be listed
inside the declare section.
.LP
See the TODO file in the source for some more missing features.
.LP
.SH "RETURN VALUE"
.LP
ecpg returns 0 to the shell on successful completion, -1
for errors.
.LP
.SH "SEE ALSO"
.PD 0
.TP
\fIcc\fP(1), \fIpgintro\fP(l), \fIcommit\fP(l), \fIdelete\fP(l)
.TP
\fIfetch\fP(l), \fIselect\fP(l), \fIsql\fP(l) , \fIupdate\fP(l)
.PD
.SH FILES
.PD 0
.TP
.B /usr/src/pgsql/postgresql-${ver}/src/interfaces...
 ./ecpg/include.......source for \fIecpg\fP header files.
 ./ecpg/lib...........source for \fIecpg\fP libraries.
 ./ecpg/preproc.......source for \fIecpg\fP header files.
 ./ecpg/test..........source for \fIecpg\fP libraries.
 (test contains examples of syntax for ecpg SQL-C.)
.PD
.TP
.B /usr/local/pgsql/bin 
\fIPostgreSQL\fP binaries including \fIecpg\fP.
.PD
.TP
.B /usr/local/pgsql/include 
\fIPostgreSQL\fP headers including \fIecpglib.h\fP \fIecpgtype.h\fP 
and \fIsqlca.h\fP.
.PD
.TP
.B /usr/local/pgsql/lib 
\fIPostgreSQL\fP libraries including \fIlibecpg.a\fP and 
\fIlibecpg.so\fP.
.SH AUTHORS
Linus Tolke \fI<linus@epact.se>\fP
- original author of ECPG (up to version 0.2).
.br
.PP
Michael Meskes \fI<meskes@debian.org>\fP
- actual author and maintainer of ECPG.
.br
.PP
Thomas Good \fI<tomg@q8.nrnet.org>\fP
- author of this revision of the ecpg man page.
.br
.zZ
Sat, 12 Dec 1998 22:55:27 -0500 (EST)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] ecpg man page
> > I changed some minor stuff (for) ecpg and would like
> > to ... replace the man page for ecpg we currently have in CVS.
> Seems this manual page has not been converted to sgml yet.  Thomas, is
> that true?  If not, please see the attached file.

Michael, the ecpg author, contributed ecpg.sgml several months ago. I
would think that he was just reconciling the information in the man page
with the existing sgml-based information, but don't know that for sure.
Michael?

                     - Tom

Sun, 13 Dec 1998 05:11:04 +0000
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu>
Re: [HACKERS] ecpg man page
On Sun, 13 Dec 1998, Thomas G. Lockhart wrote:

> > > I changed some minor stuff (for) ecpg and would like
> > > to ... replace the man page for ecpg we currently have in CVS.
> > Seems this manual page has not been converted to sgml yet.  Thomas, is
> > that true?  If not, please see the attached file.
> 
> Michael, the ecpg author, contributed ecpg.sgml several months ago. I
> would think that he was just reconciling the information in the man page
> with the existing sgml-based information, but don't know that for sure.
> Michael?

Thomas,

I rewrote the man page for Michael after he was of great assistance to
me getting ecpg going.  This magnum opus was omitted from 6.4 and I was
of course devastated.  I mentioned it to Michael M and he removed my
errata and then sent it on to the HACKERS list...so I expect the earlier
version differs from what Michael recently cleaned up.

 Cheers,
 Tom

    ----------- Sisters of Charity Medical Center ----------
                    Department of Psychiatry
                              ----     
 Thomas Good, System Administrator            <tomg@q8.nrnet.org>
 North Richmond CMHC/Residential Services     Phone: 718-354-5528
 75 Vanderbilt Ave, Quarters 8                Fax:   718-354-5056
 Staten Island, NY   10304                    www.panix.com/~ugd
                              ----     
 Powered by PostgreSQL 6.3.2 / Perl 5.004 / DBI-0.91::DBD-PG-0.69 


Sun, 13 Dec 1998 07:34:01 -0500 (EST)
Thomas Good <tomg@nrnet.org>
Re: [HACKERS] ecpg man page
> ...so I expect the earlier
> version differs from what Michael recently cleaned up.

Hmm. If you have time and inclination, it would be great if you could
look at ecpg.sgml and update it too. I'd hate to see the two get out of
sync in information content. Eventually the man pages will be generated
from the sgml files so man-only info may get lost.

                     - Tom

Sun, 13 Dec 1998 13:22:54 +0000
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu>
Re: [HACKERS] ecpg man page
On Sun, Dec 13, 1998 at 05:11:04AM +0000, Thomas G. Lockhart wrote:
> Michael, the ecpg author, contributed ecpg.sgml several months ago. I

I thought you did transform it to sgml. 

> would think that he was just reconciling the information in the man page
> with the existing sgml-based information, but don't know that for sure.
> Michael?

My problem is that I do not speak sgml. Therefore I only updated the man
page from Tom Good's version but not the sgml part. Is there a tool I could
use to transform it? I try to remember that the next time and will only
update the sgml file which should be much easier than trasnforming the
current man page.

Michael

P.S.: If this doesn't go through on the mailing list please forward it there
again. I'm currently in the process of changing some email addresses and
have no idea which message will apeear there first.
-- 
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael.Meskes@gmx.net          | Use PostgreSQL!

Mon, 14 Dec 1998 11:17:15 +0100
Michael Meskes <Michael.Meskes@gmx.net>
Re: [HACKERS] ecpg man page