Skip to content

Commit 3b35a90

Browse files
committed
Message style review
1 parent 9187ced commit 3b35a90

File tree

8 files changed

+111
-122
lines changed

8 files changed

+111
-122
lines changed

src/interfaces/ecpg/preproc/descriptor.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* functions needed for descriptor handling
33
*
4-
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/descriptor.c,v 1.27 2008/05/16 15:20:04 petere Exp $
4+
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/descriptor.c,v 1.28 2009/01/23 12:43:32 petere Exp $
55
*
66
* since descriptor might be either a string constant or a string var
77
* we need to check for a constant if we expect a constant
@@ -61,7 +61,7 @@ ECPGnumeric_lvalue(char *name)
6161
fputs(name, yyout);
6262
break;
6363
default:
64-
mmerror(PARSE_ERROR, ET_ERROR, "variable %s: numeric type needed", name);
64+
mmerror(PARSE_ERROR, ET_ERROR, "variable \"%s\" must have a numeric type", name);
6565
break;
6666
}
6767
}
@@ -121,7 +121,7 @@ drop_descriptor(char *name, char *connection)
121121
}
122122
}
123123
}
124-
mmerror(PARSE_ERROR, ET_WARNING, "unknown descriptor %s", name);
124+
mmerror(PARSE_ERROR, ET_WARNING, "descriptor \"%s\" does not exist", name);
125125
}
126126

127127
struct descriptor
@@ -143,7 +143,7 @@ lookup_descriptor(char *name, char *connection)
143143
return i;
144144
}
145145
}
146-
mmerror(PARSE_ERROR, ET_WARNING, "unknown descriptor %s", name);
146+
mmerror(PARSE_ERROR, ET_WARNING, "descriptor \"%s\" does not exist", name);
147147
return NULL;
148148
}
149149

@@ -158,7 +158,7 @@ output_get_descr_header(char *desc_name)
158158
if (results->value == ECPGd_count)
159159
ECPGnumeric_lvalue(results->variable);
160160
else
161-
mmerror(PARSE_ERROR, ET_WARNING, "unknown descriptor header item \"%d\"", results->value);
161+
mmerror(PARSE_ERROR, ET_WARNING, "descriptor header item \"%d\" does not exist", results->value);
162162
}
163163

164164
drop_assignments();
@@ -207,7 +207,7 @@ output_set_descr_header(char *desc_name)
207207
if (results->value == ECPGd_count)
208208
ECPGnumeric_lvalue(results->variable);
209209
else
210-
mmerror(PARSE_ERROR, ET_WARNING, "unknown descriptor header item \"%d\"", results->value);
210+
mmerror(PARSE_ERROR, ET_WARNING, "descriptor header item \"%d\" does not exist", results->value);
211211
}
212212

213213
drop_assignments();
@@ -274,7 +274,7 @@ output_set_descr(char *desc_name, char *index)
274274
case ECPGd_di_precision:
275275
case ECPGd_precision:
276276
case ECPGd_scale:
277-
mmerror(PARSE_ERROR, ET_FATAL, "descriptor item %s is not implemented",
277+
mmerror(PARSE_ERROR, ET_FATAL, "descriptor item \"%s\" is not implemented",
278278
descriptor_item_name(results->value));
279279
break;
280280

@@ -284,7 +284,7 @@ output_set_descr(char *desc_name, char *index)
284284
case ECPGd_octet:
285285
case ECPGd_ret_length:
286286
case ECPGd_ret_octet:
287-
mmerror(PARSE_ERROR, ET_FATAL, "descriptor item %s cannot be set",
287+
mmerror(PARSE_ERROR, ET_FATAL, "descriptor item \"%s\" cannot be set",
288288
descriptor_item_name(results->value));
289289
break;
290290

src/interfaces/ecpg/preproc/ecpg.addons

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.2 2008/12/29 17:07:05 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.3 2009/01/23 12:43:32 petere Exp $ */
22

33
ECPG: stmtClosePortalStmt block
44
{
@@ -7,7 +7,7 @@ ECPG: stmtClosePortalStmt block
77
if (pg_strcasecmp($1+strlen("close "), "database") == 0)
88
{
99
if (connection)
10-
mmerror(PARSE_ERROR, ET_ERROR, "no at option for close database statement\n");
10+
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in CLOSE DATABASE statement");
1111

1212
fprintf(yyout, "{ ECPGdisconnect(__LINE__, \"CURRENT\");");
1313
whenever_action(2);
@@ -21,7 +21,7 @@ ECPG: stmtClosePortalStmt block
2121
ECPG: stmtDeallocateStmt block
2222
{
2323
if (connection)
24-
mmerror(PARSE_ERROR, ET_ERROR, "no at option for deallocate statement\n");
24+
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in DEALLOCATE statement");
2525

2626
output_deallocate_prepare_statement($1);
2727
}
@@ -59,7 +59,7 @@ ECPG: stmtViewStmt rule
5959
| ECPGConnect
6060
{
6161
if (connection)
62-
mmerror(PARSE_ERROR, ET_ERROR, "no at option for connect statement\n");
62+
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in CONNECT statement");
6363

6464
fprintf(yyout, "{ ECPGconnect(__LINE__, %d, %s, %d); ", compat, $1, autocommit);
6565
reset_variables();
@@ -73,7 +73,7 @@ ECPG: stmtViewStmt rule
7373
| ECPGDeallocateDescr
7474
{
7575
if (connection)
76-
mmerror(PARSE_ERROR, ET_ERROR, "no at option for deallocate statement\n");
76+
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in DEALLOCATE statement");
7777
fprintf(yyout,"ECPGdeallocate_desc(__LINE__, %s);",$1);
7878
whenever_action(0);
7979
free($1);
@@ -95,7 +95,7 @@ ECPG: stmtViewStmt rule
9595
| ECPGDisconnect
9696
{
9797
if (connection)
98-
mmerror(PARSE_ERROR, ET_ERROR, "no at option for disconnect statement\n");
98+
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in DISCONNECT statement");
9999

100100
fprintf(yyout, "{ ECPGdisconnect(__LINE__, %s);",
101101
$1 ? $1 : "\"CURRENT\"");
@@ -147,7 +147,7 @@ ECPG: stmtViewStmt rule
147147
| ECPGSetConnection
148148
{
149149
if (connection)
150-
mmerror(PARSE_ERROR, ET_ERROR, "no at option for set connection statement\n");
150+
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in SET CONNECTION statement");
151151

152152
fprintf(yyout, "{ ECPGsetconn(__LINE__, %s);", $1);
153153
whenever_action(2);
@@ -169,7 +169,7 @@ ECPG: stmtViewStmt rule
169169
| ECPGTypedef
170170
{
171171
if (connection)
172-
mmerror(PARSE_ERROR, ET_ERROR, "no at option for typedef statement\n");
172+
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in TYPE statement");
173173

174174
fprintf(yyout, "%s", $1);
175175
free($1);
@@ -178,33 +178,33 @@ ECPG: stmtViewStmt rule
178178
| ECPGVar
179179
{
180180
if (connection)
181-
mmerror(PARSE_ERROR, ET_ERROR, "no at option for var statement\n");
181+
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in VAR statement");
182182

183183
output_simple_statement($1);
184184
}
185185
| ECPGWhenever
186186
{
187187
if (connection)
188-
mmerror(PARSE_ERROR, ET_ERROR, "no at option for whenever statement\n");
188+
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in WHENEVER statement");
189189

190190
output_simple_statement($1);
191191
}
192192
ECPG: CopyStmtCOPYopt_binaryqualified_nameopt_column_listopt_oidscopy_fromcopy_file_namecopy_delimiteropt_withcopy_opt_list addon
193193
if (strcmp($6, "to") == 0 && strcmp($7, "stdin") == 0)
194-
mmerror(PARSE_ERROR, ET_ERROR, "copy to stdin not possible\n");
194+
mmerror(PARSE_ERROR, ET_ERROR, "COPY TO STDIN is not possible");
195195
else if (strcmp($6, "from") == 0 && strcmp($7, "stdout") == 0)
196-
mmerror(PARSE_ERROR, ET_ERROR, "copy from stdout not possible\n");
196+
mmerror(PARSE_ERROR, ET_ERROR, "COPY FROM STDOUT is not possible");
197197
else if (strcmp($6, "from") == 0 && strcmp($7, "stdin") == 0)
198-
mmerror(PARSE_ERROR, ET_WARNING, "copy from stdin not implemented\n");
198+
mmerror(PARSE_ERROR, ET_WARNING, "COPY FROM STDIN is not implemented");
199199
ECPG: CopyStmtCOPYselect_with_parensTOcopy_file_nameopt_withcopy_opt_list addon
200200
if (strcmp($4, "stdin") == 0)
201-
mmerror(PARSE_ERROR, ET_ERROR, "copy to stdin not possible\n");
201+
mmerror(PARSE_ERROR, ET_ERROR, "COPY TO STDIN is not possible");
202202
ECPG: ConstraintAttributeSpecConstraintDeferrabilitySpecConstraintTimeSpec addon
203203
if (strcmp($1, "deferrable") != 0 && strcmp($2, "initially deferrable") == 0 )
204-
mmerror(PARSE_ERROR, ET_ERROR, "INITIALLY DEFERRED constraint must be DEFERRABLE\n");
204+
mmerror(PARSE_ERROR, ET_ERROR, "constraint declared INITIALLY DEFERRED must be DEFERRABLE");
205205
ECPG: ConstraintAttributeSpecConstraintTimeSpecConstraintDeferrabilitySpec addon
206206
if (strcmp($2, "deferrable") != 0 && strcmp($1, "initially deferrable") == 0 )
207-
mmerror(PARSE_ERROR, ET_ERROR, "INITIALLY DEFERRED constraint must be DEFERRABLE\n");
207+
mmerror(PARSE_ERROR, ET_ERROR, "constraint declared INITIALLY DEFERRED must be DEFERRABLE");
208208
ECPG: var_valueNumericOnly addon
209209
ECPG: fetch_directionSignedIconst addon
210210
if ($1[0] == '$')
@@ -242,7 +242,7 @@ ECPG: DeclareCursorStmtDECLAREnamecursor_optionsCURSORopt_holdFORSelectStmt bloc
242242
for (ptr = cur; ptr != NULL; ptr = ptr->next)
243243
{
244244
if (strcmp($2, ptr->name) == 0)
245-
mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" already defined\n", $2);
245+
mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" is already defined", $2);
246246
}
247247

248248
this = (struct cursor *) mm_alloc(sizeof(struct cursor));
@@ -276,7 +276,7 @@ ECPG: into_clauseINTOOptTempTableName block
276276
}
277277
| ecpg_into { $$ = EMPTY; }
278278
ECPG: table_refselect_with_parens addon
279-
mmerror(PARSE_ERROR, ET_ERROR, "sub-SELECT in FROM must have an alias\n");
279+
mmerror(PARSE_ERROR, ET_ERROR, "subquery in FROM must have an alias");
280280
ECPG: TypenameSimpleTypenameopt_array_bounds block
281281
{ $$ = cat2_str($1, $2.str); }
282282
ECPG: TypenameSETOFSimpleTypenameopt_array_bounds block
@@ -323,7 +323,7 @@ ECPG: type_function_nametype_func_name_keyword rule
323323
| ECPGCKeywords { $$ = $1; }
324324
ECPG: VariableShowStmtSHOWALL block
325325
{
326-
mmerror(PARSE_ERROR, ET_ERROR, "SHOW ALL not implemented\n");
326+
mmerror(PARSE_ERROR, ET_ERROR, "SHOW ALL is not implemented");
327327
$$ = EMPTY;
328328
}
329329
ECPG: FetchStmtFETCHfetch_directionfrom_inname block
@@ -369,13 +369,13 @@ ECPG: FetchStmtMOVEname rule
369369
}
370370
ECPG: SpecialRuleRelationOLD addon
371371
if (!QueryIsRule)
372-
mmerror(PARSE_ERROR, ET_ERROR, "OLD used in non-rule query\n");
372+
mmerror(PARSE_ERROR, ET_ERROR, "OLD used in a query that is not in a rule");
373373
ECPG: SpecialRuleRelationNEW addon
374374
if (!QueryIsRule)
375-
mmerror(PARSE_ERROR, ET_ERROR, "NEW used in non-rule query\n");
375+
mmerror(PARSE_ERROR, ET_ERROR, "NEW used in a query that is not in a rule");
376376
ECPG: select_limitLIMITselect_limit_value','select_offset_value block
377377
{
378-
mmerror(PARSE_ERROR, ET_WARNING, "no longer supported LIMIT #,# syntax passed to backend");
378+
mmerror(PARSE_ERROR, ET_WARNING, "no longer supported LIMIT #,# syntax passed to server");
379379
$$ = cat_str(4, make_str("limit"), $2, make_str(","), $4);
380380
}
381381
ECPG: SignedIconstIconst rule

src/interfaces/ecpg/preproc/ecpg.c

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.106 2008/12/11 07:34:09 petere Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.107 2009/01/23 12:43:32 petere Exp $ */
22

33
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
44
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
@@ -40,9 +40,9 @@ help(const char *progname)
4040
progname);
4141
printf(_("Options:\n"));
4242
printf(_(" -c automatically generate C code from embedded SQL code;\n"
43-
" currently this works for EXEC SQL TYPE\n"));
44-
printf(_(" -C MODE set compatibility mode;\n"
45-
" MODE can be one of \"INFORMIX\", \"INFORMIX_SE\"\n"));
43+
" this affects EXEC SQL TYPE\n"));
44+
printf(_(" -C MODE set compatibility mode; MODE can be one of\n"
45+
" \"INFORMIX\", \"INFORMIX_SE\"\n"));
4646
#ifdef YYDEBUG
4747
printf(_(" -d generate parser debug output\n"));
4848
#endif
@@ -51,11 +51,8 @@ help(const char *progname)
5151
printf(_(" -i parse system include files as well\n"));
5252
printf(_(" -I DIRECTORY search DIRECTORY for include files\n"));
5353
printf(_(" -o OUTFILE write result to OUTFILE\n"));
54-
printf(_(" -r OPTION specify runtime behaviour;\n"
55-
" OPTION can be:\n"
56-
" \"no_indicator\"\n"
57-
" \"prepare\"\n"
58-
" \"questionmarks\"\n"));
54+
printf(_(" -r OPTION specify run-time behavior; OPTION can be:\n"
55+
" \"no_indicator\", \"prepare\", \"questionmarks\"\n"));
5956
printf(_(" -t turn on autocommit of transactions\n"));
6057
printf(_(" --help show this help, then exit\n"));
6158
printf(_(" --regression run in regression testing mode\n"));
@@ -266,7 +263,7 @@ main(int argc, char *const argv[])
266263
{
267264
fprintf(stderr, _("%s, the PostgreSQL embedded C preprocessor, version %d.%d.%d\n"),
268265
progname, MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL);
269-
fprintf(stderr, _("exec sql include ... search starts here:\n"));
266+
fprintf(stderr, _("EXEC SQL INCLUDE ... search starts here:\n"));
270267
for (ip = include_paths; ip != NULL; ip = ip->next)
271268
fprintf(stderr, " %s\n", ip->path);
272269
fprintf(stderr, _("end of search list\n"));
@@ -458,22 +455,14 @@ main(int argc, char *const argv[])
458455
/* and parse the source */
459456
base_yyparse();
460457

461-
/* check if all cursors were indeed opened */
462-
for (ptr = cur; ptr != NULL;)
463-
{
464-
char errortext[128];
465-
458+
/*
459+
* Check whether all cursors were indeed opened. It
460+
* does not really make sense to declare a cursor but
461+
* not open it.
462+
*/
463+
for (ptr = cur; ptr != NULL; ptr = ptr->next)
466464
if (!(ptr->opened))
467-
{
468-
/*
469-
* Does not really make sense to declare a cursor but
470-
* not open it
471-
*/
472-
snprintf(errortext, sizeof(errortext), _("cursor \"%s\" has been declared but not opened\n"), ptr->name);
473-
mmerror(PARSE_ERROR, ET_WARNING, errortext);
474-
}
475-
ptr = ptr->next;
476-
}
465+
mmerror(PARSE_ERROR, ET_WARNING, "cursor \"%s\" has been declared but not opened", ptr->name);
477466

478467
if (yyin != NULL && yyin != stdin)
479468
fclose(yyin);

src/interfaces/ecpg/preproc/ecpg.header

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.4 2008/12/29 17:07:05 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.5 2009/01/23 12:43:32 petere Exp $ */
22

33
/* Copyright comment */
44
%{
@@ -308,7 +308,7 @@ add_additional_variables(char *name, bool insert)
308308

309309
if (ptr == NULL)
310310
{
311-
mmerror(PARSE_ERROR, ET_ERROR, "trying to access an undeclared cursor \"%s\"\n", name);
311+
mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" does not exist", name);
312312
return NULL;
313313
}
314314

@@ -336,14 +336,14 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu
336336
if ((type_enum == ECPGt_struct ||
337337
type_enum == ECPGt_union) &&
338338
initializer == 1)
339-
mmerror(PARSE_ERROR, ET_ERROR, "initializer not allowed in typedef command");
339+
mmerror(PARSE_ERROR, ET_ERROR, "initializer not allowed in type definition");
340340
else
341341
{
342342
for (ptr = types; ptr != NULL; ptr = ptr->next)
343343
{
344344
if (strcmp(name, ptr->name) == 0)
345345
/* re-definition is a bug */
346-
mmerror(PARSE_ERROR, ET_ERROR, "type %s already defined", name);
346+
mmerror(PARSE_ERROR, ET_ERROR, "type \"%s\" is already defined", name);
347347
}
348348
adjust_array(type_enum, &dimension, &length, type_dimension, type_index, array, true);
349349

@@ -366,7 +366,7 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu
366366
type_enum != ECPGt_char &&
367367
type_enum != ECPGt_unsigned_char &&
368368
atoi(this->type->type_index) >= 0)
369-
mmerror(PARSE_ERROR, ET_ERROR, "no multidimensional array support for simple data types");
369+
mmerror(PARSE_ERROR, ET_ERROR, "multidimensional arrays for simple data types are not supported");
370370

371371
types = this;
372372
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy