1 /*-------------------------------------------------------------------------
4 * PREPARE, EXECUTE and DEALLOCATE commands, and prepared-stmt storage
7 * Copyright (c) 2002-2003, PostgreSQL Global Development Group
9 * $Id: prepare.h,v 1.8 2003/08/08 21:42:40 momjian Exp $
11 *-------------------------------------------------------------------------
16 #include "executor/executor.h"
17 #include "nodes/parsenodes.h"
18 #include "tcop/dest.h"
22 * The data structure representing a prepared statement
24 * Note: all subsidiary storage lives in the context denoted by the context
25 * field. However, the string referenced by commandTag is not subsidiary
26 * storage; it is assumed to be a compile-time-constant string. As with
27 * portals, commandTag shall be NULL if and only if the original query string
28 * (before rewriting) was an empty string.
32 /* dynahash.c requires key to be first field */
33 char stmt_name[NAMEDATALEN];
34 char *query_string; /* text of query, or NULL */
35 const char *commandTag; /* command tag (a constant!), or NULL */
36 List *query_list; /* list of queries */
37 List *plan_list; /* list of plans */
38 List *argtype_list; /* list of parameter type OIDs */
39 MemoryContext context; /* context containing this query */
43 /* Utility statements PREPARE, EXECUTE, DEALLOCATE, EXPLAIN EXECUTE */
44 extern void PrepareQuery(PrepareStmt *stmt);
45 extern void ExecuteQuery(ExecuteStmt *stmt, DestReceiver *dest);
46 extern void DeallocateQuery(DeallocateStmt *stmt);
47 extern void ExplainExecuteQuery(ExplainStmt *stmt, TupOutputState *tstate);
49 /* Low-level access to stored prepared statements */
50 extern void StorePreparedStatement(const char *stmt_name,
51 const char *query_string,
52 const char *commandTag,
56 extern PreparedStatement *FetchPreparedStatement(const char *stmt_name,
58 extern void DropPreparedStatement(const char *stmt_name, bool showError);
59 extern List *FetchPreparedStatementParams(const char *stmt_name);
60 extern TupleDesc FetchPreparedStatementResultDesc(PreparedStatement *stmt);
62 #endif /* PREPARE_H */