Message style review

This commit is contained in:
Peter Eisentraut 2009-01-23 12:43:32 +00:00
parent 9187cedd7c
commit 3b35a904aa
8 changed files with 111 additions and 122 deletions

View File

@ -1,7 +1,7 @@
/*
* functions needed for descriptor handling
*
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/descriptor.c,v 1.27 2008/05/16 15:20:04 petere Exp $
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/descriptor.c,v 1.28 2009/01/23 12:43:32 petere Exp $
*
* since descriptor might be either a string constant or a string var
* we need to check for a constant if we expect a constant
@ -61,7 +61,7 @@ ECPGnumeric_lvalue(char *name)
fputs(name, yyout);
break;
default:
mmerror(PARSE_ERROR, ET_ERROR, "variable %s: numeric type needed", name);
mmerror(PARSE_ERROR, ET_ERROR, "variable \"%s\" must have a numeric type", name);
break;
}
}
@ -121,7 +121,7 @@ drop_descriptor(char *name, char *connection)
}
}
}
mmerror(PARSE_ERROR, ET_WARNING, "unknown descriptor %s", name);
mmerror(PARSE_ERROR, ET_WARNING, "descriptor \"%s\" does not exist", name);
}
struct descriptor
@ -143,7 +143,7 @@ lookup_descriptor(char *name, char *connection)
return i;
}
}
mmerror(PARSE_ERROR, ET_WARNING, "unknown descriptor %s", name);
mmerror(PARSE_ERROR, ET_WARNING, "descriptor \"%s\" does not exist", name);
return NULL;
}
@ -158,7 +158,7 @@ output_get_descr_header(char *desc_name)
if (results->value == ECPGd_count)
ECPGnumeric_lvalue(results->variable);
else
mmerror(PARSE_ERROR, ET_WARNING, "unknown descriptor header item \"%d\"", results->value);
mmerror(PARSE_ERROR, ET_WARNING, "descriptor header item \"%d\" does not exist", results->value);
}
drop_assignments();
@ -207,7 +207,7 @@ output_set_descr_header(char *desc_name)
if (results->value == ECPGd_count)
ECPGnumeric_lvalue(results->variable);
else
mmerror(PARSE_ERROR, ET_WARNING, "unknown descriptor header item \"%d\"", results->value);
mmerror(PARSE_ERROR, ET_WARNING, "descriptor header item \"%d\" does not exist", results->value);
}
drop_assignments();
@ -274,7 +274,7 @@ output_set_descr(char *desc_name, char *index)
case ECPGd_di_precision:
case ECPGd_precision:
case ECPGd_scale:
mmerror(PARSE_ERROR, ET_FATAL, "descriptor item %s is not implemented",
mmerror(PARSE_ERROR, ET_FATAL, "descriptor item \"%s\" is not implemented",
descriptor_item_name(results->value));
break;
@ -284,7 +284,7 @@ output_set_descr(char *desc_name, char *index)
case ECPGd_octet:
case ECPGd_ret_length:
case ECPGd_ret_octet:
mmerror(PARSE_ERROR, ET_FATAL, "descriptor item %s cannot be set",
mmerror(PARSE_ERROR, ET_FATAL, "descriptor item \"%s\" cannot be set",
descriptor_item_name(results->value));
break;

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.2 2008/12/29 17:07:05 meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.3 2009/01/23 12:43:32 petere Exp $ */
ECPG: stmtClosePortalStmt block
{
@ -7,7 +7,7 @@ ECPG: stmtClosePortalStmt block
if (pg_strcasecmp($1+strlen("close "), "database") == 0)
{
if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "no at option for close database statement\n");
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in CLOSE DATABASE statement");
fprintf(yyout, "{ ECPGdisconnect(__LINE__, \"CURRENT\");");
whenever_action(2);
@ -21,7 +21,7 @@ ECPG: stmtClosePortalStmt block
ECPG: stmtDeallocateStmt block
{
if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "no at option for deallocate statement\n");
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in DEALLOCATE statement");
output_deallocate_prepare_statement($1);
}
@ -59,7 +59,7 @@ ECPG: stmtViewStmt rule
| ECPGConnect
{
if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "no at option for connect statement\n");
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in CONNECT statement");
fprintf(yyout, "{ ECPGconnect(__LINE__, %d, %s, %d); ", compat, $1, autocommit);
reset_variables();
@ -73,7 +73,7 @@ ECPG: stmtViewStmt rule
| ECPGDeallocateDescr
{
if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "no at option for deallocate statement\n");
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in DEALLOCATE statement");
fprintf(yyout,"ECPGdeallocate_desc(__LINE__, %s);",$1);
whenever_action(0);
free($1);
@ -95,7 +95,7 @@ ECPG: stmtViewStmt rule
| ECPGDisconnect
{
if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "no at option for disconnect statement\n");
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in DISCONNECT statement");
fprintf(yyout, "{ ECPGdisconnect(__LINE__, %s);",
$1 ? $1 : "\"CURRENT\"");
@ -147,7 +147,7 @@ ECPG: stmtViewStmt rule
| ECPGSetConnection
{
if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "no at option for set connection statement\n");
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in SET CONNECTION statement");
fprintf(yyout, "{ ECPGsetconn(__LINE__, %s);", $1);
whenever_action(2);
@ -169,7 +169,7 @@ ECPG: stmtViewStmt rule
| ECPGTypedef
{
if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "no at option for typedef statement\n");
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in TYPE statement");
fprintf(yyout, "%s", $1);
free($1);
@ -178,33 +178,33 @@ ECPG: stmtViewStmt rule
| ECPGVar
{
if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "no at option for var statement\n");
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in VAR statement");
output_simple_statement($1);
}
| ECPGWhenever
{
if (connection)
mmerror(PARSE_ERROR, ET_ERROR, "no at option for whenever statement\n");
mmerror(PARSE_ERROR, ET_ERROR, "AT option not allowed in WHENEVER statement");
output_simple_statement($1);
}
ECPG: CopyStmtCOPYopt_binaryqualified_nameopt_column_listopt_oidscopy_fromcopy_file_namecopy_delimiteropt_withcopy_opt_list addon
if (strcmp($6, "to") == 0 && strcmp($7, "stdin") == 0)
mmerror(PARSE_ERROR, ET_ERROR, "copy to stdin not possible\n");
mmerror(PARSE_ERROR, ET_ERROR, "COPY TO STDIN is not possible");
else if (strcmp($6, "from") == 0 && strcmp($7, "stdout") == 0)
mmerror(PARSE_ERROR, ET_ERROR, "copy from stdout not possible\n");
mmerror(PARSE_ERROR, ET_ERROR, "COPY FROM STDOUT is not possible");
else if (strcmp($6, "from") == 0 && strcmp($7, "stdin") == 0)
mmerror(PARSE_ERROR, ET_WARNING, "copy from stdin not implemented\n");
mmerror(PARSE_ERROR, ET_WARNING, "COPY FROM STDIN is not implemented");
ECPG: CopyStmtCOPYselect_with_parensTOcopy_file_nameopt_withcopy_opt_list addon
if (strcmp($4, "stdin") == 0)
mmerror(PARSE_ERROR, ET_ERROR, "copy to stdin not possible\n");
mmerror(PARSE_ERROR, ET_ERROR, "COPY TO STDIN is not possible");
ECPG: ConstraintAttributeSpecConstraintDeferrabilitySpecConstraintTimeSpec addon
if (strcmp($1, "deferrable") != 0 && strcmp($2, "initially deferrable") == 0 )
mmerror(PARSE_ERROR, ET_ERROR, "INITIALLY DEFERRED constraint must be DEFERRABLE\n");
mmerror(PARSE_ERROR, ET_ERROR, "constraint declared INITIALLY DEFERRED must be DEFERRABLE");
ECPG: ConstraintAttributeSpecConstraintTimeSpecConstraintDeferrabilitySpec addon
if (strcmp($2, "deferrable") != 0 && strcmp($1, "initially deferrable") == 0 )
mmerror(PARSE_ERROR, ET_ERROR, "INITIALLY DEFERRED constraint must be DEFERRABLE\n");
mmerror(PARSE_ERROR, ET_ERROR, "constraint declared INITIALLY DEFERRED must be DEFERRABLE");
ECPG: var_valueNumericOnly addon
ECPG: fetch_directionSignedIconst addon
if ($1[0] == '$')
@ -242,7 +242,7 @@ ECPG: DeclareCursorStmtDECLAREnamecursor_optionsCURSORopt_holdFORSelectStmt bloc
for (ptr = cur; ptr != NULL; ptr = ptr->next)
{
if (strcmp($2, ptr->name) == 0)
mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" already defined\n", $2);
mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" is already defined", $2);
}
this = (struct cursor *) mm_alloc(sizeof(struct cursor));
@ -276,7 +276,7 @@ ECPG: into_clauseINTOOptTempTableName block
}
| ecpg_into { $$ = EMPTY; }
ECPG: table_refselect_with_parens addon
mmerror(PARSE_ERROR, ET_ERROR, "sub-SELECT in FROM must have an alias\n");
mmerror(PARSE_ERROR, ET_ERROR, "subquery in FROM must have an alias");
ECPG: TypenameSimpleTypenameopt_array_bounds block
{ $$ = cat2_str($1, $2.str); }
ECPG: TypenameSETOFSimpleTypenameopt_array_bounds block
@ -323,7 +323,7 @@ ECPG: type_function_nametype_func_name_keyword rule
| ECPGCKeywords { $$ = $1; }
ECPG: VariableShowStmtSHOWALL block
{
mmerror(PARSE_ERROR, ET_ERROR, "SHOW ALL not implemented\n");
mmerror(PARSE_ERROR, ET_ERROR, "SHOW ALL is not implemented");
$$ = EMPTY;
}
ECPG: FetchStmtFETCHfetch_directionfrom_inname block
@ -369,13 +369,13 @@ ECPG: FetchStmtMOVEname rule
}
ECPG: SpecialRuleRelationOLD addon
if (!QueryIsRule)
mmerror(PARSE_ERROR, ET_ERROR, "OLD used in non-rule query\n");
mmerror(PARSE_ERROR, ET_ERROR, "OLD used in a query that is not in a rule");
ECPG: SpecialRuleRelationNEW addon
if (!QueryIsRule)
mmerror(PARSE_ERROR, ET_ERROR, "NEW used in non-rule query\n");
mmerror(PARSE_ERROR, ET_ERROR, "NEW used in a query that is not in a rule");
ECPG: select_limitLIMITselect_limit_value','select_offset_value block
{
mmerror(PARSE_ERROR, ET_WARNING, "no longer supported LIMIT #,# syntax passed to backend");
mmerror(PARSE_ERROR, ET_WARNING, "no longer supported LIMIT #,# syntax passed to server");
$$ = cat_str(4, make_str("limit"), $2, make_str(","), $4);
}
ECPG: SignedIconstIconst rule

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.106 2008/12/11 07:34:09 petere Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.107 2009/01/23 12:43:32 petere Exp $ */
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
@ -40,9 +40,9 @@ help(const char *progname)
progname);
printf(_("Options:\n"));
printf(_(" -c automatically generate C code from embedded SQL code;\n"
" currently this works for EXEC SQL TYPE\n"));
printf(_(" -C MODE set compatibility mode;\n"
" MODE can be one of \"INFORMIX\", \"INFORMIX_SE\"\n"));
" this affects EXEC SQL TYPE\n"));
printf(_(" -C MODE set compatibility mode; MODE can be one of\n"
" \"INFORMIX\", \"INFORMIX_SE\"\n"));
#ifdef YYDEBUG
printf(_(" -d generate parser debug output\n"));
#endif
@ -51,11 +51,8 @@ help(const char *progname)
printf(_(" -i parse system include files as well\n"));
printf(_(" -I DIRECTORY search DIRECTORY for include files\n"));
printf(_(" -o OUTFILE write result to OUTFILE\n"));
printf(_(" -r OPTION specify runtime behaviour;\n"
" OPTION can be:\n"
" \"no_indicator\"\n"
" \"prepare\"\n"
" \"questionmarks\"\n"));
printf(_(" -r OPTION specify run-time behavior; OPTION can be:\n"
" \"no_indicator\", \"prepare\", \"questionmarks\"\n"));
printf(_(" -t turn on autocommit of transactions\n"));
printf(_(" --help show this help, then exit\n"));
printf(_(" --regression run in regression testing mode\n"));
@ -266,7 +263,7 @@ main(int argc, char *const argv[])
{
fprintf(stderr, _("%s, the PostgreSQL embedded C preprocessor, version %d.%d.%d\n"),
progname, MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL);
fprintf(stderr, _("exec sql include ... search starts here:\n"));
fprintf(stderr, _("EXEC SQL INCLUDE ... search starts here:\n"));
for (ip = include_paths; ip != NULL; ip = ip->next)
fprintf(stderr, " %s\n", ip->path);
fprintf(stderr, _("end of search list\n"));
@ -458,22 +455,14 @@ main(int argc, char *const argv[])
/* and parse the source */
base_yyparse();
/* check if all cursors were indeed opened */
for (ptr = cur; ptr != NULL;)
{
char errortext[128];
/*
* Check whether all cursors were indeed opened. It
* does not really make sense to declare a cursor but
* not open it.
*/
for (ptr = cur; ptr != NULL; ptr = ptr->next)
if (!(ptr->opened))
{
/*
* Does not really make sense to declare a cursor but
* not open it
*/
snprintf(errortext, sizeof(errortext), _("cursor \"%s\" has been declared but not opened\n"), ptr->name);
mmerror(PARSE_ERROR, ET_WARNING, errortext);
}
ptr = ptr->next;
}
mmerror(PARSE_ERROR, ET_WARNING, "cursor \"%s\" has been declared but not opened", ptr->name);
if (yyin != NULL && yyin != stdin)
fclose(yyin);

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.4 2008/12/29 17:07:05 meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.5 2009/01/23 12:43:32 petere Exp $ */
/* Copyright comment */
%{
@ -308,7 +308,7 @@ add_additional_variables(char *name, bool insert)
if (ptr == NULL)
{
mmerror(PARSE_ERROR, ET_ERROR, "trying to access an undeclared cursor \"%s\"\n", name);
mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" does not exist", name);
return NULL;
}
@ -336,14 +336,14 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu
if ((type_enum == ECPGt_struct ||
type_enum == ECPGt_union) &&
initializer == 1)
mmerror(PARSE_ERROR, ET_ERROR, "initializer not allowed in typedef command");
mmerror(PARSE_ERROR, ET_ERROR, "initializer not allowed in type definition");
else
{
for (ptr = types; ptr != NULL; ptr = ptr->next)
{
if (strcmp(name, ptr->name) == 0)
/* re-definition is a bug */
mmerror(PARSE_ERROR, ET_ERROR, "type %s already defined", name);
mmerror(PARSE_ERROR, ET_ERROR, "type \"%s\" is already defined", name);
}
adjust_array(type_enum, &dimension, &length, type_dimension, type_index, array, true);
@ -366,7 +366,7 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu
type_enum != ECPGt_char &&
type_enum != ECPGt_unsigned_char &&
atoi(this->type->type_index) >= 0)
mmerror(PARSE_ERROR, ET_ERROR, "no multidimensional array support for simple data types");
mmerror(PARSE_ERROR, ET_ERROR, "multidimensional arrays for simple data types are not supported");
types = this;
}

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.3 2008/12/12 12:14:43 meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.4 2009/01/23 12:43:32 petere Exp $ */
statements: /*EMPTY*/
| statements statement
@ -22,7 +22,7 @@ statement: ecpgstart at stmt ';' { connection = NULL; }
CreateAsStmt: CREATE OptTemp TABLE create_as_target AS {FoundInto = 0;} SelectStmt opt_with_data
{
if (FoundInto == 1)
mmerror(PARSE_ERROR, ET_ERROR, "CREATE TABLE / AS SELECT cannot specify INTO\n");
mmerror(PARSE_ERROR, ET_ERROR, "CREATE TABLE AS cannot specify INTO\n");
$$ = cat_str(6, make_str("create"), $2, make_str("table"), $4, make_str("as"), $7);
}
@ -89,7 +89,7 @@ connection_target: opt_database_name opt_server opt_port
if (strncmp($1, "unix", strlen("unix")) == 0 &&
strncmp($3 + strlen("//"), "localhost", strlen("localhost")) != 0 &&
strncmp($3 + strlen("//"), "127.0.0.1", strlen("127.0.0.1")) != 0)
mmerror(PARSE_ERROR, ET_ERROR, "unix domain sockets only work on \"localhost\" but not on \"%s\"", $3 + strlen("//"));
mmerror(PARSE_ERROR, ET_ERROR, "Unix-domain sockets only work on \"localhost\" but not on \"%s\"", $3 + strlen("//"));
$$ = make3_str(make3_str(make_str("\""), $1, make_str(":")), $3, make3_str(make3_str($4, make_str("/"), $6), $7, make_str("\"")));
}
@ -118,7 +118,7 @@ db_prefix: ecpg_ident cvariable
mmerror(PARSE_ERROR, ET_ERROR, "expected \"postgresql\", found \"%s\"", $2);
if (strcmp($1, "tcp") != 0 && strcmp($1, "unix") != 0)
mmerror(PARSE_ERROR, ET_ERROR, "illegal connection type %s", $1);
mmerror(PARSE_ERROR, ET_ERROR, "invalid connection type: %s", $1);
$$ = make3_str($1, make_str(":"), $2);
}
@ -202,7 +202,7 @@ char_variable: cvariable
/* If we have just one character this is not a string */
if (atol(p->type->size) == 1)
mmerror(PARSE_ERROR, ET_ERROR, "invalid datatype");
mmerror(PARSE_ERROR, ET_ERROR, "invalid data type");
else
{
/* if array see what's inside */
@ -219,7 +219,7 @@ char_variable: cvariable
$$ = make2_str($1, make_str(".arr"));
break;
default:
mmerror(PARSE_ERROR, ET_ERROR, "invalid datatype");
mmerror(PARSE_ERROR, ET_ERROR, "invalid data type");
$$ = $1;
break;
}
@ -1000,21 +1000,21 @@ UsingConst: Iconst { $$ = $1; }
ECPGDescribe: SQL_DESCRIBE INPUT_P name using_descriptor
{
const char *con = connection ? connection : "NULL";
mmerror(PARSE_ERROR, ET_WARNING, "using unsupported describe statement\n");
mmerror(PARSE_ERROR, ET_WARNING, "using unsupported DESCRIBE statement");
$$ = (char *) mm_alloc(sizeof("1, ECPGprepared_statement(, \"\", __LINE__)") + strlen(con) + strlen($3));
sprintf($$, "1, ECPGprepared_statement(%s, \"%s\", __LINE__)", con, $3);
}
| SQL_DESCRIBE opt_output name using_descriptor
{
const char *con = connection ? connection : "NULL";
mmerror(PARSE_ERROR, ET_WARNING, "using unsupported describe statement\n");
mmerror(PARSE_ERROR, ET_WARNING, "using unsupported DESCRIBE statement");
$$ = (char *) mm_alloc(sizeof("0, ECPGprepared_statement(, \"\", __LINE__)") + strlen(con) + strlen($3));
sprintf($$, "0, ECPGprepared_statement(%s, \"%s\", __LINE__)", con, $3);
}
| SQL_DESCRIBE opt_output name into_descriptor
{
const char *con = connection ? connection : "NULL";
mmerror(PARSE_ERROR, ET_WARNING, "using unsupported describe statement\n");
mmerror(PARSE_ERROR, ET_WARNING, "using unsupported DESCRIBE statement");
$$ = (char *) mm_alloc(sizeof("0, ECPGprepared_statement(, \"\", __LINE__)") + strlen(con) + strlen($3));
sprintf($$, "0, ECPGprepared_statement(%s, \"%s\", __LINE__)", con, $3);
}

View File

@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.168 2009/01/01 17:24:02 momjian Exp $
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.169 2009/01/23 12:43:32 petere Exp $
*
*-------------------------------------------------------------------------
*/
@ -396,7 +396,7 @@ cppline {space}*#(.*\\{space})*.*{newline}
yyless(1);
BEGIN(SQL);
if (literalbuf[strspn(literalbuf, "01") + 1] != '\0')
mmerror(PARSE_ERROR, ET_ERROR, "invalid bit string input");
mmerror(PARSE_ERROR, ET_ERROR, "invalid bit string literal");
yylval.str = mm_strdup(literalbuf);
return BCONST;
}
@ -405,7 +405,7 @@ cppline {space}*#(.*\\{space})*.*{newline}
<xb>{xbinside} { addlit(yytext, yyleng); }
<xh>{quotecontinue} |
<xb>{quotecontinue} { /* ignore */ }
<xb><<EOF>> { mmerror(PARSE_ERROR, ET_FATAL, "unterminated bit string"); }
<xb><<EOF>> { mmerror(PARSE_ERROR, ET_FATAL, "unterminated bit string literal"); }
<SQL>{xhstart} {
token_start = yytext;
@ -421,7 +421,7 @@ cppline {space}*#(.*\\{space})*.*{newline}
return XCONST;
}
<xh><<EOF>> { mmerror(PARSE_ERROR, ET_FATAL, "unterminated hexadecimal integer"); }
<xh><<EOF>> { mmerror(PARSE_ERROR, ET_FATAL, "unterminated hexadecimal string literal"); }
<SQL>{xnstart} {
/* National character.
* Transfer it as-is to the backend.
@ -554,7 +554,7 @@ cppline {space}*#(.*\\{space})*.*{newline}
BEGIN(state_before);
if (literallen == 0)
mmerror(PARSE_ERROR, ET_ERROR, "zero-length delimited identifier");
/* The backend will truncate the idnetifier here. We do not as it does not change the result. */
/* The backend will truncate the identifier here. We do not as it does not change the result. */
yylval.str = mm_strdup(literalbuf);
return CSTRING;
}
@ -567,7 +567,7 @@ cppline {space}*#(.*\\{space})*.*{newline}
BEGIN(state_before);
if (literallen == 2) /* "U&" */
mmerror(PARSE_ERROR, ET_ERROR, "zero-length delimited identifier");
/* The backend will truncate the idnetifier here. We do not as it does not change the result. */
/* The backend will truncate the identifier here. We do not as it does not change the result. */
addlit(yytext, yyleng);
yylval.str = mm_strdup(literalbuf);
return UIDENT;
@ -895,7 +895,7 @@ cppline {space}*#(.*\\{space})*.*{newline}
BEGIN(C);
}
<undef>{other}|\n {
mmerror(PARSE_ERROR, ET_FATAL, "missing identifier in 'EXEC SQL UNDEF' command");
mmerror(PARSE_ERROR, ET_FATAL, "missing identifier in EXEC SQL UNDEF command");
yyterminate();
}
<C>{exec_sql}{include}{space}* { BEGIN(incl); }
@ -941,10 +941,10 @@ cppline {space}*#(.*\\{space})*.*{newline}
}
<C,xskip>{exec_sql}{elif}{space}* { /* pop stack */
if ( preproc_tos == 0 ) {
mmerror(PARSE_ERROR, ET_FATAL, "missing matching 'EXEC SQL IFDEF / EXEC SQL IFNDEF'");
mmerror(PARSE_ERROR, ET_FATAL, "missing matching \"EXEC SQL IFDEF\" / \"EXEC SQL IFNDEF\"");
}
else if ( stacked_if_value[preproc_tos].else_branch )
mmerror(PARSE_ERROR, ET_FATAL, "missing 'EXEC SQL ENDIF;'");
mmerror(PARSE_ERROR, ET_FATAL, "missing \"EXEC SQL ENDIF;\"");
else
preproc_tos--;
@ -955,9 +955,9 @@ cppline {space}*#(.*\\{space})*.*{newline}
if (INFORMIX_MODE)
{
if (preproc_tos == 0)
mmerror(PARSE_ERROR, ET_FATAL, "missing matching 'EXEC SQL IFDEF / EXEC SQL IFNDEF'");
mmerror(PARSE_ERROR, ET_FATAL, "missing matching \"EXEC SQL IFDEF\" / \"EXEC SQL IFNDEF\"");
else if (stacked_if_value[preproc_tos].else_branch)
mmerror(PARSE_ERROR, ET_FATAL, "missing 'EXEC SQL ENDIF;'");
mmerror(PARSE_ERROR, ET_FATAL, "missing \"EXEC SQL ENDIF;\"");
else
preproc_tos--;
@ -973,7 +973,7 @@ cppline {space}*#(.*\\{space})*.*{newline}
<C,xskip>{exec_sql}{else}{space}*";" { /* only exec sql endif pops the stack, so take care of duplicated 'else' */
if (stacked_if_value[preproc_tos].else_branch)
mmerror(PARSE_ERROR, ET_FATAL, "duplicated 'EXEC SQL ELSE;'");
mmerror(PARSE_ERROR, ET_FATAL, "more than one EXEC SQL ELSE");
else
{
stacked_if_value[preproc_tos].else_branch = TRUE;
@ -992,7 +992,7 @@ cppline {space}*#(.*\\{space})*.*{newline}
if (INFORMIX_MODE)
{
if (stacked_if_value[preproc_tos].else_branch)
mmerror(PARSE_ERROR, ET_FATAL, "duplicated 'EXEC SQL ELSE;'");
mmerror(PARSE_ERROR, ET_FATAL, "more than one EXEC SQL ELSE");
else
{
stacked_if_value[preproc_tos].else_branch = TRUE;
@ -1014,7 +1014,7 @@ cppline {space}*#(.*\\{space})*.*{newline}
}
<C,xskip>{exec_sql}{endif}{space}*";" {
if (preproc_tos == 0)
mmerror(PARSE_ERROR, ET_FATAL, "unmatched 'EXEC SQL ENDIF;'");
mmerror(PARSE_ERROR, ET_FATAL, "unmatched EXEC SQL ENDIF");
else
preproc_tos--;
@ -1028,7 +1028,7 @@ cppline {space}*#(.*\\{space})*.*{newline}
if (INFORMIX_MODE)
{
if (preproc_tos == 0)
mmerror(PARSE_ERROR, ET_FATAL, "unmatched 'EXEC SQL ENDIF;'");
mmerror(PARSE_ERROR, ET_FATAL, "unmatched EXEC SQL ENDIF");
else
preproc_tos--;
@ -1048,7 +1048,7 @@ cppline {space}*#(.*\\{space})*.*{newline}
<xcond>{identifier}{space}*";" {
if (preproc_tos >= MAX_NESTED_IF-1)
mmerror(PARSE_ERROR, ET_FATAL, "too many nested 'EXEC SQL IFDEF' conditions");
mmerror(PARSE_ERROR, ET_FATAL, "too many nested EXEC SQL IFDEF conditions");
else
{
struct _defines *defptr;
@ -1081,7 +1081,7 @@ cppline {space}*#(.*\\{space})*.*{newline}
}
<xcond>{other}|\n {
mmerror(PARSE_ERROR, ET_FATAL, "missing identifier in 'EXEC SQL IFDEF' command");
mmerror(PARSE_ERROR, ET_FATAL, "missing identifier in EXEC SQL IFDEF command");
yyterminate();
}
<def_ident>{identifier} {
@ -1090,7 +1090,7 @@ cppline {space}*#(.*\\{space})*.*{newline}
startlit();
}
<def_ident>{other}|\n {
mmerror(PARSE_ERROR, ET_FATAL, "missing identifier in 'EXEC SQL DEFINE' command");
mmerror(PARSE_ERROR, ET_FATAL, "missing identifier in EXEC SQL DEFINE command");
yyterminate();
}
<def>{space}*";" {
@ -1123,7 +1123,7 @@ cppline {space}*#(.*\\{space})*.*{newline}
<incl>{dquote}{xdinside}{dquote}{space}*";"? { parse_include(); }
<incl>[^;\<\>\"]+";" { parse_include(); }
<incl>{other}|\n {
mmerror(PARSE_ERROR, ET_FATAL, "incorrect 'EXEC SQL INCLUDE' command");
mmerror(PARSE_ERROR, ET_FATAL, "syntax error in EXEC SQL INCLUDE command");
yyterminate();
}
@ -1133,7 +1133,7 @@ cppline {space}*#(.*\\{space})*.*{newline}
if ( preproc_tos > 0 )
{
preproc_tos = 0;
mmerror(PARSE_ERROR, ET_FATAL, "missing 'EXEC SQL ENDIF;'");
mmerror(PARSE_ERROR, ET_FATAL, "missing \"EXEC SQL ENDIF;\"");
}
yyterminate();
}
@ -1172,7 +1172,7 @@ cppline {space}*#(.*\\{space})*.*{newline}
}
}
<INITIAL>{other}|\n { mmerror(PARSE_ERROR, ET_FATAL, "Internal error: unreachable state, please report this to <pgsql-bugs@postgresql.org>"); }
<INITIAL>{other}|\n { mmerror(PARSE_ERROR, ET_FATAL, "internal error: unreachable state; please report this to <pgsql-bugs@postgresql.org>"); }
%%
void
lex_init(void)
@ -1294,7 +1294,7 @@ parse_include(void)
{
if (strlen(ip->path) + strlen(yytext) + 3 > MAXPGPATH)
{
fprintf(stderr, _("Error: Path %s/%s is too long on line %d, skipping\n"), ip->path, yytext, yylineno);
fprintf(stderr, _("Error: include path \"%s/%s\" is too long on line %d, skipping\n"), ip->path, yytext, yylineno);
continue;
}
snprintf (inc_file, sizeof(inc_file), "%s/%s", ip->path, yytext);
@ -1310,7 +1310,7 @@ parse_include(void)
}
}
if (!yyin)
mmerror(NO_INCLUDE_FILE, ET_FATAL, "cannot open include file \"%s\" on line %d\n", yytext, yylineno);
mmerror(NO_INCLUDE_FILE, ET_FATAL, "could not open include file \"%s\" on line %d", yytext, yylineno);
input_filename = mm_strdup(inc_file);
yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE ));

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.81 2008/11/26 15:35:30 meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.82 2009/01/23 12:43:32 petere Exp $ */
#include "postgres_fe.h"
@ -15,7 +15,7 @@ mm_alloc(size_t size)
void *ptr = malloc(size);
if (ptr == NULL)
mmerror(OUT_OF_MEMORY, ET_FATAL, "out of memory\n");
mmerror(OUT_OF_MEMORY, ET_FATAL, "out of memory");
return ptr;
}
@ -27,7 +27,7 @@ mm_strdup(const char *string)
char *new = strdup(string);
if (new == NULL)
mmerror(OUT_OF_MEMORY, ET_FATAL, "out of memory\n");
mmerror(OUT_OF_MEMORY, ET_FATAL, "out of memory");
return new;
}
@ -201,7 +201,7 @@ get_type(enum ECPGttype type)
return ("ECPGt_timestamp");
break;
default:
mmerror(PARSE_ERROR, ET_ERROR, "illegal variable type %d\n", type);
mmerror(PARSE_ERROR, ET_ERROR, "unrecognized variable type code %d", type);
}
return NULL;
@ -238,11 +238,11 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type,
{
case ECPGt_array:
if (indicator_set && ind_type->type != ECPGt_array)
mmerror(INDICATOR_NOT_ARRAY, ET_FATAL, "indicator for array/pointer has to be array/pointer\n");
mmerror(INDICATOR_NOT_ARRAY, ET_FATAL, "indicator for array/pointer has to be array/pointer");
switch (type->u.element->type)
{
case ECPGt_array:
mmerror(PARSE_ERROR, ET_ERROR, "no nested arrays allowed (except strings)"); /* array of array */
mmerror(PARSE_ERROR, ET_ERROR, "nested arrays are not supported (except strings)"); /* array of array */
break;
case ECPGt_struct:
case ECPGt_union:
@ -275,7 +275,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type,
break;
case ECPGt_struct:
if (indicator_set && ind_type->type != ECPGt_struct)
mmerror(INDICATOR_NOT_STRUCT, ET_FATAL, "indicator for struct has to be struct\n");
mmerror(INDICATOR_NOT_STRUCT, ET_FATAL, "indicator for struct has to be a struct");
ECPGdump_a_struct(o, name, ind_name, make_str("1"), type, ind_type, NULL, prefix, ind_prefix);
break;
@ -284,7 +284,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type,
break;
case ECPGt_char_variable:
if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array))
mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "indicator for simple datatype has to be simple\n");
mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "indicator for simple data type has to be simple");
ECPGdump_a_simple(o, name, type->type, make_str("1"), (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : make_str("1"), struct_sizeof, prefix, 0);
if (ind_type != NULL)
@ -292,7 +292,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type,
break;
case ECPGt_descriptor:
if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array))
mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "indicator for simple datatype has to be simple\n");
mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "indicator for simple data type has to be simple");
ECPGdump_a_simple(o, name, type->type, NULL, make_str("-1"), NULL, prefix, 0);
if (ind_type != NULL)
@ -300,7 +300,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type,
break;
default:
if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array))
mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "indicator for simple datatype has to be simple\n");
mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "indicator for simple data type has to be simple");
ECPGdump_a_simple(o, name, type->type, type->size, (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : make_str("-1"), struct_sizeof, prefix, type->lineno);
if (ind_type != NULL)
@ -551,7 +551,7 @@ ECPGfree_type(struct ECPGtype * type)
ECPGfree_struct_member(type->u.members);
break;
default:
mmerror(PARSE_ERROR, ET_ERROR, "illegal variable type %d\n", type->type);
mmerror(PARSE_ERROR, ET_ERROR, "unrecognized variable type code %d", type->type);
break;
}
}
@ -610,7 +610,7 @@ get_dtype(enum ECPGdtype type)
case ECPGd_cardinality:
return ("ECPGd_cardinality");
default:
mmerror(PARSE_ERROR, ET_ERROR, "illegal descriptor item %d\n", type);
mmerror(PARSE_ERROR, ET_ERROR, "unrecognized descriptor item code %d", type);
}
return NULL;

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/variable.c,v 1.45 2008/05/16 15:20:04 petere Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/variable.c,v 1.46 2009/01/23 12:43:32 petere Exp $ */
#include "postgres_fe.h"
@ -86,7 +86,7 @@ find_struct_member(char *name, char *str, struct ECPGstruct_member * members, in
case '\0': /* found the end, but this time it has to be
* an array element */
if (members->type->type != ECPGt_array)
mmerror(PARSE_ERROR, ET_FATAL, "incorrectly formed variable %s", name);
mmerror(PARSE_ERROR, ET_FATAL, "incorrectly formed variable \"%s\"", name);
switch (members->type->u.element->type)
{
@ -109,7 +109,7 @@ find_struct_member(char *name, char *str, struct ECPGstruct_member * members, in
return (find_struct_member(name, end, members->type->u.members, brace_level));
break;
default:
mmerror(PARSE_ERROR, ET_FATAL, "incorrectly formed variable %s", name);
mmerror(PARSE_ERROR, ET_FATAL, "incorrectly formed variable \"%s\"", name);
break;
}
}
@ -132,10 +132,10 @@ find_struct(char *name, char *next, char *end)
if (c == '-')
{
if (p->type->type != ECPGt_array)
mmerror(PARSE_ERROR, ET_FATAL, "variable %s is not a pointer", name);
mmerror(PARSE_ERROR, ET_FATAL, "variable \"%s\" is not a pointer", name);
if (p->type->u.element->type != ECPGt_struct && p->type->u.element->type != ECPGt_union)
mmerror(PARSE_ERROR, ET_FATAL, "variable %s is not a pointer to a structure or a union", name);
mmerror(PARSE_ERROR, ET_FATAL, "variable \"%s\" is not a pointer to a structure or a union", name);
/* restore the name, we will need it later */
*next = c;
@ -147,7 +147,7 @@ find_struct(char *name, char *next, char *end)
if (next == end)
{
if (p->type->type != ECPGt_struct && p->type->type != ECPGt_union)
mmerror(PARSE_ERROR, ET_FATAL, "variable %s is neither a structure nor a union", name);
mmerror(PARSE_ERROR, ET_FATAL, "variable \"%s\" is neither a structure nor a union", name);
/* restore the name, we will need it later */
*next = c;
@ -157,10 +157,10 @@ find_struct(char *name, char *next, char *end)
else
{
if (p->type->type != ECPGt_array)
mmerror(PARSE_ERROR, ET_FATAL, "variable %s is not an array", name);
mmerror(PARSE_ERROR, ET_FATAL, "variable \"%s\" is not an array", name);
if (p->type->u.element->type != ECPGt_struct && p->type->u.element->type != ECPGt_union)
mmerror(PARSE_ERROR, ET_FATAL, "variable %s is not a pointer to a structure or a union", name);
mmerror(PARSE_ERROR, ET_FATAL, "variable \"%s\" is not a pointer to a structure or a union", name);
/* restore the name, we will need it later */
*next = c;
@ -456,7 +456,7 @@ check_indicator(struct ECPGtype * var)
check_indicator(var->u.element);
break;
default:
mmerror(PARSE_ERROR, ET_ERROR, "indicator variable must be integer type");
mmerror(PARSE_ERROR, ET_ERROR, "indicator variable must have an integer type");
break;
}
}
@ -468,7 +468,7 @@ get_typedef(char *name)
for (this = types; this && strcmp(this->name, name); this = this->next);
if (!this)
mmerror(PARSE_ERROR, ET_FATAL, "invalid datatype \"%s\"", name);
mmerror(PARSE_ERROR, ET_FATAL, "unrecognized data type name \"%s\"", name);
return (this);
}
@ -479,7 +479,7 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
if (atoi(type_index) >= 0)
{
if (atoi(*length) >= 0)
mmerror(PARSE_ERROR, ET_FATAL, "no multidimensional array support");
mmerror(PARSE_ERROR, ET_FATAL, "multidimensional arrays are not supported");
*length = type_index;
}
@ -487,7 +487,7 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
if (atoi(type_dimension) >= 0)
{
if (atoi(*dimension) >= 0 && atoi(*length) >= 0)
mmerror(PARSE_ERROR, ET_FATAL, "no multidimensional array support");
mmerror(PARSE_ERROR, ET_FATAL, "multidimensional arrays are not supported");
if (atoi(*dimension) >= 0)
*length = *dimension;
@ -496,16 +496,16 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
}
if (pointer_len > 2)
mmerror(PARSE_ERROR, ET_FATAL, "no multilevel (more than 2) pointer supported %d", pointer_len);
mmerror(PARSE_ERROR, ET_FATAL, "multilevel pointers (more than 2 levels) are not supported; found %d levels", pointer_len);
if (pointer_len > 1 && type_enum != ECPGt_char && type_enum != ECPGt_unsigned_char)
mmerror(PARSE_ERROR, ET_FATAL, "no pointer to pointer supported for this type");
mmerror(PARSE_ERROR, ET_FATAL, "pointer to pointer is not supported for this data type");
if (pointer_len > 1 && (atoi(*length) >= 0 || atoi(*dimension) >= 0))
mmerror(PARSE_ERROR, ET_FATAL, "no multidimensional array support");
mmerror(PARSE_ERROR, ET_FATAL, "multidimensional arrays are not supported");
if (atoi(*length) >= 0 && atoi(*dimension) >= 0 && pointer_len)
mmerror(PARSE_ERROR, ET_FATAL, "no multidimensional array support");
mmerror(PARSE_ERROR, ET_FATAL, "multidimensional arrays are not supported");
switch (type_enum)
{
@ -519,7 +519,7 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
}
if (atoi(*length) >= 0)
mmerror(PARSE_ERROR, ET_FATAL, "no multidimensional array support for structures");
mmerror(PARSE_ERROR, ET_FATAL, "multidimensional arrays for structures are not supported");
break;
case ECPGt_varchar:
@ -579,7 +579,7 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
}
if (atoi(*length) >= 0)
mmerror(PARSE_ERROR, ET_FATAL, "no multidimensional array support for simple data types");
mmerror(PARSE_ERROR, ET_FATAL, "multidimensional arrays for simple data types are not supported");
break;
}