MCPcopy Create free account
hub / github.com/apache/cloudberry / stringToNodeInternal

Function stringToNodeInternal

src/backend/nodes/read.c:72–111  ·  view source on GitHub ↗

* stringToNode - * builds a Node tree from its string representation (assumed valid) * * restore_loc_fields instructs readfuncs.c whether to restore location * fields rather than set them to -1. This is currently only supported * in builds with the WRITE_READ_PARSE_PLAN_TREES debugging flag set. */

Source from the content-addressed store, hash-verified

70 * in builds with the WRITE_READ_PARSE_PLAN_TREES debugging flag set.
71 */
72static void *
73stringToNodeInternal(const char *str, bool restore_loc_fields)
74{
75 void *retval;
76 const char *save_strtok;
77 const char *save_begin = pg_strtok_begin;
78#ifdef WRITE_READ_PARSE_PLAN_TREES
79 bool save_restore_location_fields;
80#endif
81
82 /*
83 * We save and restore the pre-existing state of pg_strtok. This makes the
84 * world safe for re-entrant invocation of stringToNode, without incurring
85 * a lot of notational overhead by having to pass the next-character
86 * pointer around through all the readfuncs.c code.
87 */
88 save_strtok = pg_strtok_ptr;
89
90 pg_strtok_ptr = str; /* point pg_strtok at the string to read */
91 pg_strtok_begin = str; /* CDB: save starting position for debug */
92
93 /*
94 * If enabled, likewise save/restore the location field handling flag.
95 */
96#ifdef WRITE_READ_PARSE_PLAN_TREES
97 save_restore_location_fields = restore_location_fields;
98 restore_location_fields = restore_loc_fields;
99#endif
100
101 retval = nodeRead(NULL, 0); /* do the reading */
102
103 pg_strtok_ptr = save_strtok;
104 pg_strtok_begin = save_begin;
105
106#ifdef WRITE_READ_PARSE_PLAN_TREES
107 restore_location_fields = save_restore_location_fields;
108#endif
109
110 return retval;
111}
112
113/*
114 * Externally visible entry points

Callers 2

stringToNodeFunction · 0.85

Calls 1

nodeReadFunction · 0.85

Tested by

no test coverage detected