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

Function check_partner_index

src/jrd/idx.cpp:1868–1996  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1866
1867
1868static idx_e check_partner_index(thread_db* tdbb,
1869 jrd_rel* relation,
1870 Record* record,
1871 jrd_tra* transaction,
1872 index_desc* idx,
1873 jrd_rel* partner_relation,
1874 USHORT index_id)
1875{
1876/**************************************
1877 *
1878 * c h e c k _ p a r t n e r _ i n d e x
1879 *
1880 **************************************
1881 *
1882 * Functional description
1883 * The passed index participates in a foreign key.
1884 * Check the passed record to see if a corresponding
1885 * record appears in the partner index.
1886 *
1887 **************************************/
1888 SET_TDBB(tdbb);
1889
1890 // get the index root page for the partner relation
1891
1892 WIN window(get_root_page(tdbb, partner_relation));
1893 index_root_page* root = (index_root_page*) CCH_FETCH(tdbb, &window, LCK_read, pag_root);
1894
1895 // get the description of the partner index
1896
1897 index_desc partner_idx;
1898 if (!BTR_description(tdbb, partner_relation, root, &partner_idx, index_id))
1899 {
1900 CCH_RELEASE(tdbb, &window);
1901 BUGCHECK(175); // msg 175 partner index description not found
1902 }
1903
1904 fb_assert(!(idx->idx_flags & idx_condition));
1905 fb_assert(!(partner_idx.idx_flags & idx_condition));
1906
1907 bool starting = false;
1908 USHORT segment;
1909
1910 if (!(partner_idx.idx_flags & idx_unique))
1911 {
1912 const index_desc::idx_repeat* idx_desc = partner_idx.idx_rpt;
1913 for (segment = 0; segment < partner_idx.idx_count; ++segment, ++idx_desc)
1914 {
1915 if (idx_desc->idx_itype >= idx_first_intl_string)
1916 {
1917 TextType* textType = INTL_texttype_lookup(tdbb, INTL_INDEX_TO_TEXT(idx_desc->idx_itype));
1918
1919 if (textType->getFlags() & TEXTTYPE_SEPARATE_UNIQUE)
1920 {
1921 starting = true;
1922 ++segment;
1923 break;
1924 }
1925 }

Callers 2

handlerMethod · 0.85
check_foreign_keyFunction · 0.85

Calls 14

SET_TDBBFunction · 0.85
get_root_pageFunction · 0.85
CCH_FETCHFunction · 0.85
BTR_descriptionFunction · 0.85
CCH_RELEASEFunction · 0.85
INTL_texttype_lookupFunction · 0.85
BTR_complement_keyFunction · 0.85
BTR_evaluateFunction · 0.85
check_duplicatesFunction · 0.85
getFlagsMethod · 0.45
composeMethod · 0.45
getDefaultPoolMethod · 0.45

Tested by

no test coverage detected