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

Method init

src/jrd/idx.cpp:323–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321 }
322
323 bool init(thread_db* tdbb)
324 {
325 FbStatusVector* status = tdbb->tdbb_status_vector;
326 Attachment* att = NULL;
327
328 if (m_ownAttach && !m_attStable.hasData())
329 m_attStable = WorkerAttachment::getAttachment(status, getTask()->m_dbb);
330
331 if (m_attStable)
332 att = m_attStable->getHandle();
333
334 if (!att)
335 {
336 if (!status->hasData())
337 Arg::Gds(isc_bad_db_handle).copyTo(status);
338
339 return false;
340 }
341
342 if (getTask()->isGbak())
343 att->att_utility = Attachment::UTIL_GBAK;
344
345 IndexCreation* creation = getTask()->m_creation;
346 tdbb->setDatabase(att->att_database);
347 tdbb->setAttachment(att);
348
349 if (m_ownAttach && !m_tra)
350 {
351 try
352 {
353 WorkerContextHolder holder(tdbb, FB_FUNCTION);
354 m_tra = TRA_start(tdbb, creation->transaction->tra_flags,
355 creation->transaction->tra_lock_timeout);
356 }
357 catch (const Exception& ex)
358 {
359 ex.stuffException(tdbb->tdbb_status_vector);
360 return false;
361 }
362 }
363
364 tdbb->setTransaction(m_tra);
365
366 if (!m_sort)
367 {
368 m_idx = *creation->index; // copy
369 if (m_ownAttach)
370 {
371 m_idx.idx_expression = NULL;
372 m_idx.idx_expression_statement = NULL;
373 m_idx.idx_condition = NULL;
374 m_idx.idx_condition_statement = NULL;
375 m_idx.idx_foreign_indexes = NULL;
376 m_idx.idx_foreign_primaries = NULL;
377 m_idx.idx_foreign_relations = NULL;
378 }
379
380 FPTR_REJECT_DUP_CALLBACK callback = NULL;

Callers 2

handlerMethod · 0.45
getResultMethod · 0.45

Calls 12

GdsClass · 0.85
TRA_startFunction · 0.85
setDatabaseMethod · 0.80
addPartitionMethod · 0.80
SortClass · 0.70
hasDataMethod · 0.45
getHandleMethod · 0.45
copyToMethod · 0.45
isGbakMethod · 0.45
setAttachmentMethod · 0.45
stuffExceptionMethod · 0.45
setTransactionMethod · 0.45

Tested by

no test coverage detected