postgresql/src/include/commands/prepare.h

66 lines
2.3 KiB
C
Raw Normal View History

/*-------------------------------------------------------------------------
*
* prepare.h
* PREPARE, EXECUTE and DEALLOCATE commands, and prepared-stmt storage
*
*
2009-01-01 18:24:05 +01:00
* Copyright (c) 2002-2009, PostgreSQL Global Development Group
*
2009-01-01 18:24:05 +01:00
* $PostgreSQL: pgsql/src/include/commands/prepare.h,v 1.30 2009/01/01 17:23:58 momjian 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 */
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, 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, ExplainStmt *stmt,
2007-11-15 22:14:46 +01:00
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,
2003-08-04 02:43:34 +02:00
const char *query_string,
const char *commandTag,
Oid *param_types,
int num_params,
int cursor_options,
List *stmt_list,
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);
2007-11-15 22:14:46 +01:00
void DropAllPreparedStatements(void);
2002-09-04 22:31:48 +02:00
#endif /* PREPARE_H */