From 278669e038098a11e9b2e3437043eff4a67ee8f7 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Thu, 18 Oct 2001 20:32:58 +0000 Subject: [PATCH] Document all the ecpg error codes. --- doc/src/sgml/ecpg.sgml | 115 +++++++++++++++++++++++++------- src/interfaces/ecpg/lib/error.c | 10 +-- 2 files changed, 97 insertions(+), 28 deletions(-) diff --git a/doc/src/sgml/ecpg.sgml b/doc/src/sgml/ecpg.sgml index a4cdfa6d2f..b642ceab49 100644 --- a/doc/src/sgml/ecpg.sgml +++ b/doc/src/sgml/ecpg.sgml @@ -1,5 +1,5 @@ @@ -195,11 +195,11 @@ struct sqlca - If an error occurred in the last SQL statement. - sqlca.sqlcode will be non-zero. If - sqlca.sqlcode is less that 0, this is a + If an no error occurred in the last SQL statement. + sqlca.sqlcode will be 0 (ECPG_NO_ERROR). If + sqlca.sqlcode is less that zero, this is a serious error, like the database definition does not match the - query. If it is greater than 0, it is a normal error like the + query. If it is greater than zero, it is a normal error like the table did not contain the requested row. @@ -210,7 +210,7 @@ struct sqlca - List of errors that can occur: + These are the errors that can occur: @@ -224,7 +224,7 @@ struct sqlca - -200, Unsupported type %s on line %d. + -200 (ECPG_UNSUPPORTED), Unsupported type %s on line %d. Should not normally occur. This indicates the preprocessor has @@ -236,7 +236,7 @@ struct sqlca - -201, Too many arguments line %d. + -201 (ECPG_TOO_MANY_ARGUMENTS), Too many arguments line %d. This means that Postgres has @@ -248,7 +248,7 @@ struct sqlca - -202, Too few arguments line %d. + -202 (ECPG_TOO_FEW_ARGUMENTS), Too few arguments line %d. This means that Postgres has @@ -260,7 +260,7 @@ struct sqlca - -203, Too many matches line %d. + -203 (ECPG_TOO_MANY_MATCHES), Too many matches line %d. This means the query has returned several rows but the @@ -271,7 +271,7 @@ struct sqlca - -204, Not correctly formatted int type: %s line %d. + -204 (ECPG_INT_FORMAT), Not correctly formatted int type: %s line %d. This means the host variable is of type int and @@ -284,7 +284,7 @@ struct sqlca - -205, Not correctly formatted unsigned type: %s line %d. + -205 (ECPG_UINT_FORMAT), Not correctly formatted unsigned type: %s line %d. This means the host variable is of type unsigned @@ -298,7 +298,7 @@ struct sqlca - -206, Not correctly formatted floating point type: %s line %d. + -206 (ECPG_FLOAT_FORMAT), Not correctly formatted floating point type: %s line %d. This means the host variable is of type float and @@ -311,7 +311,7 @@ struct sqlca - -207, Unable to convert %s to bool on line %d. + -207 (ECPG_CONVERT_BOOL), Unable to convert %s to bool on line %d. This means the host variable is of type bool and @@ -322,7 +322,7 @@ struct sqlca - -208, Empty query line %d. + -208 (ECPG_EMPTY), Empty query line %d. Postgres returned PGRES_EMPTY_QUERY, probably @@ -332,7 +332,7 @@ struct sqlca - -209, NULL value without indicator in line %d. + -209 (ECPG_MISSING_INDICATOR), NULL value without indicator in line %d. Postgres returned ECPG_MISSING_INDICATOR @@ -342,7 +342,29 @@ struct sqlca - -220, No such connection %s in line %d. + -210 (ECPG_NO_ARRAY), Variable is not an array in line %d. + + + Postgres returned ECPG_NO_ARRAY + because an ordinary variable was used in a place that requires + an array. + + + + + + -211 (ECPG_DATA_NOT_ARRAY), Data read from backend is not an array in line %d. + + + Postgres returned ECPG_DATA_NOT_ARRAY + because the database returned an ordinary variable in a place + that requires array value. + + + + + + -220 (ECPG_NO_CONN), No such connection %s in line %d. The program tried to access a connection that does not exist. @@ -351,7 +373,7 @@ struct sqlca - -221, Not connected in line %d. + -221 (ECPG_NOT_CONN), Not connected in line %d. The program tried to access a connection that does exist but is @@ -361,7 +383,7 @@ struct sqlca - -230, Invalid statement name %s in line %d. + -230 (ECPG_INVALID_STMT), Invalid statement name %s in line %d. The statement you are trying to use has not been prepared. @@ -370,7 +392,54 @@ struct sqlca - -400, Postgres error: %s line %d. + -240 (ECPG_UNKNOWN_DESCRIPTOR), Descriptor %s not found in line %d. + + + The descriptor specified was not foundstatement you are trying to use has not been prepared. + + + + + + -241 (ECPG_INVALID_DESCRIPTOR_INDEX), Descriptor index out of range in line %d. + + + The descriptor index specified was out of range. + + + + + + -242 (ECPG_UNKNOWN_DESCRIPTOR_ITEM), Descriptor %s not found in line %d. + + + The descriptor specified was not foundstatement you are trying to use has not been prepared. + + + + + + -243 (ECPG_VAR_NOT_NUMERIC), Variable is not a numeric type in line %d. + + + The database returned a numeric value and the variable was not + numeric. + + + + + + -244 (ECPG_VAR_NOT_CHAR), Variable is not a character type in line %d. + + + The database returned a non-numeric value and the variable was + numeric. + + + + + + -400 (ECPG_PGSQL), Postgres error: %s line %d. Some Postgres error. @@ -381,7 +450,7 @@ struct sqlca - -401, Error in transaction processing line %d. + -401 (ECPG_TRANS), Error in transaction processing line %d. Postgres signaled that we cannot start, @@ -391,7 +460,7 @@ struct sqlca - -402, connect: could not open database %s. + -402 (ECPG_CONNECT), Could not connect to database %s in line %d. The connect to the database did not work. @@ -400,7 +469,7 @@ struct sqlca - 100, Data not found line %d. + 100 (ECPG_NOT_FOUND), Data not found line %d. This is a normal error that tells you that what you are querying cannot diff --git a/src/interfaces/ecpg/lib/error.c b/src/interfaces/ecpg/lib/error.c index 69b8e0d420..e39ee48c11 100644 --- a/src/interfaces/ecpg/lib/error.c +++ b/src/interfaces/ecpg/lib/error.c @@ -1,4 +1,4 @@ -/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/error.c,v 1.11 2001/10/05 17:37:07 meskes Exp $ */ +/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/error.c,v 1.12 2001/10/18 20:32:58 momjian Exp $ */ #include "postgres_fe.h" @@ -74,12 +74,12 @@ ECPGraise(int line, int code, const char *str) case ECPG_NO_ARRAY: snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc), - "variable is not an array in line %d.", line); + "Variable is not an array in line %d.", line); break; case ECPG_DATA_NOT_ARRAY: snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc), - "data read from backend is not an array in line %d.", line); + "Data read from backend is not an array in line %d.", line); break; case ECPG_NO_CONN: @@ -99,12 +99,12 @@ ECPGraise(int line, int code, const char *str) case ECPG_UNKNOWN_DESCRIPTOR: snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc), - "Sescriptor %s not found in line %d.", str, line); + "Descriptor %s not found in line %d.", str, line); break; case ECPG_INVALID_DESCRIPTOR_INDEX: snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc), - "Sescriptor index out of range in line %d.", line); + "Descriptor index out of range in line %d.", line); break; case ECPG_UNKNOWN_DESCRIPTOR_ITEM: