1
1
<!--
2
- $PostgreSQL: pgsql/doc/src/sgml/ecpg.sgml,v 1.59 2003 /12/26 20:00:00 meskes Exp $
2
+ $PostgreSQL: pgsql/doc/src/sgml/ecpg.sgml,v 1.60 2004 /12/28 22:47:15 tgl Exp $
3
3
-->
4
4
5
5
<chapter id="ecpg">
@@ -19,7 +19,7 @@ $PostgreSQL: pgsql/doc/src/sgml/ecpg.sgml,v 1.59 2003/12/26 20:00:00 meskes Exp
19
19
</para>
20
20
21
21
<para>
22
- Admittedly, this documentation is quite incomplete. But since this
22
+ This documentation is quite incomplete. But since this
23
23
interface is standardized, additional information can be found in
24
24
many resources about SQL.
25
25
</para>
@@ -31,9 +31,9 @@ $PostgreSQL: pgsql/doc/src/sgml/ecpg.sgml,v 1.59 2003/12/26 20:00:00 meskes Exp
31
31
An embedded SQL program consists of code written in an ordinary
32
32
programming language, in this case C, mixed with SQL commands in
33
33
specially marked sections. To build the program, the source code
34
- is first passed to the embedded SQL preprocessor, which converts it
34
+ is first passed through the embedded SQL preprocessor, which converts it
35
35
to an ordinary C program, and afterwards it can be processed by a C
36
- compilation tool chain .
36
+ compiler .
37
37
</para>
38
38
39
39
<para>
@@ -53,16 +53,16 @@ $PostgreSQL: pgsql/doc/src/sgml/ecpg.sgml,v 1.59 2003/12/26 20:00:00 meskes Exp
53
53
</para>
54
54
55
55
<para>
56
- As indicated , programs written for the embedded
56
+ As already stated , programs written for the embedded
57
57
<acronym>SQL</acronym> interface are normal C programs with special
58
58
code inserted to perform database-related actions. This special
59
59
code always has the form
60
60
<programlisting>
61
61
EXEC SQL ...;
62
62
</programlisting>
63
63
These statements syntactically take the place of a C statement.
64
- Depending on the particular statement, they may appear in the
65
- global context or within a function. Embedded
64
+ Depending on the particular statement, they may appear at the
65
+ global level or within a function. Embedded
66
66
<acronym>SQL</acronym> statements follow the case-sensitivity rules
67
67
of normal <acronym>SQL</acronym> code, and not those of C.
68
68
</para>
@@ -326,9 +326,9 @@ EXEC SQL COMMIT;
326
326
<para>
327
327
In the default mode, statements are committed only when
328
328
<command>EXEC SQL COMMIT</command> is issued. The embedded SQL
329
- interface also supports autocommit of transactions (as known from
330
- other interfaces ) via the <option>-t</option> command-line option
331
- to <command>ecpg</command> (see below) or via the <literal>EXEC SQL
329
+ interface also supports autocommit of transactions (similar to
330
+ <application>libpq</> behavior ) via the <option>-t</option> command-line
331
+ option to <command>ecpg</command> (see below) or via the <literal>EXEC SQL
332
332
SET AUTOCOMMIT TO ON</literal> statement. In autocommit mode, each
333
333
command is automatically committed unless it is inside an explicit
334
334
transaction block. This mode can be explicitly turned off using
@@ -448,7 +448,7 @@ char foo[16], bar[16];
448
448
<para>
449
449
The declarations are also echoed to the output file as a normal C
450
450
variables, so there's no need to declare them again. Variables
451
- that are not intended to be used with SQL commands can be declared
451
+ that are not intended to be used in SQL commands can be declared
452
452
normally outside these special sections.
453
453
</para>
454
454
553
553
second host variable specification to each host variable that
554
554
contains data. This second host variable is called the
555
555
<firstterm>indicator</firstterm> and contains a flag that tells
556
- whether the datums is null, in which case the value of the real
556
+ whether the datum is null, in which case the value of the real
557
557
host variable is ignored. Here is an example that handles the
558
558
retrieval of null values correctly:
559
559
<programlisting>
@@ -1043,7 +1043,7 @@ static void set_error_handler(void)
1043
1043
<title>sqlca</title>
1044
1044
1045
1045
<para>
1046
- For a more powerful error handling, the embedded SQL interface
1046
+ For more powerful error handling, the embedded SQL interface
1047
1047
provides a global variable with the name <varname>sqlca</varname>
1048
1048
that has the following structure:
1049
1049
<programlisting>
@@ -1064,7 +1064,7 @@ struct
1064
1064
} sqlca;
1065
1065
</programlisting>
1066
1066
(In a multithreaded program, every thread automatically gets its
1067
- own copy of <varname>sqlca</varname>. This works similar to the
1067
+ own copy of <varname>sqlca</varname>. This works similarly to the
1068
1068
handling of the standard C global variable
1069
1069
<varname>errno</varname>.)
1070
1070
</para>
@@ -1132,7 +1132,7 @@ struct
1132
1132
<para>
1133
1133
The structure <varname>sqlca</varname> is not defined in the SQL
1134
1134
standard, but is implemented in several other SQL database
1135
- systems. The definitions are similar in the core, but if you want
1135
+ systems. The definitions are similar at the core, but if you want
1136
1136
to write portable applications, then you should investigate the
1137
1137
different implementations carefully.
1138
1138
</para>
@@ -1539,7 +1539,7 @@ ecpg prog1.pgc
1539
1539
<programlisting>
1540
1540
cc -c prog1.c
1541
1541
</programlisting>
1542
- The generated C source files include headers files from the
1542
+ The generated C source files include header files from the
1543
1543
<productname>PostgreSQL</> installation, so if you installed
1544
1544
<productname>PostgreSQL</> in a location that is not searched by
1545
1545
default, you have to add an option such as
@@ -1575,9 +1575,9 @@ ECPG = ecpg
1575
1575
</para>
1576
1576
1577
1577
<para>
1578
- <application>ecpg</application> is thread-safe if it is compiled using
1579
- the <option>--enable-thread-safety</> <filename>configure</filename>
1580
- command-line option . (You might need to use other threading
1578
+ The <application>ecpg</application> library is thread-safe if it is built
1579
+ using the <option>--enable-thread-safety</> command-line option to
1580
+ <filename>configure</filename> . (You might need to use other threading
1581
1581
command-line options to compile your client code.)
1582
1582
</para>
1583
1583
</sect1>
@@ -1621,7 +1621,7 @@ ECPG = ecpg
1621
1621
<title>Internals</title>
1622
1622
1623
1623
<para>
1624
- This section explain how <application>ECPG</application> works
1624
+ This section explains how <application>ECPG</application> works
1625
1625
internally. This information can occasionally be useful to help
1626
1626
users understand how to use <application>ECPG</application>.
1627
1627
</para>
0 commit comments