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

Method handler

src/jrd/idx.cpp:447–760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445};
446
447bool IndexCreateTask::handler(WorkItem& _item)
448{
449 Item* item = reinterpret_cast<Item*>(&_item);
450
451 ThreadContextHolder tdbb(NULL);
452 tdbb->tdbb_flags = m_tdbb_flags;
453
454 if (!item->init(tdbb))
455 {
456 setError(tdbb->tdbb_status_vector, true);
457 return false;
458 }
459
460 try {
461
462 WorkerContextHolder holder(tdbb, FB_FUNCTION);
463
464 Database* dbb = tdbb->getDatabase();
465 Attachment* attachment = tdbb->getAttachment();
466 jrd_rel* relation = MET_relation(tdbb, m_creation->relation->rel_id);
467 if (!(relation->rel_flags & REL_scanned))
468 MET_scan_relation(tdbb, relation);
469
470 index_desc* idx = &item->m_idx;
471 jrd_tra* transaction = item->m_tra ? item->m_tra : m_creation->transaction;
472 Sort* scb = item->m_sort;
473
474 RecordStack stack;
475 record_param primary, secondary;
476 secondary.rpb_relation = relation;
477 primary.rpb_relation = relation;
478 primary.rpb_number.setValue(BOF_NUMBER);
479 //primary.getWindow(tdbb).win_flags = secondary.getWindow(tdbb).win_flags = 0; redundant
480
481 IndexErrorContext context(relation, idx, m_creation->index_name);
482
483 // If scan is finished, do final sort pass over own sort
484 if (item->m_ppSequence == m_countPP)
485 {
486 //fb_assert((scb->scb_flags & scb_sorted) == 0);
487
488 if (item->m_ownAttach && idx->idx_expression_statement)
489 {
490 idx->idx_expression_statement->release(tdbb);
491 idx->idx_expression_statement = NULL;
492 }
493
494 if (!m_stop && m_creation->duplicates.value() == 0)
495 scb->sort(tdbb);
496
497 if (!m_stop && m_creation->duplicates.value() > 0)
498 {
499 AutoPtr<Record> error_record;
500 primary.rpb_record = NULL;
501 fb_assert(m_creation->dup_recno >= 0);
502 primary.rpb_number.setValue(m_creation->dup_recno);
503
504 if (DPM_get(tdbb, &primary, LCK_read))

Callers

nothing calls this directly

Calls 15

CCH_RELEASEFunction · 0.85
VIO_dataFunction · 0.85
VIO_gc_recordFunction · 0.85
VIO_garbage_collectFunction · 0.85
VIO_intermediate_gcFunction · 0.85
GdsClass · 0.85
StrClass · 0.85
check_partner_indexFunction · 0.85
JRD_rescheduleFunction · 0.85
getDatabaseMethod · 0.80
isAssignedMethod · 0.80
getNullSegmentMethod · 0.80

Tested by

no test coverage detected