支持gms_sql高级包
This commit is contained in:
@ -144,6 +144,8 @@ extern void SPI_pfree(void* pointer);
|
||||
extern void SPI_freetuple(HeapTuple pointer);
|
||||
extern void SPI_freetuptable(SPITupleTable* tuptable);
|
||||
|
||||
extern Datum SPI_datumTransfer(Datum value, bool typByVal, int typLen);
|
||||
|
||||
extern Portal SPI_cursor_open(const char* name, SPIPlanPtr plan, Datum* Values, const char* Nulls, bool read_only);
|
||||
extern Portal SPI_cursor_open_with_args(const char* name, const char* src, int nargs, Oid* argtypes, Datum* Values,
|
||||
const char* Nulls, bool read_only, int cursorOptions, parse_query_func parser = GetRawParser());
|
||||
|
||||
@ -102,6 +102,7 @@ typedef struct knl_session_attr_common {
|
||||
int tcp_keepalives_count;
|
||||
int tcp_user_timeout;
|
||||
int GinFuzzySearchLimit;
|
||||
int maxOpenCursorCount;
|
||||
int server_version_num;
|
||||
int log_temp_files;
|
||||
int transaction_sync_naptime;
|
||||
|
||||
@ -28,6 +28,8 @@
|
||||
#ifndef PALLOC_H
|
||||
#define PALLOC_H
|
||||
#ifndef FRONTEND_PARSER
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include "postgres.h"
|
||||
#include "c.h"
|
||||
#include "nodes/nodes.h"
|
||||
@ -99,6 +101,21 @@ typedef struct McxtOperationMethods {
|
||||
void (*mcxt_check)(MemoryContext context, bool own_by_session);
|
||||
#endif
|
||||
} McxtOperationMethods;
|
||||
/*
|
||||
* A memory context can have callback functions registered on it. Any such
|
||||
* function will be called once just before the context is next reset or
|
||||
* deleted. The MemoryContextCallback struct describing such a callback
|
||||
* typically would be allocated within the context itself, thereby avoiding
|
||||
* any need to manage it explicitly (the reset/delete action will free it).
|
||||
*/
|
||||
|
||||
typedef void (*MemoryContextCallbackFunction) (std::shared_ptr<void> arg);
|
||||
|
||||
typedef struct MemoryContextCallback {
|
||||
MemoryContextCallbackFunction func; /* function to call */
|
||||
std::shared_ptr<void> arg; /* argument to pass it */
|
||||
struct MemoryContextCallback *next; /* next in list of callbacks */
|
||||
} MemoryContextCallback;
|
||||
|
||||
typedef struct MemoryContextData {
|
||||
NodeTag type; /* identifies exact kind of context */
|
||||
@ -114,6 +131,7 @@ typedef struct MemoryContextData {
|
||||
MemoryContext prevchild; /* previous child of same parent */
|
||||
MemoryContext nextchild; /* next child of same parent */
|
||||
char* name; /* context name (just for debugging) */
|
||||
MemoryContextCallback *resetCbs; /* list of reset/delete callbacks */
|
||||
pthread_rwlock_t lock; /* lock to protect members if the context is shared */
|
||||
int level; /* context level */
|
||||
uint64 session_id; /* session id of context owner */
|
||||
@ -140,6 +158,7 @@ extern THR_LOCAL PGDLLIMPORT MemoryContext TopMemoryContext;
|
||||
const uint64 BlkMagicNum = 0xDADADADADADADADA;
|
||||
const uint32 PremagicNum = 0xBABABABA;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Flags for MemoryContextAllocExtended.
|
||||
*/
|
||||
@ -308,6 +327,10 @@ static inline MemoryContext MemoryContextSwitchTo(MemoryContext context)
|
||||
extern MemoryContext MemoryContextSwitchTo(MemoryContext context);
|
||||
#endif /* USE_INLINE && !FRONTEND */
|
||||
|
||||
/* Registration of memory context reset/delete callbacks */
|
||||
extern void MemoryContextRegisterResetCallback(MemoryContext context,
|
||||
MemoryContextCallback *cb);
|
||||
|
||||
/*
|
||||
* These are like standard strdup() except the copied string is
|
||||
* allocated in a context, not with malloc().
|
||||
|
||||
Reference in New Issue
Block a user