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

Function act_declare

src/gpre/sql.cpp:2231–2357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2229//
2230
2231static act* act_declare()
2232{
2233 gpre_dbb* db = NULL;
2234
2235 if (gpreGlob.token_global.tok_symbol && (gpreGlob.token_global.tok_symbol->sym_type == SYM_database))
2236 {
2237 // must be a database specifier in a DECLARE TABLE statement
2238
2239 db = (gpre_dbb*) gpreGlob.token_global.tok_symbol->sym_object;
2240 PAR_get_token();
2241 if (!MSC_match(KW_DOT))
2242 CPR_s_error(". (period)");
2243 gpre_sym* symbol = PAR_symbol(SYM_dummy);
2244 if (gpreGlob.token_global.tok_keyword != KW_TABLE)
2245 CPR_s_error("TABLE");
2246 return (act_declare_table(symbol, db));
2247 }
2248
2249 switch (gpreGlob.token_global.tok_keyword)
2250 {
2251 case KW_FILTER:
2252 return (act_declare_filter());
2253 break;
2254
2255 case KW_EXTERNAL:
2256 PAR_get_token();
2257 if (MSC_match(KW_FUNCTION))
2258 return (act_declare_udf());
2259
2260 CPR_s_error("FUNCTION");
2261 break;
2262 }
2263
2264 bool delimited = false;
2265
2266 { // Scope
2267 TEXT t_str[MAX_CURSOR_SIZE];
2268 SQL_resolve_identifier("<Cursor Name>", t_str, MAX_CURSOR_SIZE);
2269 gpre_sym* symb = NULL;
2270 if (gpreGlob.token_global.tok_type == tok_dblquoted)
2271 {
2272 delimited = true;
2273 symb = HSH_lookup(t_str);
2274 }
2275 else {
2276 symb = HSH_lookup2(t_str);
2277 }
2278 if (symb &&
2279 (symb->sym_type == SYM_cursor || symb->sym_type == SYM_delimited_cursor))
2280 {
2281 char s[ERROR_LENGTH];
2282 fb_utils::snprintf(s, sizeof(s), "symbol %s is already in use", t_str);
2283 PAR_error(s);
2284 }
2285 } // end scope
2286
2287 act* action = NULL;
2288 gpre_sym* symbol = PAR_symbol(SYM_cursor);

Callers 1

SQL_actionFunction · 0.85

Calls 15

PAR_get_tokenFunction · 0.85
MSC_matchFunction · 0.85
CPR_s_errorFunction · 0.85
PAR_symbolFunction · 0.85
act_declare_tableFunction · 0.85
act_declare_filterFunction · 0.85
act_declare_udfFunction · 0.85
SQL_resolve_identifierFunction · 0.85
HSH_lookupFunction · 0.85
HSH_lookup2Function · 0.85
MSC_requestFunction · 0.85
MSC_actionFunction · 0.85

Tested by

no test coverage detected