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

Function SQL_relation_name

src/gpre/sql.cpp:1002–1041  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1000//
1001
1002void SQL_relation_name(TEXT* r_name, TEXT* db_name, TEXT* owner_name)
1003{
1004 db_name[0] = 0;
1005 owner_name[0] = 0;
1006
1007 SQL_resolve_identifier("<Database name>", NULL, NAME_SIZE + 1);
1008 if (gpreGlob.token_global.tok_length >= NAME_SIZE)
1009 PAR_error("Database alias too long");
1010
1011 gpre_sym* symbol = MSC_find_symbol(gpreGlob.token_global.tok_symbol, SYM_database);
1012 if (symbol)
1013 {
1014 if (strlen(symbol->sym_name) >= unsigned(NAME_SIZE))
1015 PAR_error("Database alias too long");
1016
1017 strcpy(db_name, symbol->sym_name); // this is the alias, not the path
1018 PAR_get_token();
1019 if (!MSC_match(KW_DOT))
1020 CPR_s_error(". (period)");
1021 }
1022
1023 SQL_resolve_identifier("<Table name>", NULL, NAME_SIZE + 1);
1024 if (gpreGlob.token_global.tok_length >= NAME_SIZE)
1025 PAR_error("Table or owner name too long");
1026
1027 strcpy(r_name, gpreGlob.token_global.tok_string);
1028 PAR_get_token();
1029
1030 if (MSC_match(KW_DOT))
1031 {
1032 // the table name was really a owner specifier
1033 strcpy(owner_name, r_name);
1034 SQL_resolve_identifier("<Table name>", NULL, NAME_SIZE);
1035 if (gpreGlob.token_global.tok_length >= NAME_SIZE)
1036 PAR_error("TABLE name too long");
1037
1038 strcpy(r_name, gpreGlob.token_global.tok_string);
1039 PAR_get_token();
1040 }
1041}
1042
1043
1044//____________________________________________________________

Callers 7

act_deleteFunction · 0.85
act_grant_revokeFunction · 0.85
act_open_blobFunction · 0.85
act_procedureFunction · 0.85
act_updateFunction · 0.85
par_relationFunction · 0.85
SQE_contextFunction · 0.85

Calls 6

SQL_resolve_identifierFunction · 0.85
MSC_find_symbolFunction · 0.85
PAR_get_tokenFunction · 0.85
MSC_matchFunction · 0.85
CPR_s_errorFunction · 0.85
PAR_errorFunction · 0.70

Tested by

no test coverage detected