gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.2KB

  1. /*-------------------------------------------------------------------------
  2. *
  3. * prepare.h
  4. * PREPARE, EXECUTE and DEALLOCATE commands, and prepared-stmt storage
  5. *
  6. *
  7. * Copyright (c) 2002-2019, PostgreSQL Global Development Group
  8. *
  9. * src/include/commands/prepare.h
  10. *
  11. *-------------------------------------------------------------------------
  12. */
  13. #ifndef PREPARE_H
  14. #define PREPARE_H
  15. #include "commands/explain.h"
  16. #include "datatype/timestamp.h"
  17. #include "utils/plancache.h"
  18. /*
  19. * The data structure representing a prepared statement. This is now just
  20. * a thin veneer over a plancache entry --- the main addition is that of
  21. * a name.
  22. *
  23. * Note: all subsidiary storage lives in the referenced plancache entry.
  24. */
  25. typedef struct
  26. {
  27. /* dynahash.c requires key to be first field */
  28. char stmt_name[NAMEDATALEN];
  29. CachedPlanSource *plansource; /* the actual cached plan */
  30. bool from_sql; /* prepared via SQL, not FE/BE protocol? */
  31. TimestampTz prepare_time; /* the time when the stmt was prepared */
  32. } PreparedStatement;
  33. /* Utility statements PREPARE, EXECUTE, DEALLOCATE, EXPLAIN EXECUTE */
  34. extern void PrepareQuery(PrepareStmt *stmt, const char *queryString,
  35. int stmt_location, int stmt_len);
  36. extern void ExecuteQuery(ExecuteStmt *stmt, IntoClause *intoClause,
  37. const char *queryString, ParamListInfo params,
  38. DestReceiver *dest, char *completionTag);
  39. extern void DeallocateQuery(DeallocateStmt *stmt);
  40. extern void ExplainExecuteQuery(ExecuteStmt *execstmt, IntoClause *into,
  41. ExplainState *es, const char *queryString,
  42. ParamListInfo params, QueryEnvironment *queryEnv);
  43. /* Low-level access to stored prepared statements */
  44. extern void StorePreparedStatement(const char *stmt_name,
  45. CachedPlanSource *plansource,
  46. bool from_sql);
  47. extern PreparedStatement *FetchPreparedStatement(const char *stmt_name,
  48. bool throwError);
  49. extern void DropPreparedStatement(const char *stmt_name, bool showError);
  50. extern TupleDesc FetchPreparedStatementResultDesc(PreparedStatement *stmt);
  51. extern List *FetchPreparedStatementTargetList(PreparedStatement *stmt);
  52. extern void DropAllPreparedStatements(void);
  53. #endif /* PREPARE_H */
上海开阖软件有限公司 沪ICP备12045867号-1