mirror of
https://github.com/postgres/postgres.git
synced 2025-08-22 21:53:06 +03:00
PREPARE/EXECUTE statements. Patch by Neil Conway, some kibitzing
from Tom Lane.
This commit is contained in:
@@ -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);
|
||||
|
@@ -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 $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1490,6 +1490,43 @@ _equalDropCastStmt(DropCastStmt *a, DropCastStmt *b)
|
||||
return true;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -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);
|
||||
|
Reference in New Issue
Block a user