mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
reviewed by Neil Conway. This patch adds the following DDL command variants: RESET SESSION, RESET TEMP, RESET PLANS, CLOSE ALL, and DEALLOCATE ALL. RESET SESSION is intended for use by connection pool software and the like, in order to reset a client session to something close to its initial state. Note that while most of these command variants can be executed inside a transaction block (but are not transaction-aware!), RESET SESSION cannot. While this is inconsistent, it is intended to catch programmer mistakes: RESET SESSION in an open transaction block is probably unintended.
65 lines
2.2 KiB
C
65 lines
2.2 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* prepare.h
|
|
* PREPARE, EXECUTE and DEALLOCATE commands, and prepared-stmt storage
|
|
*
|
|
*
|
|
* Copyright (c) 2002-2007, PostgreSQL Global Development Group
|
|
*
|
|
* $PostgreSQL: pgsql/src/include/commands/prepare.h,v 1.26 2007/04/12 06:53:48 neilc Exp $
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef PREPARE_H
|
|
#define PREPARE_H
|
|
|
|
#include "executor/executor.h"
|
|
#include "utils/plancache.h"
|
|
#include "utils/timestamp.h"
|
|
|
|
/*
|
|
* The data structure representing a prepared statement. This is now just
|
|
* a thin veneer over a plancache entry --- the main addition is that of
|
|
* a name.
|
|
*
|
|
* Note: all subsidiary storage lives in the referenced plancache entry.
|
|
*/
|
|
typedef struct
|
|
{
|
|
/* dynahash.c requires key to be first field */
|
|
char stmt_name[NAMEDATALEN];
|
|
CachedPlanSource *plansource; /* the actual cached plan */
|
|
bool from_sql; /* prepared via SQL, not FE/BE protocol? */
|
|
TimestampTz prepare_time; /* the time when the stmt was prepared */
|
|
} PreparedStatement;
|
|
|
|
|
|
/* Utility statements PREPARE, EXECUTE, DEALLOCATE, EXPLAIN EXECUTE */
|
|
extern void PrepareQuery(PrepareStmt *stmt, const char *queryString);
|
|
extern void ExecuteQuery(ExecuteStmt *stmt, const char *queryString,
|
|
ParamListInfo params,
|
|
DestReceiver *dest, char *completionTag);
|
|
extern void DeallocateQuery(DeallocateStmt *stmt);
|
|
extern void ExplainExecuteQuery(ExecuteStmt *execstmt, ExplainStmt *stmt,
|
|
const char *queryString,
|
|
ParamListInfo params, TupOutputState *tstate);
|
|
|
|
/* Low-level access to stored prepared statements */
|
|
extern void StorePreparedStatement(const char *stmt_name,
|
|
Node *raw_parse_tree,
|
|
const char *query_string,
|
|
const char *commandTag,
|
|
Oid *param_types,
|
|
int num_params,
|
|
List *stmt_list,
|
|
bool from_sql);
|
|
extern PreparedStatement *FetchPreparedStatement(const char *stmt_name,
|
|
bool throwError);
|
|
extern void DropPreparedStatement(const char *stmt_name, bool showError);
|
|
extern TupleDesc FetchPreparedStatementResultDesc(PreparedStatement *stmt);
|
|
extern List *FetchPreparedStatementTargetList(PreparedStatement *stmt);
|
|
|
|
void DropAllPreparedStatements(void);
|
|
|
|
#endif /* PREPARE_H */
|