postgresql/src/include/commands/prepare.h

60 lines
2.1 KiB
C
Raw Normal View History

/*-------------------------------------------------------------------------
*
* prepare.h
* PREPARE, EXECUTE and DEALLOCATE commands, and prepared-stmt storage
*
*
2017-01-03 19:48:53 +01:00
* Copyright (c) 2002-2017, PostgreSQL Global Development Group
*
2010-09-20 22:08:53 +02:00
* src/include/commands/prepare.h
*
*-------------------------------------------------------------------------
*/
#ifndef PREPARE_H
#define PREPARE_H
#include "commands/explain.h"
#include "datatype/timestamp.h"
#include "utils/plancache.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 */
2006-10-04 02:30:14 +02:00
char stmt_name[NAMEDATALEN];
2007-11-15 22:14:46 +01:00
CachedPlanSource *plansource; /* the actual cached plan */
bool from_sql; /* prepared via SQL, not FE/BE protocol? */
2006-10-04 02:30:14 +02:00
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, IntoClause *intoClause,
const char *queryString, ParamListInfo params,
2006-10-04 02:30:14 +02:00
DestReceiver *dest, char *completionTag);
extern void DeallocateQuery(DeallocateStmt *stmt);
extern void ExplainExecuteQuery(ExecuteStmt *execstmt, IntoClause *into,
ExplainState *es,
const char *queryString, ParamListInfo params);
/* Low-level access to stored prepared statements */
extern void StorePreparedStatement(const char *stmt_name,
CachedPlanSource *plansource,
bool from_sql);
extern PreparedStatement *FetchPreparedStatement(const char *stmt_name,
2003-08-04 02:43:34 +02:00
bool throwError);
extern void DropPreparedStatement(const char *stmt_name, bool showError);
extern TupleDesc FetchPreparedStatementResultDesc(PreparedStatement *stmt);
extern List *FetchPreparedStatementTargetList(PreparedStatement *stmt);
extern void DropAllPreparedStatements(void);
2002-09-04 22:31:48 +02:00
#endif /* PREPARE_H */