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

Method init

src/dsql/ExprNodes.cpp:216–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216const SortedValueList* LookupValueList::init(thread_db* tdbb, Request* request) const
217{
218 auto createList = [&]()
219 {
220 const auto sortedList = FB_NEW_POOL(*tdbb->getDefaultPool())
221 SortedValueList(*tdbb->getDefaultPool(), m_values.getCount());
222
223 sortedList->setSortMode(FB_ARRAY_SORT_MANUAL);
224
225 for (const auto value : m_values)
226 {
227 const auto valueDesc = EVL_expr(tdbb, request, value);
228 sortedList->add(SortValueItem(value, valueDesc));
229 }
230
231 sortedList->sort();
232
233 return sortedList;
234 };
235
236 // Non-zero impure offset means that the list expression is invariant,
237 // so the sorted list can be cached inside the impure area
238
239 if (m_impureOffset)
240 {
241 const auto impure = request->getImpure<impure_value>(m_impureOffset);
242 auto sortedList = impure->vlu_misc.vlu_sortedList;
243
244 if (!(impure->vlu_flags & VLU_computed))
245 {
246 delete impure->vlu_misc.vlu_sortedList;
247 impure->vlu_misc.vlu_sortedList = nullptr;
248
249 sortedList = impure->vlu_misc.vlu_sortedList = createList();
250 impure->vlu_flags |= VLU_computed;
251 }
252
253 return sortedList;
254 }
255
256 // Otherwise, create a temporary list for early evaluation during index lookup
257
258 return createList();
259}
260
261bool LookupValueList::find(thread_db* tdbb, Request* request, const ValueExprNode* value, const dsc* desc) const
262{

Callers 3

doExecuteMethod · 0.45
executeMethod · 0.45
testAndFixupErrorMethod · 0.45

Calls 7

EVL_exprFunction · 0.85
SortValueItemClass · 0.85
getDefaultPoolMethod · 0.45
getCountMethod · 0.45
setSortModeMethod · 0.45
addMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected