提交 b3195dae 编写于 作者: N Neil Conway

Minor cleanup for recent SQLSTATE / SQLERRM patch: spell "successful"

correctly, style fixes.
上级 63e0d612
......@@ -4,7 +4,7 @@
* procedural language
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.70 2005/05/26 00:16:31 momjian Exp $
* $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.71 2005/05/26 03:18:53 neilc Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
......@@ -285,7 +285,8 @@ fict_vars_sect :
plpgsql_build_datatype(TEXTOID, -1), true);
$$.sqlerrm_varno = var->dno;
plpgsql_add_initdatums(NULL);
};
}
;
decl_sect : opt_label
{
......
......@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.139 2005/05/26 00:16:31 momjian Exp $
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.140 2005/05/26 03:18:53 neilc Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
......@@ -760,7 +760,7 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
var = (PLpgSQL_var *) (estate->datums[block->sqlerrm_varno]);
var->isnull = false;
var->freeval = true;
var->value = DirectFunctionCall1(textin, CStringGetDatum("Sucessful completion"));
var->value = DirectFunctionCall1(textin, CStringGetDatum("Successful completion"));
/*
* First initialize all variables declared in this block
......@@ -777,7 +777,7 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
if (var->freeval)
{
pfree((void *) (var->value));
pfree(DatumGetPointer(var->value));
var->freeval = false;
}
......@@ -872,13 +872,12 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
CurrentResourceOwner = oldowner;
/* set SQLSTATE and SQLERRM variables */
var = (PLpgSQL_var *) (estate->datums[block->sqlstate_varno]);
pfree((void *) (var->value));
pfree(DatumGetPointer(var->value));
var->value = DirectFunctionCall1(textin, CStringGetDatum(unpack_sql_state(edata->sqlerrcode)));
var = (PLpgSQL_var *) (estate->datums[block->sqlerrm_varno]);
pfree((void *) (var->value));
pfree(DatumGetPointer(var->value));
var->value = DirectFunctionCall1(textin, CStringGetDatum(edata->message));
/*
......
......@@ -2381,7 +2381,7 @@ CONTEXT: PL/pgSQL function "missing_return_expr"
drop function void_return_expr();
drop function missing_return_expr();
-- test SQLSTATE and SQLERRM
create or replace function trap_exceptions() returns void as $_$
create function trap_exceptions() returns void as $_$
begin
begin
raise exception 'first exception';
......@@ -2398,7 +2398,7 @@ begin
end; $_$ language plpgsql;
select trap_exceptions();
NOTICE: P0001 first exception
NOTICE: 00000 Sucessful completion
NOTICE: 00000 Successful completion
NOTICE: P0001 last exception
trap_exceptions
-----------------
......
......@@ -2018,8 +2018,9 @@ select missing_return_expr();
drop function void_return_expr();
drop function missing_return_expr();
-- test SQLSTATE and SQLERRM
create or replace function trap_exceptions() returns void as $_$
create function trap_exceptions() returns void as $_$
begin
begin
raise exception 'first exception';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册