MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / HSH_insert

Function HSH_insert

src/gpre/hsh.cpp:109–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107//
108
109void HSH_insert( gpre_sym* symbol)
110{
111 const int h = hash(symbol->sym_string);
112
113 for (gpre_sym** next = &hash_table[h]; *next; next = &(*next)->sym_collision)
114 {
115 for (const gpre_sym* ptr = *next; ptr; ptr = ptr->sym_homonym)
116 {
117 if (ptr == symbol)
118 return;
119 }
120
121 if (scompare(symbol->sym_string, (*next)->sym_string))
122 {
123 // insert in most recently seen order;
124 // This is important for alias resolution in subqueries.
125 // BUT insert tokens AFTER keyword!
126 // In a lookup, keyword should be found first.
127 // This assumes that KEYWORDS are inserted before any other token.
128 // No one should be using a keywords as an alias anyway.
129
130 if ((*next)->sym_type == SYM_keyword)
131 {
132 symbol->sym_homonym = (*next)->sym_homonym;
133 symbol->sym_collision = NULL;
134 (*next)->sym_homonym = symbol;
135 }
136 else
137 {
138 symbol->sym_homonym = *next;
139 symbol->sym_collision = (*next)->sym_collision;
140 (*next)->sym_collision = NULL;
141 *next = symbol;
142 }
143 return;
144 }
145 }
146
147 symbol->sym_collision = hash_table[h];
148 hash_table[h] = symbol;
149}
150
151
152//____________________________________________________________

Callers 15

EXP_rseFunction · 0.85
HSH_initFunction · 0.85
act_d_sectionFunction · 0.85
act_declareFunction · 0.85
act_declare_tableFunction · 0.85
act_deleteFunction · 0.85
act_includeFunction · 0.85
act_updateFunction · 0.85
act_upsertFunction · 0.85
PAR_databaseFunction · 0.85
par_open_blobFunction · 0.85
par_storeFunction · 0.85

Calls 2

hashFunction · 0.70
scompareFunction · 0.70

Tested by

no test coverage detected