]> granicus.if.org Git - postgresql/blob - src/include/commands/prepare.h
Another pgindent run with updated typedefs.
[postgresql] / src / include / commands / prepare.h
1 /*-------------------------------------------------------------------------
2  *
3  * prepare.h
4  *        PREPARE, EXECUTE and DEALLOCATE commands, and prepared-stmt storage
5  *
6  *
7  * Copyright (c) 2002-2003, PostgreSQL Global Development Group
8  *
9  * $Id: prepare.h,v 1.8 2003/08/08 21:42:40 momjian Exp $
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef PREPARE_H
14 #define PREPARE_H
15
16 #include "executor/executor.h"
17 #include "nodes/parsenodes.h"
18 #include "tcop/dest.h"
19
20
21 /*
22  * The data structure representing a prepared statement
23  *
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.
29  */
30 typedef struct
31 {
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 */
40 } PreparedStatement;
41
42
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);
48
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,
53                                            List *query_list,
54                                            List *plan_list,
55                                            List *argtype_list);
56 extern PreparedStatement *FetchPreparedStatement(const char *stmt_name,
57                                            bool throwError);
58 extern void DropPreparedStatement(const char *stmt_name, bool showError);
59 extern List *FetchPreparedStatementParams(const char *stmt_name);
60 extern TupleDesc FetchPreparedStatementResultDesc(PreparedStatement *stmt);
61
62 #endif   /* PREPARE_H */