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

Function act_alter_table

src/gpre/sql.cpp:1353–1458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1351//
1352
1353static act* act_alter_table()
1354{
1355 // create request block
1356
1357 gpre_req* request = MSC_request(REQ_ddl);
1358
1359 // get table name and create relation block
1360
1361 gpre_rel* relation = par_relation(request);
1362
1363 // CHECK Constraints require the context to be set to the
1364 // current relation
1365
1366 gpre_ctx* context = MSC_context(request);
1367 request->req_contexts = context;
1368 context->ctx_relation = relation;
1369
1370 // Reserve context 1 for relation on which constraint is
1371 // being defined
1372
1373 context->ctx_internal++;
1374 request->req_internal++;
1375
1376 // create action block
1377
1378 act* action = MSC_action(request, ACT_alter_table);
1379 action->act_whenever = gen_whenever();
1380 action->act_object = (ref*) relation;
1381
1382 // parse action list and create corresponding field blocks
1383
1384 gpre_fld** ptr = &relation->rel_fields;
1385 cnstrt** cnstrt_ptr = &relation->rel_constraints;
1386 cnstrt* cnstrt_str;
1387 gpre_fld* field;
1388
1389 while (!end_of_command())
1390 {
1391 if (MSC_match(KW_ADD))
1392 {
1393 switch (gpreGlob.token_global.tok_keyword)
1394 {
1395 case KW_CONSTRAINT:
1396 case KW_PRIMARY:
1397 case KW_UNIQUE:
1398 case KW_FOREIGN:
1399 case KW_CHECK:
1400 cnstrt_str = par_table_constraint(request);
1401 *cnstrt_ptr = cnstrt_str;
1402 cnstrt_ptr = &cnstrt_str->cnstrt_next;
1403 break;
1404
1405 default:
1406 field = par_field(request, relation);
1407 *ptr = field;
1408 ptr = &field->fld_next;
1409 }
1410 }

Callers 1

act_alterFunction · 0.85

Calls 15

MSC_requestFunction · 0.85
par_relationFunction · 0.85
MSC_contextFunction · 0.85
MSC_actionFunction · 0.85
end_of_commandFunction · 0.85
MSC_matchFunction · 0.85
par_table_constraintFunction · 0.85
PAR_get_tokenFunction · 0.85
MSC_allocFunction · 0.85
SQL_resolve_identifierFunction · 0.85
make_fieldFunction · 0.85
CPR_s_errorFunction · 0.85

Tested by

no test coverage detected