Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3b35a90

Browse files
committed
Message style review
1 parent9187ced commit3b35a90

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 anumeric 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,"unknowndescriptor%s",name);
124+
mmerror(PARSE_ERROR,ET_WARNING,"descriptor\"%s\" does not exist",name);
125125
}
126126

127127
structdescriptor
@@ -143,7 +143,7 @@ lookup_descriptor(char *name, char *connection)
143143
returni;
144144
}
145145
}
146-
mmerror(PARSE_ERROR,ET_WARNING,"unknowndescriptor%s",name);
146+
mmerror(PARSE_ERROR,ET_WARNING,"descriptor\"%s\" does not exist",name);
147147
returnNULL;
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,"unknowndescriptor 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,"unknowndescriptor 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
caseECPGd_di_precision:
275275
caseECPGd_precision:
276276
caseECPGd_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
caseECPGd_octet:
285285
caseECPGd_ret_length:
286286
caseECPGd_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 atoptionfor close databasestatement\n");
10+
mmerror(PARSE_ERROR, ET_ERROR, "AToptionnot allowed in CLOSE DATABASEstatement");
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 atoptionfor deallocatestatement\n");
24+
mmerror(PARSE_ERROR, ET_ERROR, "AToptionnot allowed in DEALLOCATEstatement");
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 atoptionfor connectstatement\n");
62+
mmerror(PARSE_ERROR, ET_ERROR, "AToptionnot allowed in CONNECTstatement");
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 atoptionfor deallocatestatement\n");
76+
mmerror(PARSE_ERROR, ET_ERROR, "AToptionnot allowed in DEALLOCATEstatement");
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 atoptionfor disconnectstatement\n");
98+
mmerror(PARSE_ERROR, ET_ERROR, "AToptionnot allowed in DISCONNECTstatement");
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 atoptionfor set connectionstatement\n");
150+
mmerror(PARSE_ERROR, ET_ERROR, "AToptionnot allowed in SET CONNECTIONstatement");
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 atoptionfor typedefstatement\n");
172+
mmerror(PARSE_ERROR, ET_ERROR, "AToptionnot allowed in TYPEstatement");
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 atoptionfor varstatement\n");
181+
mmerror(PARSE_ERROR, ET_ERROR, "AToptionnot allowed in VARstatement");
182182

183183
output_simple_statement($1);
184184
}
185185
| ECPGWhenever
186186
{
187187
if (connection)
188-
mmerror(PARSE_ERROR, ET_ERROR, "no atoptionfor wheneverstatement\n");
188+
mmerror(PARSE_ERROR, ET_ERROR, "AToptionnot allowed in WHENEVERstatement");
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 stdinnot possible\n");
194+
mmerror(PARSE_ERROR, ET_ERROR, "COPY TO STDIN isnot possible");
195195
else if (strcmp($6, "from") == 0 && strcmp($7, "stdout") == 0)
196-
mmerror(PARSE_ERROR, ET_ERROR, "copy from stdoutnot possible\n");
196+
mmerror(PARSE_ERROR, ET_ERROR, "COPY FROM STDOUT isnot possible");
197197
else if (strcmp($6, "from") == 0 && strcmp($7, "stdin") == 0)
198-
mmerror(PARSE_ERROR, ET_WARNING, "copy from stdinnot implemented\n");
198+
mmerror(PARSE_ERROR, ET_WARNING, "COPY FROM STDIN isnot 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 stdinnot possible\n");
201+
mmerror(PARSE_ERROR, ET_ERROR, "COPY TO STDIN isnot possible");
202202
ECPG: ConstraintAttributeSpecConstraintDeferrabilitySpecConstraintTimeSpec addon
203203
if (strcmp($1, "deferrable") != 0 && strcmp($2, "initially deferrable") == 0 )
204-
mmerror(PARSE_ERROR, ET_ERROR, "INITIALLY DEFERREDconstraintmust be DEFERRABLE\n");
204+
mmerror(PARSE_ERROR, ET_ERROR, "constraint declaredINITIALLY 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 DEFERREDconstraintmust be DEFERRABLE\n");
207+
mmerror(PARSE_ERROR, ET_ERROR, "constraint declaredINITIALLY 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\"isalready 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 ALLisnot 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 innon-rule query\n");
372+
mmerror(PARSE_ERROR, ET_ERROR, "OLD used ina query that is not in a rule");
373373
ECPG: SpecialRuleRelationNEW addon
374374
if (!QueryIsRule)
375-
mmerror(PARSE_ERROR, ET_ERROR, "NEW used innon-rule query\n");
375+
mmerror(PARSE_ERROR, ET_ERROR, "NEW used ina 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 tobackend");
378+
mmerror(PARSE_ERROR, ET_WARNING, "no longer supported LIMIT #,# syntax passed toserver");
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-
"currentlythisworks for EXEC SQL TYPE\n"));
44-
printf(_(" -C MODE set compatibility mode;\n"
45-
" MODE can be one of \"INFORMIX\", \"INFORMIX_SE\"\n"));
43+
" thisaffects EXEC SQL TYPE\n"));
44+
printf(_(" -C MODE set compatibility mode; MODE can be one of\n"
45+
" \"INFORMIX\", \"INFORMIX_SE\"\n"));
4646
#ifdefYYDEBUG
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-
charerrortext[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 undeclaredcursor \"%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 intypedef command");
339+
mmerror(PARSE_ERROR, ET_ERROR, "initializer not allowed intype 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, "nomultidimensionalarray supportfor simple data types");
369+
mmerror(PARSE_ERROR, ET_ERROR, "multidimensionalarraysfor simple data types are not supported");
370370

371371
types = this;
372372
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp