1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-03 15:22:11 +03:00

pgindent run on all C files. Java run to follow. initdb/regression

tests pass.
This commit is contained in:
Bruce Momjian
2001-10-25 05:50:21 +00:00
parent 59da2105d8
commit b81844b173
818 changed files with 21684 additions and 20491 deletions

View File

@@ -33,7 +33,7 @@
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.24 2001/10/19 22:43:49 tgl Exp $
* $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.25 2001/10/25 05:50:17 momjian Exp $
*
**********************************************************************/
@@ -300,8 +300,8 @@ plperl_create_sub(char *s, bool trusted)
PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVpv(s, 0)));
PUTBACK;
count = perl_call_pv( (trusted?"mksafefunc":"mkunsafefunc"),
G_SCALAR | G_EVAL | G_KEEPERR);
count = perl_call_pv((trusted ? "mksafefunc" : "mkunsafefunc"),
G_SCALAR | G_EVAL | G_KEEPERR);
SPAGAIN;
if (SvTRUE(ERRSV))
@@ -358,7 +358,7 @@ plperl_init_shared_libs(void)
{
char *file = __FILE__;
newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
newXS("SPI::bootstrap", boot_SPI, file);
}
@@ -622,7 +622,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
if (!is_trigger)
{
typeTup = SearchSysCache(TYPEOID,
ObjectIdGetDatum(procStruct->prorettype),
ObjectIdGetDatum(procStruct->prorettype),
0, 0, 0);
if (!HeapTupleIsValid(typeTup))
{
@@ -660,7 +660,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
for (i = 0; i < prodesc->nargs; i++)
{
typeTup = SearchSysCache(TYPEOID,
ObjectIdGetDatum(procStruct->proargtypes[i]),
ObjectIdGetDatum(procStruct->proargtypes[i]),
0, 0, 0);
if (!HeapTupleIsValid(typeTup))
{
@@ -780,8 +780,8 @@ plperl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc)
************************************************************/
outputstr = DatumGetCString(OidFunctionCall3(typoutput,
attr,
ObjectIdGetDatum(typelem),
Int32GetDatum(tupdesc->attrs[i]->atttypmod)));
ObjectIdGetDatum(typelem),
Int32GetDatum(tupdesc->attrs[i]->atttypmod)));
sv_catpvf(output, "'%s' => '%s',", attname, outputstr);
pfree(outputstr);
}

View File

@@ -237,7 +237,6 @@ newRV_noinc(SV * sv)
static
#else
extern void newCONSTSUB _((HV * stash, char *name, SV * sv));
#endif
#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)
@@ -284,10 +283,7 @@ SV *sv;
PL_curstash = old_curstash;
PL_curcop->cop_line = oldline;
}
#endif
#endif /* newCONSTSUB */
#endif /* _P_P_PORTABILITY_H_ */

View File

@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.36 2001/10/09 15:59:56 tgl Exp $
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.37 2001/10/25 05:50:20 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -252,7 +252,6 @@ plpgsql_compile(Oid fn_oid, int functype)
if (typeStruct->typrelid != InvalidOid)
{
/*
* For tuple type parameters, we set up a record of
* that type
@@ -274,7 +273,6 @@ plpgsql_compile(Oid fn_oid, int functype)
}
else
{
/*
* Normal parameters get a var node
*/
@@ -691,7 +689,6 @@ plpgsql_parse_dblword(char *string)
case PLPGSQL_NSTYPE_REC:
{
/*
* First word is a record name, so second word must be a
* field in this record.
@@ -712,7 +709,6 @@ plpgsql_parse_dblword(char *string)
case PLPGSQL_NSTYPE_ROW:
{
/*
* First word is a row name, so second word must be a
* field in this row.
@@ -794,7 +790,6 @@ plpgsql_parse_tripword(char *string)
{
case PLPGSQL_NSTYPE_REC:
{
/*
* This word is a record name, so third word must be a
* field in this record.
@@ -815,7 +810,6 @@ plpgsql_parse_tripword(char *string)
case PLPGSQL_NSTYPE_ROW:
{
/*
* This word is a row name, so third word must be a field
* in this row.
@@ -1137,7 +1131,6 @@ plpgsql_parse_wordrowtype(char *string)
for (i = 0; i < row->nfields; i++)
{
/*
* Get the attribute and it's type
*/
@@ -1164,11 +1157,11 @@ plpgsql_parse_wordrowtype(char *string)
* Create the internal variable
*
* We know if the table definitions contain a default value or if the
* field is declared in the table as NOT NULL. But it's possible to
* create a table field as NOT NULL without a default value and that
* would lead to problems later when initializing the variables due to
* entering a block at execution time. Thus we ignore this information
* for now.
* field is declared in the table as NOT NULL. But it's possible
* to create a table field as NOT NULL without a default value and
* that would lead to problems later when initializing the
* variables due to entering a block at execution time. Thus we
* ignore this information for now.
*/
var = malloc(sizeof(PLpgSQL_var));
memset(var, 0, sizeof(PLpgSQL_var));
@@ -1223,8 +1216,8 @@ plpgsql_parse_wordrowtype(char *string)
PLpgSQL_type *
plpgsql_parse_datatype(char *string)
{
Oid type_id;
int32 typmod;
Oid type_id;
int32 typmod;
HeapTuple typeTup;
Form_pg_type typeStruct;
PLpgSQL_type *typ;

View File

@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.47 2001/08/02 21:31:23 tgl Exp $
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.48 2001/10/25 05:50:20 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -96,11 +96,11 @@ static int exec_stmt_fors(PLpgSQL_execstate * estate,
static int exec_stmt_select(PLpgSQL_execstate * estate,
PLpgSQL_stmt_select * stmt);
static int exec_stmt_open(PLpgSQL_execstate * estate,
PLpgSQL_stmt_open * stmt);
PLpgSQL_stmt_open * stmt);
static int exec_stmt_fetch(PLpgSQL_execstate * estate,
PLpgSQL_stmt_fetch * stmt);
PLpgSQL_stmt_fetch * stmt);
static int exec_stmt_close(PLpgSQL_execstate * estate,
PLpgSQL_stmt_close * stmt);
PLpgSQL_stmt_close * stmt);
static int exec_stmt_exit(PLpgSQL_execstate * estate,
PLpgSQL_stmt_exit * stmt);
static int exec_stmt_return(PLpgSQL_execstate * estate,
@@ -115,7 +115,7 @@ static int exec_stmt_dynfors(PLpgSQL_execstate * estate,
PLpgSQL_stmt_dynfors * stmt);
static void plpgsql_estate_setup(PLpgSQL_execstate * estate,
PLpgSQL_function * func);
PLpgSQL_function * func);
static void exec_eval_cleanup(PLpgSQL_execstate * estate);
static void exec_prepare_plan(PLpgSQL_execstate * estate,
@@ -859,7 +859,7 @@ exec_stmt_block(PLpgSQL_execstate * estate, PLpgSQL_stmt_block * block)
if (var->freeval)
{
pfree((void *)(var->value));
pfree((void *) (var->value));
var->freeval = false;
}
@@ -1072,16 +1072,16 @@ exec_stmt(PLpgSQL_execstate * estate, PLpgSQL_stmt * stmt)
static int
exec_stmt_assign(PLpgSQL_execstate * estate, PLpgSQL_stmt_assign * stmt)
{
PLpgSQL_expr *expr = stmt->expr;
PLpgSQL_expr *expr = stmt->expr;
if (stmt->varno >= 0)
exec_assign_expr(estate, estate->datums[stmt->varno], expr);
else
{
/*
* PERFORM: evaluate query and discard result. This cannot share
* code with the assignment case since we do not wish to constraint
* the discarded result to be only one row/column.
* PERFORM: evaluate query and discard result. This cannot share
* code with the assignment case since we do not wish to
* constraint the discarded result to be only one row/column.
*/
int rc;
@@ -1322,7 +1322,6 @@ exec_stmt_fori(PLpgSQL_execstate * estate, PLpgSQL_stmt_fori * stmt)
exec_set_found(estate, false);
for (;;)
{
/*
* Check bounds
*/
@@ -1418,8 +1417,8 @@ exec_stmt_fors(PLpgSQL_execstate * estate, PLpgSQL_stmt_fors * stmt)
}
/*
* Open the implicit cursor for the statement and fetch
* the initial 10 rows.
* Open the implicit cursor for the statement and fetch the initial 10
* rows.
*/
exec_run_select(estate, stmt->query, 0, &portal);
@@ -1636,6 +1635,7 @@ exec_stmt_return(PLpgSQL_execstate * estate, PLpgSQL_stmt_return * stmt)
estate->rettupdesc = SPI_copytupledesc(estate->eval_tuptable->tupdesc);
estate->retisnull = false;
}
/*
* Okay to clean up here, since we already copied result tuple
* to upper executor.
@@ -1678,7 +1678,6 @@ exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt)
for (cp = stmt->message; *cp; cp++)
{
/*
* Occurences of a single % are replaced by the next arguments
* external representation. Double %'s are left as is so elog()
@@ -1882,8 +1881,8 @@ exec_prepare_plan(PLpgSQL_execstate * estate,
Oid *argtypes;
/*
* We need a temporary argtypes array to load with data.
* (The finished plan structure will contain a copy of it.)
* We need a temporary argtypes array to load with data. (The finished
* plan structure will contain a copy of it.)
*
* +1 is just to avoid palloc(0) error.
*/
@@ -2047,7 +2046,10 @@ exec_stmt_execsql(PLpgSQL_execstate * estate,
expr->query);
}
/* Release any result tuples from SPI_execp (probably shouldn't be any) */
/*
* Release any result tuples from SPI_execp (probably shouldn't be
* any)
*/
SPI_freetuptable(SPI_tuptable);
/* Save result info for GET DIAGNOSTICS */
@@ -2181,7 +2183,7 @@ exec_stmt_dynfors(PLpgSQL_execstate * estate, PLpgSQL_stmt_dynfors * stmt)
HeapTuple typetup;
Form_pg_type typeStruct;
FmgrInfo finfo_output;
void *plan;
void *plan;
Portal portal;
/*
@@ -2238,7 +2240,7 @@ exec_stmt_dynfors(PLpgSQL_execstate * estate, PLpgSQL_stmt_dynfors * stmt)
portal = SPI_cursor_open(NULL, plan, NULL, NULL);
if (portal == NULL)
elog(ERROR, "failed to open implicit cursor for dynamic query \"%s\"",
querystr);
querystr);
pfree(querystr);
SPI_freeplan(plan);
@@ -2344,7 +2346,7 @@ static int
exec_stmt_open(PLpgSQL_execstate * estate, PLpgSQL_stmt_open * stmt)
{
PLpgSQL_var *curvar = NULL;
char *curname = NULL;
char *curname = NULL;
PLpgSQL_expr *query = NULL;
Portal portal;
@@ -2387,7 +2389,7 @@ exec_stmt_open(PLpgSQL_execstate * estate, PLpgSQL_stmt_open * stmt)
* done downstairs.
* ----------
*/
query = stmt->query;
query = stmt->query;
if (query->plan == NULL)
exec_prepare_plan(estate, query);
}
@@ -2403,7 +2405,7 @@ exec_stmt_open(PLpgSQL_execstate * estate, PLpgSQL_stmt_open * stmt)
HeapTuple typetup;
Form_pg_type typeStruct;
FmgrInfo finfo_output;
void *curplan = NULL;
void *curplan = NULL;
/* ----------
* We evaluate the string expression after the
@@ -2429,7 +2431,7 @@ exec_stmt_open(PLpgSQL_execstate * estate, PLpgSQL_stmt_open * stmt)
fmgr_info(typeStruct->typoutput, &finfo_output);
querystr = DatumGetCString(FunctionCall3(&finfo_output,
queryD,
ObjectIdGetDatum(typeStruct->typelem),
ObjectIdGetDatum(typeStruct->typelem),
Int32GetDatum(-1)));
ReleaseSysCache(typetup);
@@ -2450,7 +2452,7 @@ exec_stmt_open(PLpgSQL_execstate * estate, PLpgSQL_stmt_open * stmt)
* ----------
*/
if (curvar->freeval)
pfree((void *)(curvar->value));
pfree((void *) (curvar->value));
curvar->value = DirectFunctionCall1(textin, CStringGetDatum(portal->name));
curvar->isnull = false;
@@ -2472,20 +2474,20 @@ exec_stmt_open(PLpgSQL_execstate * estate, PLpgSQL_stmt_open * stmt)
* internal row.
* ----------
*/
PLpgSQL_stmt_select set_args;
PLpgSQL_stmt_select set_args;
memset(&set_args, 0, sizeof(set_args));
set_args.cmd_type = PLPGSQL_STMT_SELECT;
set_args.lineno = stmt->lineno;
set_args.row = (PLpgSQL_row *)
(estate->datums[curvar->cursor_explicit_argrow]);
set_args.query = stmt->argquery;
set_args.cmd_type = PLPGSQL_STMT_SELECT;
set_args.lineno = stmt->lineno;
set_args.row = (PLpgSQL_row *)
(estate->datums[curvar->cursor_explicit_argrow]);
set_args.query = stmt->argquery;
if (exec_stmt_select(estate, &set_args) != PLPGSQL_RC_OK)
elog(ERROR, "open cursor failed during argument processing");
}
query = curvar->cursor_explicit_expr;
query = curvar->cursor_explicit_expr;
if (query->plan == NULL)
exec_prepare_plan(estate, query);
}
@@ -2574,7 +2576,7 @@ exec_stmt_open(PLpgSQL_execstate * estate, PLpgSQL_stmt_open * stmt)
* ----------
*/
if (curvar->freeval)
pfree((void *)(curvar->value));
pfree((void *) (curvar->value));
curvar->value = DirectFunctionCall1(textin, CStringGetDatum(portal->name));
curvar->isnull = false;
@@ -2596,7 +2598,7 @@ exec_stmt_fetch(PLpgSQL_execstate * estate, PLpgSQL_stmt_fetch * stmt)
PLpgSQL_row *row = NULL;
SPITupleTable *tuptab;
Portal portal;
char *curname;
char *curname;
int n;
/* ----------
@@ -2674,7 +2676,7 @@ exec_stmt_close(PLpgSQL_execstate * estate, PLpgSQL_stmt_close * stmt)
{
PLpgSQL_var *curvar = NULL;
Portal portal;
char *curname;
char *curname;
/* ----------
* Get the portal of the cursor by name
@@ -2757,7 +2759,7 @@ exec_assign_value(PLpgSQL_execstate * estate,
if (var->freeval)
{
pfree((void *)(var->value));
pfree((void *) (var->value));
var->freeval = false;
}
@@ -2771,23 +2773,24 @@ exec_assign_value(PLpgSQL_execstate * estate,
elog(ERROR, "NULL assignment to variable '%s' declared NOT NULL", var->refname);
/*
* If type is by-reference, make sure we have a freshly palloc'd
* copy; the originally passed value may not live as long as the
* variable! But we don't need to re-copy if exec_cast_value
* performed a conversion; its output must already be palloc'd.
* If type is by-reference, make sure we have a freshly
* palloc'd copy; the originally passed value may not live as
* long as the variable! But we don't need to re-copy if
* exec_cast_value performed a conversion; its output must
* already be palloc'd.
*/
if (!var->datatype->typbyval && !*isNull)
{
if (newvalue == value)
{
int len;
int len;
if (var->datatype->typlen < 0)
len = VARSIZE(newvalue);
else
len = var->datatype->typlen;
var->value = (Datum) palloc(len);
memcpy((void *)(var->value), (void *)newvalue, len);
memcpy((void *) (var->value), (void *) newvalue, len);
}
else
var->value = newvalue;
@@ -2825,9 +2828,9 @@ exec_assign_value(PLpgSQL_execstate * estate,
natts = rec->tupdesc->natts;
/*
* Set up values/datums arrays for heap_formtuple. For all the
* attributes except the one we want to replace, use the value
* that's in the old tuple.
* Set up values/datums arrays for heap_formtuple. For all
* the attributes except the one we want to replace, use the
* value that's in the old tuple.
*/
values = palloc(sizeof(Datum) * natts);
nulls = palloc(natts);
@@ -2869,8 +2872,8 @@ exec_assign_value(PLpgSQL_execstate * estate,
nulls[fno] = ' ';
/*
* Avoid leaking the result of exec_cast_value, if it performed
* a conversion to a pass-by-ref type.
* Avoid leaking the result of exec_cast_value, if it
* performed a conversion to a pass-by-ref type.
*/
if (!typeStruct->typbyval && !attisnull && values[fno] != value)
mustfree = DatumGetPointer(values[fno]);
@@ -2953,7 +2956,7 @@ exec_eval_expr(PLpgSQL_execstate * estate,
elog(ERROR, "query \"%s\" returned more than one row", expr->query);
if (estate->eval_tuptable->tupdesc->natts != 1)
elog(ERROR, "query \"%s\" returned %d columns", expr->query,
estate->eval_tuptable->tupdesc->natts);
estate->eval_tuptable->tupdesc->natts);
/*
* Return the result and its type
@@ -3062,7 +3065,7 @@ exec_run_select(PLpgSQL_execstate * estate,
*portalP = SPI_cursor_open(NULL, expr->plan, values, nulls);
if (*portalP == NULL)
elog(ERROR, "failed to open implicit cursor for \"%s\"",
expr->query);
expr->query);
pfree(values);
pfree(nulls);
return SPI_OK_CURSOR;
@@ -3118,17 +3121,17 @@ exec_eval_simple_expr(PLpgSQL_execstate * estate,
*
* NOTE: we pass the SPI plan's context as the query-lifetime context for
* function cache nodes and suchlike allocations. This is appropriate
* because that's where the expression tree itself is, and the function
* cache nodes must live as long as it does.
* because that's where the expression tree itself is, and the
* function cache nodes must live as long as it does.
*/
econtext = MakeExprContext(NULL, spi_plan->plancxt);
/*
* Param list can live in econtext's temporary memory context.
*/
paramLI = (ParamListInfo)
paramLI = (ParamListInfo)
MemoryContextAlloc(econtext->ecxt_per_tuple_memory,
(expr->nparams + 1) * sizeof(ParamListInfoData));
(expr->nparams + 1) * sizeof(ParamListInfoData));
econtext->ecxt_param_list_info = paramLI;
/*
@@ -3204,8 +3207,9 @@ exec_eval_simple_expr(PLpgSQL_execstate * estate,
SPI_pop();
/*
* Note: if pass-by-reference, the result is in the econtext's temporary
* memory context. It will be freed when exec_eval_cleanup is done.
* Note: if pass-by-reference, the result is in the econtext's
* temporary memory context. It will be freed when exec_eval_cleanup
* is done.
*/
Assert(estate->eval_econtext == NULL);
estate->eval_econtext = econtext;
@@ -3265,11 +3269,11 @@ exec_move_row(PLpgSQL_execstate * estate,
* attributes of the tuple to the variables the row points to.
*
* NOTE: this code used to demand row->nfields == tup->t_data->t_natts,
* but that's wrong. The tuple might have more fields than we expected
* if it's from an inheritance-child table of the current table, or it
* might have fewer if the table has had columns added by ALTER TABLE.
* Ignore extra columns and assume NULL for missing columns, the same
* as heap_getattr would do.
* but that's wrong. The tuple might have more fields than we
* expected if it's from an inheritance-child table of the current
* table, or it might have fewer if the table has had columns added by
* ALTER TABLE. Ignore extra columns and assume NULL for missing
* columns, the same as heap_getattr would do.
*/
if (row != NULL)
{
@@ -3374,7 +3378,7 @@ exec_simple_check_node(Node *node)
{
switch (nodeTag(node))
{
case T_Expr:
case T_Expr:
{
Expr *expr = (Expr *) node;
List *l;

View File

@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_handler.c,v 1.9 2001/10/09 15:59:56 tgl Exp $
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_handler.c,v 1.10 2001/10/25 05:50:20 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -58,7 +58,7 @@
static PLpgSQL_function *compiled_functions = NULL;
static bool func_up_to_date(PLpgSQL_function *func);
static bool func_up_to_date(PLpgSQL_function * func);
/* ----------
@@ -93,10 +93,11 @@ plpgsql_call_handler(PG_FUNCTION_ARGS)
if (func != NULL)
{
Assert(func->fn_oid == funcOid);
/*
* But is the function still up to date?
*/
if (! func_up_to_date(func))
if (!func_up_to_date(func))
func = NULL;
}
@@ -154,7 +155,7 @@ plpgsql_call_handler(PG_FUNCTION_ARGS)
* function's pg_proc entry without changing its OID.
*/
static bool
func_up_to_date(PLpgSQL_function *func)
func_up_to_date(PLpgSQL_function * func)
{
HeapTuple procTup;
bool result;

View File

@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.19 2001/10/09 15:59:56 tgl Exp $
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.20 2001/10/25 05:50:20 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -53,11 +53,11 @@
*/
enum
{
PLPGSQL_NSTYPE_LABEL,
PLPGSQL_NSTYPE_VAR,
PLPGSQL_NSTYPE_ROW,
PLPGSQL_NSTYPE_REC,
PLPGSQL_NSTYPE_RECFIELD
PLPGSQL_NSTYPE_LABEL,
PLPGSQL_NSTYPE_VAR,
PLPGSQL_NSTYPE_ROW,
PLPGSQL_NSTYPE_REC,
PLPGSQL_NSTYPE_RECFIELD
};
/* ----------
@@ -66,12 +66,12 @@ enum
*/
enum
{
PLPGSQL_DTYPE_VAR,
PLPGSQL_DTYPE_ROW,
PLPGSQL_DTYPE_REC,
PLPGSQL_DTYPE_RECFIELD,
PLPGSQL_DTYPE_EXPR,
PLPGSQL_DTYPE_TRIGARG
PLPGSQL_DTYPE_VAR,
PLPGSQL_DTYPE_ROW,
PLPGSQL_DTYPE_REC,
PLPGSQL_DTYPE_RECFIELD,
PLPGSQL_DTYPE_EXPR,
PLPGSQL_DTYPE_TRIGARG
};
/* ----------
@@ -80,24 +80,24 @@ enum
*/
enum
{
PLPGSQL_STMT_BLOCK,
PLPGSQL_STMT_ASSIGN,
PLPGSQL_STMT_IF,
PLPGSQL_STMT_LOOP,
PLPGSQL_STMT_WHILE,
PLPGSQL_STMT_FORI,
PLPGSQL_STMT_FORS,
PLPGSQL_STMT_SELECT,
PLPGSQL_STMT_EXIT,
PLPGSQL_STMT_RETURN,
PLPGSQL_STMT_RAISE,
PLPGSQL_STMT_EXECSQL,
PLPGSQL_STMT_DYNEXECUTE,
PLPGSQL_STMT_DYNFORS,
PLPGSQL_STMT_GETDIAG,
PLPGSQL_STMT_OPEN,
PLPGSQL_STMT_FETCH,
PLPGSQL_STMT_CLOSE
PLPGSQL_STMT_BLOCK,
PLPGSQL_STMT_ASSIGN,
PLPGSQL_STMT_IF,
PLPGSQL_STMT_LOOP,
PLPGSQL_STMT_WHILE,
PLPGSQL_STMT_FORI,
PLPGSQL_STMT_FORS,
PLPGSQL_STMT_SELECT,
PLPGSQL_STMT_EXIT,
PLPGSQL_STMT_RETURN,
PLPGSQL_STMT_RAISE,
PLPGSQL_STMT_EXECSQL,
PLPGSQL_STMT_DYNEXECUTE,
PLPGSQL_STMT_DYNFORS,
PLPGSQL_STMT_GETDIAG,
PLPGSQL_STMT_OPEN,
PLPGSQL_STMT_FETCH,
PLPGSQL_STMT_CLOSE
};
@@ -107,9 +107,9 @@ enum
*/
enum
{
PLPGSQL_RC_OK,
PLPGSQL_RC_EXIT,
PLPGSQL_RC_RETURN
PLPGSQL_RC_OK,
PLPGSQL_RC_EXIT,
PLPGSQL_RC_RETURN
};
/* ----------
@@ -118,8 +118,8 @@ enum
*/
enum
{
PLPGSQL_GETDIAG_ROW_COUNT,
PLPGSQL_GETDIAG_RESULT_OID
PLPGSQL_GETDIAG_ROW_COUNT,
PLPGSQL_GETDIAG_RESULT_OID
};
@@ -382,7 +382,7 @@ typedef struct
int cmd_type;
int lineno;
int curvar;
PLpgSQL_row *returntype;
PLpgSQL_row *returntype;
PLpgSQL_expr *argquery;
PLpgSQL_expr *query;
PLpgSQL_expr *dynquery;
@@ -486,7 +486,7 @@ typedef struct PLpgSQL_function
PLpgSQL_datum **datums;
PLpgSQL_stmt_block *action;
struct PLpgSQL_function *next; /* for chaining list of functions */
struct PLpgSQL_function *next; /* for chaining list of functions */
} PLpgSQL_function;
@@ -529,8 +529,10 @@ extern char *plpgsql_error_funcname;
/* linkage to the real yytext and yylineno variables */
extern char *plpgsql_base_yytext;
#define plpgsql_yytext plpgsql_base_yytext
extern int plpgsql_base_yylineno;
#define plpgsql_yylineno plpgsql_base_yylineno
extern PLpgSQL_function *plpgsql_curr_compile;
@@ -609,5 +611,4 @@ extern int plpgsql_base_yylex(void);
extern int plpgsql_yylex(void);
extern void plpgsql_push_back_token(int token);
extern void plpgsql_setinput(char *s, int functype);
#endif /* PLPGSQL_H */

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/* $Header: /cvsroot/pgsql/src/pl/plpython/Attic/plpython.h,v 1.2 2001/05/12 01:30:30 petere Exp $ */
/* $Header: /cvsroot/pgsql/src/pl/plpython/Attic/plpython.h,v 1.3 2001/10/25 05:50:21 momjian Exp $ */
#ifndef PLPYTHON_H
#define PLPYTHON_H
@@ -10,22 +10,22 @@
#define TRAP_N_EXC(N) ((rv_##N = sigsetjmp(Warn_restart, 1)) != 0)
#if !DEBUG_EXC
# define RESTORE_N_EXC(N) memcpy(&Warn_restart, &(buf_##N), sizeof(sigjmp_buf))
# define SAVE_N_EXC(N) memcpy(&(buf_##N), &Warn_restart, sizeof(sigjmp_buf))
# define RERAISE_N_EXC(N) siglongjmp(Warn_restart, rv_##N)
# define RAISE_EXC(V) siglongjmp(Warn_restart, (V))
#define RESTORE_N_EXC(N) memcpy(&Warn_restart, &(buf_##N), sizeof(sigjmp_buf))
#define SAVE_N_EXC(N) memcpy(&(buf_##N), &Warn_restart, sizeof(sigjmp_buf))
#define RERAISE_N_EXC(N) siglongjmp(Warn_restart, rv_##N)
#define RAISE_EXC(V) siglongjmp(Warn_restart, (V))
#else
# define RESTORE_N_EXC(N) do { \
#define RESTORE_N_EXC(N) do { \
elog(NOTICE, "exception (%d,%d) restore at %s:%d",\
PLy_call_level, exc_save_calls, __FUNCTION__, (__LINE__));\
PLy_call_level, exc_save_calls, __FUNCTION__, (__LINE__));\
exc_save_calls -= 1; \
memcpy(&Warn_restart, &(buf_##N), sizeof(sigjmp_buf)); } while (0)
# define SAVE_N_EXC(N) do { \
#define SAVE_N_EXC(N) do { \
exc_save_calls += 1; \
elog(NOTICE, "exception (%d,%d) save at %s:%d", \
PLy_call_level, exc_save_calls, __FUNCTION__, (__LINE__)); \
PLy_call_level, exc_save_calls, __FUNCTION__, (__LINE__)); \
memcpy(&(buf_##N), &Warn_restart, sizeof(sigjmp_buf)); } while (0)
# define RERAISE_N_EXC(N) do { \
#define RERAISE_N_EXC(N) do { \
elog(NOTICE, "exception (%d,%d) reraise at %s:%d", \
PLy_call_level, exc_save_calls, __FUNCTION__, (__LINE__)); \
siglongjmp(Warn_restart, rv_##N); } while (0)
@@ -42,27 +42,26 @@
#define TRAP_EXC() TRAP_N_EXC(save_restart)
#if DEBUG_LEVEL
# define CALL_LEVEL_INC() do { PLy_call_level += 1; \
elog(NOTICE, "Level: %d", PLy_call_level); } while (0)
# define CALL_LEVEL_DEC() do { elog(NOTICE, "Level: %d", PLy_call_level); \
PLy_call_level -= 1; } while (0)
#define CALL_LEVEL_INC() do { PLy_call_level += 1; \
elog(NOTICE, "Level: %d", PLy_call_level); } while (0)
#define CALL_LEVEL_DEC() do { elog(NOTICE, "Level: %d", PLy_call_level); \
PLy_call_level -= 1; } while (0)
#else
# define CALL_LEVEL_INC() do { PLy_call_level += 1; } while (0)
# define CALL_LEVEL_DEC() do { PLy_call_level -= 1; } while (0)
#define CALL_LEVEL_INC() do { PLy_call_level += 1; } while (0)
#define CALL_LEVEL_DEC() do { PLy_call_level -= 1; } while (0)
#endif
/* temporary debugging macros
*/
#if DEBUG_LEVEL
# define enter() elog(NOTICE, "Enter(%d): %s", func_enter_calls++,__FUNCTION__)
# define leave() elog(NOTICE, "Leave(%d): %s", func_leave_calls++,__FUNCTION__)
# define mark() elog(NOTICE, "Mark: %s:%d", __FUNCTION__, __LINE__);
# define refc(O) elog(NOTICE, "Ref<%p>:<%d>:%s:%d", (O), (((O) == NULL) ? -1 : (O)->ob_refcnt), __FUNCTION__, __LINE__)
#define enter() elog(NOTICE, "Enter(%d): %s", func_enter_calls++,__FUNCTION__)
#define leave() elog(NOTICE, "Leave(%d): %s", func_leave_calls++,__FUNCTION__)
#define mark() elog(NOTICE, "Mark: %s:%d", __FUNCTION__, __LINE__);
#define refc(O) elog(NOTICE, "Ref<%p>:<%d>:%s:%d", (O), (((O) == NULL) ? -1 : (O)->ob_refcnt), __FUNCTION__, __LINE__)
#else
# define enter()
# define leave()
# define mark()
# define refc(O)
#define enter()
#define leave()
#define mark()
#define refc(O)
#endif
#endif /* PLPYTHON_H */
#endif /* PLPYTHON_H */

View File

@@ -31,7 +31,7 @@
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.46 2001/10/19 19:43:19 tgl Exp $
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.47 2001/10/25 05:50:21 momjian Exp $
*
**********************************************************************/
@@ -67,31 +67,33 @@
static pg_enconv *tcl_enconv;
static unsigned char *
utf_u2e(unsigned char *src) {
return pg_do_encoding_conversion(src,strlen(src),
NULL,tcl_enconv->from_unicode);
utf_u2e(unsigned char *src)
{
return pg_do_encoding_conversion(src, strlen(src),
NULL, tcl_enconv->from_unicode);
}
static unsigned char *
utf_e2u(unsigned char *src) {
return pg_do_encoding_conversion(src,strlen(src),
tcl_enconv->to_unicode,NULL);
utf_e2u(unsigned char *src)
{
return pg_do_encoding_conversion(src, strlen(src),
tcl_enconv->to_unicode, NULL);
}
# define PLTCL_UTF
# define UTF_BEGIN do { \
#define PLTCL_UTF
#define UTF_BEGIN do { \
unsigned char *_pltcl_utf_src; \
unsigned char *_pltcl_utf_dst
# define UTF_END if (_pltcl_utf_src!=_pltcl_utf_dst) \
#define UTF_END if (_pltcl_utf_src!=_pltcl_utf_dst) \
pfree(_pltcl_utf_dst); } while (0)
# define UTF_U2E(x) (_pltcl_utf_dst=utf_u2e(_pltcl_utf_src=(x)))
# define UTF_E2U(x) (_pltcl_utf_dst=utf_e2u(_pltcl_utf_src=(x)))
#else /* PLTCL_UTF */
# define UTF_BEGIN
# define UTF_END
# define UTF_U2E(x) (x)
# define UTF_E2U(x) (x)
#endif /* PLTCL_UTF */
#define UTF_U2E(x) (_pltcl_utf_dst=utf_u2e(_pltcl_utf_src=(x)))
#define UTF_E2U(x) (_pltcl_utf_dst=utf_e2u(_pltcl_utf_src=(x)))
#else /* PLTCL_UTF */
#define UTF_BEGIN
#define UTF_END
#define UTF_U2E(x) (x)
#define UTF_E2U(x) (x)
#endif /* PLTCL_UTF */
/**********************************************************************
* The information we cache about loaded procedures
@@ -179,7 +181,7 @@ static void pltcl_set_tuple_values(Tcl_Interp *interp, char *arrayname,
static void pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
Tcl_DString *retval);
static int pltcl_SPI_lastoid(ClientData cdata, Tcl_Interp *interp,
int argc, char *argv[]);
int argc, char *argv[]);
/*
* This routine is a crock, and so is everyplace that calls it. The problem
@@ -215,7 +217,7 @@ pltcl_init_all(void)
* Do unicode conversion initialization
************************************************************/
tcl_enconv=pg_get_enconv_by_encoding(GetDatabaseEncoding());
tcl_enconv = pg_get_enconv_by_encoding(GetDatabaseEncoding());
#endif
/************************************************************
@@ -288,7 +290,7 @@ pltcl_init_interp(Tcl_Interp *interp)
pltcl_SPI_execp, NULL, NULL);
Tcl_CreateCommand(interp, "spi_lastoid",
pltcl_SPI_lastoid, NULL, NULL);
/************************************************************
* Try to load the unknown procedure from pltcl_modules
************************************************************/
@@ -556,8 +558,8 @@ pltcl_func_handler(PG_FUNCTION_ARGS)
pltcl_restart_in_progress = 0;
UTF_BEGIN;
elog(ERROR, "pltcl: %s\n%s", interp->result,
UTF_U2E(Tcl_GetVar(interp,"errorInfo",
TCL_GLOBAL_ONLY)));
UTF_U2E(Tcl_GetVar(interp, "errorInfo",
TCL_GLOBAL_ONLY)));
UTF_END;
}
if (--pltcl_call_level == 0)
@@ -789,8 +791,8 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS)
pltcl_restart_in_progress = 0;
UTF_BEGIN;
elog(ERROR, "pltcl: %s\n%s", interp->result,
UTF_U2E(Tcl_GetVar(interp,"errorInfo",
TCL_GLOBAL_ONLY)));
UTF_U2E(Tcl_GetVar(interp, "errorInfo",
TCL_GLOBAL_ONLY)));
UTF_END;
}
if (--pltcl_call_level == 0)
@@ -1054,7 +1056,7 @@ compile_pltcl_function(Oid fn_oid, bool is_trigger)
if (!is_trigger)
{
typeTup = SearchSysCache(TYPEOID,
ObjectIdGetDatum(procStruct->prorettype),
ObjectIdGetDatum(procStruct->prorettype),
0, 0, 0);
if (!HeapTupleIsValid(typeTup))
{
@@ -1093,7 +1095,7 @@ compile_pltcl_function(Oid fn_oid, bool is_trigger)
for (i = 0; i < prodesc->nargs; i++)
{
typeTup = SearchSysCache(TYPEOID,
ObjectIdGetDatum(procStruct->proargtypes[i]),
ObjectIdGetDatum(procStruct->proargtypes[i]),
0, 0, 0);
if (!HeapTupleIsValid(typeTup))
{
@@ -2257,15 +2259,16 @@ pltcl_SPI_execp(ClientData cdata, Tcl_Interp *interp,
/**********************************************************************
* pltcl_SPI_lastoid() - return the last oid. To
* be used after insert queries
* pltcl_SPI_lastoid() - return the last oid. To
* be used after insert queries
**********************************************************************/
static int
pltcl_SPI_lastoid(ClientData cdata, Tcl_Interp *interp,
int argc, char *argv[])
{
char buf[64];
sprintf(buf,"%u",SPI_lastoid);
char buf[64];
sprintf(buf, "%u", SPI_lastoid);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_OK;
}
@@ -2353,7 +2356,7 @@ pltcl_set_tuple_values(Tcl_Interp *interp, char *arrayname,
outputstr = DatumGetCString(OidFunctionCall3(typoutput,
attr,
ObjectIdGetDatum(typelem),
Int32GetDatum(tupdesc->attrs[i]->atttypmod)));
Int32GetDatum(tupdesc->attrs[i]->atttypmod)));
UTF_BEGIN;
Tcl_SetVar2(interp, *arrptr, *nameptr, UTF_E2U(outputstr), 0);
UTF_END;
@@ -2425,7 +2428,7 @@ pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
outputstr = DatumGetCString(OidFunctionCall3(typoutput,
attr,
ObjectIdGetDatum(typelem),
Int32GetDatum(tupdesc->attrs[i]->atttypmod)));
Int32GetDatum(tupdesc->attrs[i]->atttypmod)));
Tcl_DStringAppendElement(retval, attname);
UTF_BEGIN;
Tcl_DStringAppendElement(retval, UTF_E2U(outputstr));