Skip to content

Commit 278669e

Browse files
committed
Document all the ecpg error codes.
1 parent b522ce0 commit 278669e

File tree

2 files changed

+97
-28
lines changed

2 files changed

+97
-28
lines changed

doc/src/sgml/ecpg.sgml

Lines changed: 92 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ecpg.sgml,v 1.24 2001/10/11 20:25:42 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ecpg.sgml,v 1.25 2001/10/18 20:32:58 momjian Exp $
33
-->
44

55
<chapter id="ecpg">
@@ -195,11 +195,11 @@ struct sqlca
195195
</para>
196196

197197
<para>
198-
If an error occurred in the last <acronym>SQL</acronym> statement.
199-
<parameter>sqlca.sqlcode</parameter> will be non-zero. If
200-
<parameter>sqlca.sqlcode</parameter> is less that 0, this is a
198+
If an no error occurred in the last <acronym>SQL</acronym> statement.
199+
<parameter>sqlca.sqlcode</parameter> will be 0 (ECPG_NO_ERROR). If
200+
<parameter>sqlca.sqlcode</parameter> is less that zero, this is a
201201
serious error, like the database definition does not match the
202-
query. If it is greater than 0, it is a normal error like the
202+
query. If it is greater than zero, it is a normal error like the
203203
table did not contain the requested row.
204204
</para>
205205

@@ -210,7 +210,7 @@ struct sqlca
210210
</para>
211211

212212
<para>
213-
List of errors that can occur:
213+
These are the errors that can occur:
214214

215215
<variablelist>
216216
<varlistentry>
@@ -224,7 +224,7 @@ struct sqlca
224224
</varlistentry>
225225

226226
<varlistentry>
227-
<term><computeroutput>-200, Unsupported type %s on line %d.</computeroutput></term>
227+
<term><computeroutput>-200 (ECPG_UNSUPPORTED), 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><computeroutput>-201, Too many arguments line %d.</computeroutput></term>
239+
<term><computeroutput>-201 (ECPG_TOO_MANY_ARGUMENTS), 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><computeroutput>-202, Too few arguments line %d.</computeroutput></term>
251+
<term><computeroutput>-202 (ECPG_TOO_FEW_ARGUMENTS), 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><computeroutput>-203, Too many matches line %d.</computeroutput></term>
263+
<term><computeroutput>-203 (ECPG_TOO_MANY_MATCHES), 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><computeroutput>-204, Not correctly formatted int type: %s line %d.</computeroutput></term>
274+
<term><computeroutput>-204 (ECPG_INT_FORMAT), 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><computeroutput>-205, Not correctly formatted unsigned type: %s line %d.</computeroutput></term>
287+
<term><computeroutput>-205 (ECPG_UINT_FORMAT), 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><computeroutput>-206, Not correctly formatted floating point type: %s line %d.</computeroutput></term>
301+
<term><computeroutput>-206 (ECPG_FLOAT_FORMAT), 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><computeroutput>-207, Unable to convert %s to bool on line %d.</computeroutput></term>
314+
<term><computeroutput>-207 (ECPG_CONVERT_BOOL), 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,7 +322,7 @@ struct sqlca
322322
</varlistentry>
323323

324324
<varlistentry>
325-
<term><computeroutput>-208, Empty query line %d.</computeroutput></term>
325+
<term><computeroutput>-208 (ECPG_EMPTY), Empty query line %d.</computeroutput></term>
326326
<listitem>
327327
<para>
328328
<productname>Postgres</productname> returned <symbol>PGRES_EMPTY_QUERY</symbol>, probably
@@ -332,7 +332,7 @@ struct sqlca
332332
</varlistentry>
333333

334334
<varlistentry>
335-
<term><computeroutput>-209, NULL value without indicator in line %d.</computeroutput></term>
335+
<term><computeroutput>-209 (ECPG_MISSING_INDICATOR), NULL value without indicator in line %d.</computeroutput></term>
336336
<listitem>
337337
<para>
338338
<productname>Postgres</productname> returned <symbol>ECPG_MISSING_INDICATOR</symbol>
@@ -342,7 +342,29 @@ struct sqlca
342342
</varlistentry>
343343

344344
<varlistentry>
345-
<term><computeroutput>-220, No such connection %s in line %d.</computeroutput></term>
345+
<term><computeroutput>-210 (ECPG_NO_ARRAY), Variable is not an array in line %d.</computeroutput></term>
346+
<listitem>
347+
<para>
348+
<productname>Postgres</productname> returned <symbol>ECPG_NO_ARRAY</symbol>
349+
because an ordinary variable was used in a place that requires
350+
an array.
351+
</para>
352+
</listitem>
353+
</varlistentry>
354+
355+
<varlistentry>
356+
<term><computeroutput>-211 (ECPG_DATA_NOT_ARRAY), Data read from backend is not an array in line %d.</computeroutput></term>
357+
<listitem>
358+
<para>
359+
<productname>Postgres</productname> returned <symbol>ECPG_DATA_NOT_ARRAY</symbol>
360+
because the database returned an ordinary variable in a place
361+
that requires array value.
362+
</para>
363+
</listitem>
364+
</varlistentry>
365+
366+
<varlistentry>
367+
<term><computeroutput>-220 (ECPG_NO_CONN), No such connection %s in line %d.</computeroutput></term>
346368
<listitem>
347369
<para>
348370
The program tried to access a connection that does not exist.
@@ -351,7 +373,7 @@ struct sqlca
351373
</varlistentry>
352374

353375
<varlistentry>
354-
<term><computeroutput>-221, Not connected in line %d.</computeroutput></term>
376+
<term><computeroutput>-221 (ECPG_NOT_CONN), Not connected in line %d.</computeroutput></term>
355377
<listitem>
356378
<para>
357379
The program tried to access a connection that does exist but is
@@ -361,7 +383,7 @@ struct sqlca
361383
</varlistentry>
362384

363385
<varlistentry>
364-
<term><computeroutput>-230, Invalid statement name %s in line %d.</computeroutput></term>
386+
<term><computeroutput>-230 (ECPG_INVALID_STMT), Invalid statement name %s in line %d.</computeroutput></term>
365387
<listitem>
366388
<para>
367389
The statement you are trying to use has not been prepared.
@@ -370,7 +392,54 @@ struct sqlca
370392
</varlistentry>
371393

372394
<varlistentry>
373-
<term><computeroutput>-400, Postgres error: %s line %d.</computeroutput></term>
395+
<term><computeroutput>-240 (ECPG_UNKNOWN_DESCRIPTOR), Descriptor %s not found in line %d.</computeroutput></term>
396+
<listitem>
397+
<para>
398+
The descriptor specified was not foundstatement you are trying to use has not been prepared.
399+
</para>
400+
</listitem>
401+
</varlistentry>
402+
403+
<varlistentry>
404+
<term><computeroutput>-241 (ECPG_INVALID_DESCRIPTOR_INDEX), Descriptor index out of range in line %d.</computeroutput></term>
405+
<listitem>
406+
<para>
407+
The descriptor index specified was out of range.
408+
</para>
409+
</listitem>
410+
</varlistentry>
411+
412+
<varlistentry>
413+
<term><computeroutput>-242 (ECPG_UNKNOWN_DESCRIPTOR_ITEM), Descriptor %s not found in line %d.</computeroutput></term>
414+
<listitem>
415+
<para>
416+
The descriptor specified was not foundstatement you are trying to use has not been prepared.
417+
</para>
418+
</listitem>
419+
</varlistentry>
420+
421+
<varlistentry>
422+
<term><computeroutput>-243 (ECPG_VAR_NOT_NUMERIC), Variable is not a numeric type in line %d.</computeroutput></term>
423+
<listitem>
424+
<para>
425+
The database returned a numeric value and the variable was not
426+
numeric.
427+
</para>
428+
</listitem>
429+
</varlistentry>
430+
431+
<varlistentry>
432+
<term><computeroutput>-244 (ECPG_VAR_NOT_CHAR), Variable is not a character type in line %d.</computeroutput></term>
433+
<listitem>
434+
<para>
435+
The database returned a non-numeric value and the variable was
436+
numeric.
437+
</para>
438+
</listitem>
439+
</varlistentry>
440+
441+
<varlistentry>
442+
<term><computeroutput>-400 (ECPG_PGSQL), Postgres error: %s line %d.</computeroutput></term>
374443
<listitem>
375444
<para>
376445
Some <productname>Postgres</productname> error.
@@ -381,7 +450,7 @@ struct sqlca
381450
</varlistentry>
382451

383452
<varlistentry>
384-
<term><computeroutput>-401, Error in transaction processing line %d.</computeroutput></term>
453+
<term><computeroutput>-401 (ECPG_TRANS), Error in transaction processing line %d.</computeroutput></term>
385454
<listitem>
386455
<para>
387456
<productname>Postgres</productname> signaled that we cannot start,
@@ -391,7 +460,7 @@ struct sqlca
391460
</varlistentry>
392461

393462
<varlistentry>
394-
<term><computeroutput>-402, connect: could not open database %s.</computeroutput></term>
463+
<term><computeroutput>-402 (ECPG_CONNECT), Could not connect to database %s in line %d.</computeroutput></term>
395464
<listitem>
396465
<para>
397466
The connect to the database did not work.
@@ -400,7 +469,7 @@ struct sqlca
400469
</varlistentry>
401470

402471
<varlistentry>
403-
<term><computeroutput>100, Data not found line %d.</computeroutput></term>
472+
<term><computeroutput>100 (ECPG_NOT_FOUND), Data not found line %d.</computeroutput></term>
404473
<listitem>
405474
<para>
406475
This is a <quote>normal</quote> error that tells you that what you are querying cannot

src/interfaces/ecpg/lib/error.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/error.c,v 1.11 2001/10/05 17:37:07 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/error.c,v 1.12 2001/10/18 20:32:58 momjian Exp $ */
22

33
#include "postgres_fe.h"
44

@@ -74,12 +74,12 @@ ECPGraise(int line, int code, const char *str)
7474

7575
case ECPG_NO_ARRAY:
7676
snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
77-
"variable is not an array in line %d.", line);
77+
"Variable is not an array in line %d.", line);
7878
break;
7979

8080
case ECPG_DATA_NOT_ARRAY:
8181
snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
82-
"data read from backend is not an array in line %d.", line);
82+
"Data read from backend is not an array in line %d.", line);
8383
break;
8484

8585
case ECPG_NO_CONN:
@@ -99,12 +99,12 @@ ECPGraise(int line, int code, const char *str)
9999

100100
case ECPG_UNKNOWN_DESCRIPTOR:
101101
snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
102-
"Sescriptor %s not found in line %d.", str, line);
102+
"Descriptor %s not found in line %d.", str, line);
103103
break;
104104

105105
case ECPG_INVALID_DESCRIPTOR_INDEX:
106106
snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
107-
"Sescriptor index out of range in line %d.", line);
107+
"Descriptor index out of range in line %d.", line);
108108
break;
109109

110110
case ECPG_UNKNOWN_DESCRIPTOR_ITEM:

0 commit comments

Comments
 (0)