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

Function act_create_index

src/gpre/sql.cpp:1896–1943  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1894//
1895
1896static act* act_create_index(bool dups, bool descending)
1897{
1898 // create request block
1899
1900 gpre_req* request = MSC_request(REQ_ddl);
1901
1902 // get index and table names and create index and relation blocks
1903
1904 SCHAR i_name[NAME_SIZE + 1];
1905 SQL_resolve_identifier("<index name>", i_name, NAME_SIZE + 1);
1906 if (gpreGlob.token_global.tok_length >= NAME_SIZE)
1907 PAR_error("Index name too long");
1908
1909 PAR_get_token();
1910
1911 if (!MSC_match(KW_ON))
1912 CPR_s_error("ON");
1913
1914 gpre_rel* relation = par_relation(request);
1915
1916 gpre_index* index = make_index(request, i_name);
1917 index->ind_relation = relation;
1918 index->ind_flags |= dups ? IND_dup_flag : 0;
1919 index->ind_flags |= descending ? IND_descend : 0;
1920
1921 // create action block
1922
1923 act* action = MSC_action(request, ACT_create_index);
1924 action->act_whenever = gen_whenever();
1925 action->act_object = (ref*) index;
1926
1927 // parse field list and create corresponding field blocks
1928
1929 EXP_left_paren(0);
1930 gpre_fld** ptr = &index->ind_fields;
1931
1932 for (;;)
1933 {
1934 *ptr = make_field(relation);
1935 ptr = &(*ptr)->fld_next;
1936 if (!MSC_match(KW_COMMA))
1937 break;
1938 }
1939
1940 EXP_match_paren();
1941
1942 return action;
1943}
1944
1945
1946//____________________________________________________________

Callers 1

act_createFunction · 0.85

Calls 13

MSC_requestFunction · 0.85
SQL_resolve_identifierFunction · 0.85
PAR_get_tokenFunction · 0.85
MSC_matchFunction · 0.85
CPR_s_errorFunction · 0.85
par_relationFunction · 0.85
make_indexFunction · 0.85
MSC_actionFunction · 0.85
EXP_left_parenFunction · 0.85
make_fieldFunction · 0.85
EXP_match_parenFunction · 0.85
PAR_errorFunction · 0.70

Tested by

no test coverage detected