Commit 316c5cbf authored by Tom Lane's avatar Tom Lane

Factor out duplicate code for computing values of PLpgSQL_datum items.

This is to help localize the changes needed for adding a new kind of
PLpgSQL_datum (like, say, an array element...)
parent 6ba159f9
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* procedural language * procedural language
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.54 2003/01/31 00:31:53 tgl Exp $ * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.55 2003/03/25 00:34:23 tgl Exp $
* *
* This software is copyrighted by Jan Wieck - Hamburg. * This software is copyrighted by Jan Wieck - Hamburg.
* *
...@@ -696,7 +696,7 @@ plpgsql_parse_dblword(char *word) ...@@ -696,7 +696,7 @@ plpgsql_parse_dblword(char *word)
new = malloc(sizeof(PLpgSQL_recfield)); new = malloc(sizeof(PLpgSQL_recfield));
new->dtype = PLPGSQL_DTYPE_RECFIELD; new->dtype = PLPGSQL_DTYPE_RECFIELD;
new->fieldname = strdup(cp[1]); new->fieldname = strdup(cp[1]);
new->recno = ns->itemno; new->recparentno = ns->itemno;
plpgsql_adddatum((PLpgSQL_datum *) new); plpgsql_adddatum((PLpgSQL_datum *) new);
...@@ -799,7 +799,7 @@ plpgsql_parse_tripword(char *word) ...@@ -799,7 +799,7 @@ plpgsql_parse_tripword(char *word)
new = malloc(sizeof(PLpgSQL_recfield)); new = malloc(sizeof(PLpgSQL_recfield));
new->dtype = PLPGSQL_DTYPE_RECFIELD; new->dtype = PLPGSQL_DTYPE_RECFIELD;
new->fieldname = strdup(cp[2]); new->fieldname = strdup(cp[2]);
new->recno = ns->itemno; new->recparentno = ns->itemno;
plpgsql_adddatum((PLpgSQL_datum *) new); plpgsql_adddatum((PLpgSQL_datum *) new);
......
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* procedural language * procedural language
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.23 2002/09/05 00:43:07 tgl Exp $ * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.24 2003/03/25 00:34:23 tgl Exp $
* *
* This software is copyrighted by Jan Wieck - Hamburg. * This software is copyrighted by Jan Wieck - Hamburg.
* *
...@@ -1019,7 +1019,9 @@ plpgsql_dumptree(PLpgSQL_function * func) ...@@ -1019,7 +1019,9 @@ plpgsql_dumptree(PLpgSQL_function * func)
printf("REC %s\n", ((PLpgSQL_rec *) d)->refname); printf("REC %s\n", ((PLpgSQL_rec *) d)->refname);
break; break;
case PLPGSQL_DTYPE_RECFIELD: case PLPGSQL_DTYPE_RECFIELD:
printf("RECFIELD %-16s of REC %d\n", ((PLpgSQL_recfield *) d)->fieldname, ((PLpgSQL_recfield *) d)->recno); printf("RECFIELD %-16s of REC %d\n",
((PLpgSQL_recfield *) d)->fieldname,
((PLpgSQL_recfield *) d)->recparentno);
break; break;
case PLPGSQL_DTYPE_TRIGARG: case PLPGSQL_DTYPE_TRIGARG:
printf("TRIGARG "); printf("TRIGARG ");
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* procedural language * procedural language
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.31 2002/12/15 16:17:59 tgl Exp $ * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.32 2003/03/25 00:34:24 tgl Exp $
* *
* This software is copyrighted by Jan Wieck - Hamburg. * This software is copyrighted by Jan Wieck - Hamburg.
* *
...@@ -152,6 +152,10 @@ typedef struct ...@@ -152,6 +152,10 @@ typedef struct
} PLpgSQL_type; } PLpgSQL_type;
/*
* PLpgSQL_datum is the common supertype for PLpgSQL_expr, PLpgSQL_var,
* PLpgSQL_row, PLpgSQL_rec, PLpgSQL_recfield, PLpgSQL_trigarg
*/
typedef struct typedef struct
{ /* Generic datum array item */ { /* Generic datum array item */
int dtype; int dtype;
...@@ -209,7 +213,7 @@ typedef struct ...@@ -209,7 +213,7 @@ typedef struct
typedef struct typedef struct
{ /* Record of undefined structure */ { /* Record of non-fixed structure */
int dtype; int dtype;
int recno; int recno;
char *refname; char *refname;
...@@ -223,11 +227,11 @@ typedef struct ...@@ -223,11 +227,11 @@ typedef struct
typedef struct typedef struct
{ /* Field in record */ { /* Field in record */
int dtype; int dtype;
int rfno; int rfno;
char *fieldname; char *fieldname;
int recno; int recparentno; /* recno of parent record */
} PLpgSQL_recfield; } PLpgSQL_recfield;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment