diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-08-27 04:55:12 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-08-27 04:55:12 +0000 |
commit | 28e82066a1d17dce2c28ca5391dab1e4f1eb0c0f (patch) | |
tree | 2204fa82946fd20ffaf10fd498de0c921ea301eb /src/backend/nodes | |
parent | bc8f725a4aa4e2118caaf9e7c4fe3cc5632a02c0 (diff) | |
download | postgresql-28e82066a1d17dce2c28ca5391dab1e4f1eb0c0f.tar.gz postgresql-28e82066a1d17dce2c28ca5391dab1e4f1eb0c0f.zip |
PREPARE/EXECUTE statements. Patch by Neil Conway, some kibitzing
from Tom Lane.
Diffstat (limited to 'src/backend/nodes')
-rw-r--r-- | src/backend/nodes/copyfuncs.c | 46 | ||||
-rw-r--r-- | src/backend/nodes/equalfuncs.c | 48 |
2 files changed, 92 insertions, 2 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 4de9ba5b8de..b3920e38b2d 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -15,7 +15,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.206 2002/08/26 17:53:57 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.207 2002/08/27 04:55:07 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -2647,6 +2647,41 @@ _copyDropCastStmt(DropCastStmt *from) return newnode; } +static PrepareStmt * +_copyPrepareStmt(PrepareStmt *from) +{ + PrepareStmt *newnode = makeNode(PrepareStmt); + + newnode->name = pstrdup(from->name); + Node_Copy(from, newnode, argtypes); + newnode->argtype_oids = listCopy(from->argtype_oids); + Node_Copy(from, newnode, query); + + return newnode; +} + +static ExecuteStmt * +_copyExecuteStmt(ExecuteStmt *from) +{ + ExecuteStmt *newnode = makeNode(ExecuteStmt); + + newnode->name = pstrdup(from->name); + Node_Copy(from, newnode, into); + Node_Copy(from, newnode, params); + + return newnode; +} + +static DeallocateStmt * +_copyDeallocateStmt(DeallocateStmt *from) +{ + DeallocateStmt *newnode = makeNode(DeallocateStmt); + + newnode->name = pstrdup(from->name); + + return newnode; +} + /* **************************************************************** * pg_list.h copy functions @@ -3079,6 +3114,15 @@ copyObject(void *from) case T_DropCastStmt: retval = _copyDropCastStmt(from); break; + case T_PrepareStmt: + retval = _copyPrepareStmt(from); + break; + case T_ExecuteStmt: + retval = _copyExecuteStmt(from); + break; + case T_DeallocateStmt: + retval = _copyDeallocateStmt(from); + break; case T_A_Expr: retval = _copyAExpr(from); diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c index c96389f1e8b..408a94ff1b3 100644 --- a/src/backend/nodes/equalfuncs.c +++ b/src/backend/nodes/equalfuncs.c @@ -20,7 +20,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.154 2002/08/26 17:53:57 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.155 2002/08/27 04:55:07 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1491,6 +1491,43 @@ _equalDropCastStmt(DropCastStmt *a, DropCastStmt *b) } static bool +_equalPrepareStmt(PrepareStmt *a, PrepareStmt *b) +{ + if (!equalstr(a->name, b->name)) + return false; + if (!equal(a->argtypes, b->argtypes)) + return false; + if (!equali(a->argtype_oids, b->argtype_oids)) + return false; + if (!equal(a->query, b->query)) + return false; + + return true; +} + +static bool +_equalExecuteStmt(ExecuteStmt *a, ExecuteStmt *b) +{ + if (!equalstr(a->name, b->name)) + return false; + if (!equal(a->into, b->into)) + return false; + if (!equal(a->params, b->params)) + return false; + + return true; +} + +static bool +_equalDeallocateStmt(DeallocateStmt *a, DeallocateStmt *b) +{ + if (!equalstr(a->name, b->name)) + return false; + + return true; +} + +static bool _equalAExpr(A_Expr *a, A_Expr *b) { if (a->oper != b->oper) @@ -2249,6 +2286,15 @@ equal(void *a, void *b) case T_DropCastStmt: retval = _equalDropCastStmt(a, b); break; + case T_PrepareStmt: + retval = _equalPrepareStmt(a, b); + break; + case T_ExecuteStmt: + retval = _equalExecuteStmt(a, b); + break; + case T_DeallocateStmt: + retval = _equalDeallocateStmt(a, b); + break; case T_A_Expr: retval = _equalAExpr(a, b); |