⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plpgsql.h

📁 PostgreSQL 8.1.4的源码 适用于Linux下的开源数据库系统
💻 H
📖 第 1 页 / 共 2 页
字号:
/********************************************************************** * plpgsql.h		- Definitions for the PL/pgSQL *			  procedural language * * IDENTIFICATION *	  $PostgreSQL: pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.65.2.2 2006/03/02 05:34:17 tgl Exp $ * *	  This software is copyrighted by Jan Wieck - Hamburg. * *	  The author hereby grants permission  to  use,  copy,	modify, *	  distribute,  and	license this software and its documentation *	  for any purpose, provided that existing copyright notices are *	  retained	in	all  copies  and  that	this notice is included *	  verbatim in any distributions. No written agreement, license, *	  or  royalty  fee	is required for any of the authorized uses. *	  Modifications to this software may be  copyrighted  by  their *	  author  and  need  not  follow  the licensing terms described *	  here, provided that the new terms are  clearly  indicated  on *	  the first page of each file where they apply. * *	  IN NO EVENT SHALL THE AUTHOR OR DISTRIBUTORS BE LIABLE TO ANY *	  PARTY  FOR  DIRECT,	INDIRECT,	SPECIAL,   INCIDENTAL,	 OR *	  CONSEQUENTIAL   DAMAGES  ARISING	OUT  OF  THE  USE  OF  THIS *	  SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN *	  IF  THE  AUTHOR  HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH *	  DAMAGE. * *	  THE  AUTHOR  AND	DISTRIBUTORS  SPECIFICALLY	 DISCLAIM	ANY *	  WARRANTIES,  INCLUDING,  BUT	NOT  LIMITED  TO,  THE	IMPLIED *	  WARRANTIES  OF  MERCHANTABILITY,	FITNESS  FOR  A  PARTICULAR *	  PURPOSE,	AND NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON *	  AN "AS IS" BASIS, AND THE AUTHOR	AND  DISTRIBUTORS  HAVE  NO *	  OBLIGATION   TO	PROVIDE   MAINTENANCE,	 SUPPORT,  UPDATES, *	  ENHANCEMENTS, OR MODIFICATIONS. * **********************************************************************/#ifndef PLPGSQL_H#define PLPGSQL_H#include "postgres.h"#include "fmgr.h"#include "miscadmin.h"#include "executor/spi.h"#include "commands/trigger.h"#include "utils/tuplestore.h"/********************************************************************** * Definitions **********************************************************************//* ---------- * Compiler's namestack item types * ---------- */enum{	PLPGSQL_NSTYPE_LABEL,	PLPGSQL_NSTYPE_VAR,	PLPGSQL_NSTYPE_ROW,	PLPGSQL_NSTYPE_REC};/* ---------- * Datum array node types * ---------- */enum{	PLPGSQL_DTYPE_VAR,	PLPGSQL_DTYPE_ROW,	PLPGSQL_DTYPE_REC,	PLPGSQL_DTYPE_RECFIELD,	PLPGSQL_DTYPE_ARRAYELEM,	PLPGSQL_DTYPE_EXPR,	PLPGSQL_DTYPE_TRIGARG};/* ---------- * Variants distinguished in PLpgSQL_type structs * ---------- */enum{	PLPGSQL_TTYPE_SCALAR,		/* scalar types and domains */	PLPGSQL_TTYPE_ROW,			/* composite types */	PLPGSQL_TTYPE_REC,			/* RECORD pseudotype */	PLPGSQL_TTYPE_PSEUDO		/* other pseudotypes */};/* ---------- * Execution tree node types * ---------- */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_RETURN_NEXT,	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_PERFORM};/* ---------- * Execution node return codes * ---------- */enum{	PLPGSQL_RC_OK,	PLPGSQL_RC_EXIT,	PLPGSQL_RC_RETURN,	PLPGSQL_RC_CONTINUE};/* ---------- * GET DIAGNOSTICS system attrs * ---------- */enum{	PLPGSQL_GETDIAG_ROW_COUNT,	PLPGSQL_GETDIAG_RESULT_OID};/********************************************************************** * Node and structure definitions **********************************************************************/typedef struct{								/* Dynamic string control structure */	int			alloc;	int			used;			/* Including NUL terminator */	char	   *value;} PLpgSQL_dstring;typedef struct{								/* Postgres data type */	char	   *typname;		/* (simple) name of the type */	Oid			typoid;			/* OID of the data type */	int			ttype;			/* PLPGSQL_TTYPE_ code */	int16		typlen;			/* stuff copied from its pg_type entry */	bool		typbyval;	Oid			typrelid;	Oid			typioparam;	FmgrInfo	typinput;		/* lookup info for typinput function */	int32		atttypmod;		/* typmod (taken from someplace else) */} PLpgSQL_type;/* * PLpgSQL_datum is the common supertype for PLpgSQL_expr, PLpgSQL_var, * PLpgSQL_row, PLpgSQL_rec, PLpgSQL_recfield, PLpgSQL_arrayelem, and * PLpgSQL_trigarg */typedef struct{								/* Generic datum array item		*/	int			dtype;	int			dno;} PLpgSQL_datum;/* * The variants PLpgSQL_var, PLpgSQL_row, and PLpgSQL_rec share these * fields */typedef struct{								/* Scalar or composite variable */	int			dtype;	int			dno;	char	   *refname;	int			lineno;} PLpgSQL_variable;typedef struct PLpgSQL_expr{								/* SQL Query to plan and execute	*/	int			dtype;	int			exprno;	char	   *query;	void	   *plan;	Oid		   *plan_argtypes;	/* fields for "simple expression" fast-path execution: */	Expr	   *expr_simple_expr;		/* NULL means not a simple expr */	Oid			expr_simple_type;	/*	 * if expr is simple AND in use in current xact, expr_simple_state is	 * valid.  Test validity by seeing if expr_simple_xid matches current XID.	 */	ExprState  *expr_simple_state;	TransactionId expr_simple_xid;	/* params to pass to expr */	int			nparams;	int			params[1];		/* VARIABLE SIZE ARRAY ... must be last */} PLpgSQL_expr;typedef struct{								/* Scalar variable */	int			dtype;	int			varno;	char	   *refname;	int			lineno;	PLpgSQL_type *datatype;	int			isconst;	int			notnull;	PLpgSQL_expr *default_val;	PLpgSQL_expr *cursor_explicit_expr;	int			cursor_explicit_argrow;	Datum		value;	bool		isnull;	bool		freeval;} PLpgSQL_var;typedef struct{								/* Row variable */	int			dtype;	int			rowno;	char	   *refname;	int			lineno;	TupleDesc	rowtupdesc;	/*	 * Note: TupleDesc is only set up for named rowtypes, else it is NULL.	 *	 * Note: if the underlying rowtype contains a dropped column, the	 * corresponding fieldnames[] entry will be NULL, and there is no	 * corresponding var (varnos[] will be -1).	 */	int			nfields;	char	  **fieldnames;	int		   *varnos;} PLpgSQL_row;typedef struct{								/* Record variable (non-fixed structure) */	int			dtype;	int			recno;	char	   *refname;	int			lineno;	HeapTuple	tup;	TupleDesc	tupdesc;	bool		freetup;	bool		freetupdesc;} PLpgSQL_rec;typedef struct{								/* Field in record */	int			dtype;	int			rfno;	char	   *fieldname;	int			recparentno;	/* dno of parent record */} PLpgSQL_recfield;typedef struct{								/* Element of array variable */	int			dtype;	int			dno;	PLpgSQL_expr *subscript;	int			arrayparentno;	/* dno of parent array variable */} PLpgSQL_arrayelem;typedef struct{								/* Positional argument to trigger	*/	int			dtype;	int			dno;	PLpgSQL_expr *argnum;} PLpgSQL_trigarg;typedef struct{								/* Item in the compilers namestack	*/	int			itemtype;	int			itemno;	char		name[1];} PLpgSQL_nsitem;/* XXX: consider adapting this to use List */typedef struct PLpgSQL_ns{								/* Compiler namestack level		*/	int			items_alloc;	int			items_used;	PLpgSQL_nsitem **items;	struct PLpgSQL_ns *upper;} PLpgSQL_ns;typedef struct{								/* Generic execution node		*/	int			cmd_type;	int			lineno;} PLpgSQL_stmt;typedef struct PLpgSQL_condition{								/* One EXCEPTION condition name */	int			sqlerrstate;	/* SQLSTATE code */	char	   *condname;		/* condition name (for debugging) */	struct PLpgSQL_condition *next;} PLpgSQL_condition;typedef struct{	int			sqlstate_varno;	int			sqlerrm_varno;	List	   *exc_list;		/* List of WHEN clauses */} PLpgSQL_exception_block;typedef struct{								/* One EXCEPTION ... WHEN clause */	int			lineno;	PLpgSQL_condition *conditions;	List	   *action;			/* List of statements */} PLpgSQL_exception;typedef struct{								/* Block of statements			*/	int			cmd_type;	int			lineno;	char	   *label;	List	   *body;			/* List of statements */	int			n_initvars;	int		   *initvarnos;	PLpgSQL_exception_block *exceptions;} PLpgSQL_stmt_block;typedef struct{								/* Assign statement			*/	int			cmd_type;	int			lineno;	int			varno;	PLpgSQL_expr *expr;} PLpgSQL_stmt_assign;typedef struct{								/* PERFORM statement		*/	int			cmd_type;	int			lineno;	PLpgSQL_expr *expr;} PLpgSQL_stmt_perform;typedef struct{								/* Get Diagnostics item		*/	int			kind;			/* id for diagnostic value desired */	int			target;			/* where to assign it */} PLpgSQL_diag_item;typedef struct{								/* Get Diagnostics statement		*/	int			cmd_type;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -