-
Notifications
You must be signed in to change notification settings - Fork 5
/
ifx_node_utils.h
112 lines (97 loc) · 3.5 KB
/
ifx_node_utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*-------------------------------------------------------------------------
*
* ifx_node_utils.h
* Utility functions for Informix FDW and node support.
*
* Copyright (c) 2012, credativ GmbH
*
* IDENTIFICATION
* informix_fdw/ifx_node_utils.h
*
*-------------------------------------------------------------------------
*/
#ifndef HAVE_IFX_NODE_UTILS_H
#define HAVE_IFX_NODE_UTILS_H
#include "foreign/fdwapi.h"
#include "foreign/foreign.h"
#include "nodes/nodes.h"
#include "utils/bytea.h"
/*******************************************************************************
* Helper macros.
*/
#define makeFdwStringConst(_field_)\
makeConst(TEXTOID, -1, InvalidOid, -1,\
PointerGetDatum(cstring_to_text(_field_)), \
false, false)
#define makeFdwInt16Const(_field_)\
makeConst(INT2OID, -1, InvalidOid, sizeof(int16),\
Int16GetDatum(_field_),\
false, true)
#define makeFdwInt32Const(_field_)\
makeConst(INT4OID, -1, InvalidOid, sizeof(int32),\
Int32GetDatum(_field_),\
false, true)
/*
* Number of serialized Const nodes passed
* from ifxPlanForeignScan()
*/
#define N_SERIALIZED_FIELDS 11
/*
* Identifier for serialized Const fields
*
* Don't forget to set N_SERIALIZED_FIELDS accordingly
* to the number of fields if adding/removing one!
*/
#define SERIALIZED_PLAN_DATA 0
#define SERIALIZED_QUERY 1
#define SERIALIZED_STMT_NAME 2
#define SERIALIZED_CURSOR_NAME 3
#define SERIALIZED_CALLSTACK 4
#define SERIALIZED_QUALS 5
#define SERIALIZED_CURSOR_TYPE 6
#define SERIALIZED_SPECIAL_COLS 7
#define SERIALIZED_REFID 8
#define SERIALIZED_USE_ROWID 9
#define SERIALIZED_HAS_AFTER_TRIGGERS 10
#define SERIALIZED_DATA(_vals_) Const * (_vals_)[N_SERIALIZED_FIELDS]
#define AFFECTED_ATTR_NUMS_IDX (N_SERIALIZED_FIELDS)
/*******************************************************************************
* Node helper functions.
*/
List * ifxSerializePlanData(IfxConnectionInfo *coninfo,
IfxFdwExecutionState *state,
PlannerInfo *plan);
void
ifxDeserializePlanData(IfxPlanData *planData,
void *fdw_private);
void ifxDeserializeFdwData(IfxFdwExecutionState *state,
void *fdw_private);
int16 ifxGetSerializedInt16Field(List *list, int ident);
int ifxGetSerializedInt32Field(List *list, int ident);
char * ifxGetSerializedStringField(List *list, int ident);
Datum ifxSetSerializedInt32Field(List *list, int ident, int value);
Datum ifxSetSerializedInt16Field(List *list, int ident, int16 value);
void ifxGenerateUpdateSql(IfxFdwExecutionState *state,
IfxConnectionInfo *coninfo,
PlannerInfo *root,
Index rtindex);
void ifxGenerateInsertSql(IfxFdwExecutionState *state,
IfxConnectionInfo *coninfo,
PlannerInfo *root,
Index rtindex);
char *ifxGetIntervalFormatString(IfxTemporalRange range, IfxFormatMode mode);
char *ifxQuoteIdent(IfxConnectionInfo *coninfo, char *ident);
#if PG_VERSION_NUM >= 90500
char *ifxGetTableImportListSQL(IfxConnectionInfo *coninfo,
ImportForeignSchemaStmt *stmt);
char *ifxGetTableListAsStringConn(IfxConnectionInfo *coninfo,
List *table_list);
char *ifxGetTableDetailsSQL(IfxSourceType tabid);
List *ifxCreateImportScript(IfxConnectionInfo *coninfo,
ImportForeignSchemaStmt *stmt,
List *candidates,
Oid serverOid);
Oid ifxTypeidToPg(IfxSourceType typid, IfxExtendedType extended_id);
char *ifxMakeColTypeDeclaration(IfxAttrDef *colDef);
#endif
#endif