11<!--
2- $Header: /cvsroot/pgsql/doc/src/sgml/ecpg.sgml,v 1.21 2001/09/06 00:23:42 momjian Exp $
2+ $Header: /cvsroot/pgsql/doc/src/sgml/ecpg.sgml,v 1.22 2001/09/10 21:58:46 petere Exp $
33-->
44
55 <chapter id="ecpg">
@@ -153,12 +153,12 @@ $Header: /cvsroot/pgsql/doc/src/sgml/ecpg.sgml,v 1.21 2001/09/06 00:23:42 momjia
153153 <para>
154154 To detect errors from the <productname>Postgres</productname>
155155 server, include a line like:
156- <programlisting>
156+ <programlisting>
157157exec sql include sqlca;
158- </programlisting>
158+ </programlisting>
159159 in the include section of your file. This will define a struct and
160160 a variable with the name <parameter>sqlca</parameter> as follows:
161- <programlisting>
161+ <programlisting>
162162struct sqlca
163163{
164164 char sqlcaid[8];
@@ -191,11 +191,11 @@ struct sqlca
191191 /* 7: empty */
192192 char sqlext[8];
193193} sqlca;
194- </programlisting>
194+ </programlisting>
195195 </para>
196196
197197 <para>
198- If an erroroccured in the last <acronym>SQL</acronym> statement.
198+ If an erroroccurred in the last <acronym>SQL</acronym> statement.
199199 <parameter>sqlca.sqlcode</parameter> will be non-zero. If
200200 <parameter>sqlca.sqlcode</parameter> is less that 0, this is a
201201 serious error, like the database definition does not match the
@@ -214,7 +214,7 @@ struct sqlca
214214
215215 <variablelist>
216216 <varlistentry>
217- <term>-12, Out of memory in line %d.</term>
217+ <term><computeroutput> -12, Out of memory in line %d.</computeroutput> </term>
218218 <listitem>
219219<para>
220220 Should not normally occur. This indicates your virtual memory is
@@ -224,7 +224,7 @@ struct sqlca
224224 </varlistentry>
225225
226226 <varlistentry>
227- <term>-200, Unsupported type %s on line %d.</term>
227+ <term><computeroutput> -200, Unsupported type %s on line %d.</computeroutput> </term>
228228 <listitem>
229229<para>
230230 Should not normally occur. This indicates the preprocessor has
@@ -236,7 +236,7 @@ struct sqlca
236236 </varlistentry>
237237
238238 <varlistentry>
239- <term>-201, Too many arguments line %d.</term>
239+ <term><computeroutput> -201, Too many arguments line %d.</computeroutput> </term>
240240 <listitem>
241241<para>
242242 This means that <productname>Postgres</productname> has
@@ -248,7 +248,7 @@ struct sqlca
248248 </varlistentry>
249249
250250 <varlistentry>
251- <term>-202, Too few arguments line %d.</term>
251+ <term><computeroutput> -202, Too few arguments line %d.</computeroutput> </term>
252252 <listitem>
253253<para>
254254 This means that <productname>Postgres</productname> has
@@ -260,7 +260,7 @@ struct sqlca
260260 </varlistentry>
261261
262262 <varlistentry>
263- <term>-203, Too many matches line %d.</term>
263+ <term><computeroutput> -203, Too many matches line %d.</computeroutput> </term>
264264 <listitem>
265265<para>
266266 This means the query has returned several rows but the
@@ -271,7 +271,7 @@ struct sqlca
271271 </varlistentry>
272272
273273 <varlistentry>
274- <term>-204, Not correctly formatted int type: %s line %d.</term>
274+ <term><computeroutput> -204, Not correctly formatted int type: %s line %d.</computeroutput> </term>
275275 <listitem>
276276<para>
277277 This means the host variable is of type <type>int</type> and
@@ -284,7 +284,7 @@ struct sqlca
284284 </varlistentry>
285285
286286 <varlistentry>
287- <term>-205, Not correctly formatted unsigned type: %s line %d.</term>
287+ <term><computeroutput> -205, Not correctly formatted unsigned type: %s line %d.</computeroutput> </term>
288288 <listitem>
289289<para>
290290 This means the host variable is of type <type>unsigned
@@ -298,7 +298,7 @@ struct sqlca
298298 </varlistentry>
299299
300300 <varlistentry>
301- <term>-206, Not correctly formatted floating point type: %s line %d.</term>
301+ <term><computeroutput> -206, Not correctly formatted floating point type: %s line %d.</computeroutput> </term>
302302 <listitem>
303303<para>
304304 This means the host variable is of type <type>float</type> and
@@ -311,7 +311,7 @@ struct sqlca
311311 </varlistentry>
312312
313313 <varlistentry>
314- <term>-207, Unable to convert %s to bool on line %d.</term>
314+ <term><computeroutput> -207, Unable to convert %s to bool on line %d.</computeroutput> </term>
315315 <listitem>
316316<para>
317317 This means the host variable is of type <type>bool</type> and
@@ -322,17 +322,17 @@ struct sqlca
322322 </varlistentry>
323323
324324 <varlistentry>
325- <term>-208, Empty query line %d.</term>
325+ <term><computeroutput> -208, Empty query line %d.</computeroutput> </term>
326326 <listitem>
327327<para>
328- <productname>Postgres</productname> returned PGRES_EMPTY_QUERY, probably
328+ <productname>Postgres</productname> returned<symbol> PGRES_EMPTY_QUERY</symbol> , probably
329329 because the query indeed was empty.
330330</para>
331331 </listitem>
332332 </varlistentry>
333333
334334 <varlistentry>
335- <term>-220, No such connection %s in line %d.</term>
335+ <term><computeroutput> -220, No such connection %s in line %d.</computeroutput> </term>
336336 <listitem>
337337<para>
338338 The program tried to access a connection that does not exist.
@@ -341,7 +341,7 @@ struct sqlca
341341 </varlistentry>
342342
343343 <varlistentry>
344- <term>-221, Not connected in line %d.</term>
344+ <term><computeroutput> -221, Not connected in line %d.</computeroutput> </term>
345345 <listitem>
346346<para>
347347 The program tried to access a connection that does exist but is
@@ -351,7 +351,7 @@ struct sqlca
351351 </varlistentry>
352352
353353 <varlistentry>
354- <term>-230, Invalid statement name %s in line %d.</term>
354+ <term><computeroutput> -230, Invalid statement name %s in line %d.</computeroutput> </term>
355355 <listitem>
356356<para>
357357 The statement you are trying to use has not been prepared.
@@ -360,7 +360,7 @@ struct sqlca
360360 </varlistentry>
361361
362362 <varlistentry>
363- <term>-400, Postgres error: %s line %d.</term>
363+ <term><computeroutput> -400, Postgres error: %s line %d.</computeroutput> </term>
364364 <listitem>
365365<para>
366366 Some <productname>Postgres</productname> error.
@@ -371,7 +371,7 @@ struct sqlca
371371 </varlistentry>
372372
373373 <varlistentry>
374- <term>-401, Error in transaction processing line %d. </term>
374+ <term><computeroutput> -401, Error in transaction processing line %d.</computeroutput> </term>
375375 <listitem>
376376<para>
377377 <productname>Postgres</productname> signaled that we cannot start,
@@ -381,7 +381,7 @@ struct sqlca
381381 </varlistentry>
382382
383383 <varlistentry>
384- <term>-402, connect: could not open database %s.</term>
384+ <term><computeroutput> -402, connect: could not open database %s.</computeroutput> </term>
385385 <listitem>
386386<para>
387387 The connect to the database did not work.
@@ -390,10 +390,10 @@ struct sqlca
390390 </varlistentry>
391391
392392 <varlistentry>
393- <term>100, Data not found line %d.</term>
393+ <term><computeroutput> 100, Data not found line %d.</computeroutput> </term>
394394 <listitem>
395395<para>
396- This is a "normal" error that tells you that what you arequering cannot
396+ This is a "normal" error that tells you that what you arequerying cannot
397397 be found or you are at the end of the cursor.
398398</para>
399399 </listitem>
@@ -419,7 +419,7 @@ struct sqlca
419419 <term>Oracle's single tasking</term>
420420 <listitem>
421421 <para>
422- Oracle version 7.0 on AIX 3 uses OS-supported locks in shared
422+ Oracle version 7.0 on<systemitem class="osname"> AIX</> 3 uses OS-supported locks in shared
423423memory that allow an application designer to link an application
424424in a "single tasking" way. Instead of starting one client
425425process per application process, both the database part and the
@@ -526,21 +526,21 @@ struct sqlca
526526 The following statements are not implemented thus far:
527527 <variablelist>
528528 <varlistentry>
529- <term> exec sql allocate</term>
529+ <term><literal> exec sql allocate</> </term>
530530 <listitem>
531531 <para>
532532 </para>
533533 </listitem>
534534 </varlistentry>
535535 <varlistentry>
536- <term> exec sql deallocate</term>
536+ <term><literal> exec sql deallocate</> </term>
537537 <listitem>
538538 <para>
539539 </para>
540540 </listitem>
541541 </varlistentry>
542542 <varlistentry>
543- <term> SQLSTATE</term>
543+ <term><literal> SQLSTATE</> </term>
544544 <listitem>
545545 <para>
546546 </para>
@@ -565,10 +565,10 @@ exec sql insert select from statement
565565 </varlistentry>
566566
567567 <varlistentry>
568- <term>sqlwarn[6]</term>
568+ <term><literal> sqlwarn[6]</literal> </term>
569569 <listitem>
570570<para>
571- sqlwarn[6] should be <literal>W</> if the <command>PRECISION</>
571+ <literal> sqlwarn[6]</literal> should be <literal>W</> if the <command>PRECISION</>
572572 or <command>SCALE</> value specified in a <command>SET
573573 DESCRIPTOR</> statement was ignored.
574574</para>
@@ -582,7 +582,7 @@ exec sql insert select from statement
582582 <title>The Preprocessor</title>
583583
584584 <para>
585- The first four lines written by ecpg to the output are fixed lines.
585+ The first four lines written by<command> ecpg</command> to the output are fixed lines.
586586 Two are comments and two are include lines necessary to interface
587587 to the library.
588588 </para>
@@ -629,7 +629,7 @@ exec sql end declare section;
629629</para>
630630
631631<para>
632- The special types VARCHAR and VARCHAR2 are converted into a named struct
632+ The special types<type> VARCHAR</type> and<type> VARCHAR2</type> are converted into a named struct
633633 for every variable. A declaration like:
634634 <programlisting>
635635VARCHAR var[180];
@@ -745,7 +745,7 @@ exec sql connect to <replaceable>connection target</replaceable>;
745745</para>
746746
747747<para>
748- Finally, the userid and password may be a constant text, a
748+ Finally, the<replaceable> userid</replaceable> and<replaceable> password</replaceable> may be a constant text, a
749749 character variable, or a character string.
750750</para>
751751 </listitem>
@@ -853,7 +853,7 @@ exec sql rollback;
853853 <simplelist>
854854 <member>The type as a special symbol.</member>
855855 <member>A pointer to the value or a pointer to the pointer.</member>
856- <member>The size of the variable if it is a char or varchar.</member>
856+ <member>The size of the variable if it is a<type> char</type> or<type> varchar</type> .</member>
857857 <member>The number of elements in the array (for array fetches).</member>
858858 <member>The offset to the next element in the array (for array fetches).</member>
859859 <member>The type of the indicator variable as a special symbol.</member>
@@ -876,7 +876,7 @@ exec sql rollback;
876876
877877 <para>
878878 Here is a complete example describing the output of the preprocessor of a
879- file foo.pgc:
879+ file<filename> foo.pgc</filename> :
880880 <programlisting>
881881exec sql begin declare section;
882882int index;
@@ -919,7 +919,7 @@ ECPGdo(__LINE__, NULL, "select res from mytable where index = ? ",
919919 The most important function in the library is
920920 <function>ECPGdo</function>. It takes a variable number of
921921 arguments. Hopefully there are no computers that limit the
922- number of variables that can be accepted by a varargs() function. This
922+ number of variables that can be accepted by a<function> varargs()</function> function. This
923923 can easily add up to 50 or so arguments.
924924 </para>
925925
@@ -960,7 +960,7 @@ ECPGdo(__LINE__, NULL, "select res from mytable where index = ? ",
960960 </varlistentry>
961961
962962 <varlistentry>
963- <term>ECPGt_EOIT</term>
963+ <term><literal> ECPGt_EOIT</literal> </term>
964964 <listitem>
965965<para>
966966 An enum telling that there are no more input variables.