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

Function PAR_database

src/gpre/par.cpp:479–683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

477//
478
479act* PAR_database(bool sql, const TEXT* base_directory)
480{
481 if (gpreGlob.token_global.tok_length >= NAME_SIZE)
482 PAR_error("Database alias too long");
483
484 TEXT s[MAXPATHLEN << 1];
485
486 act* action = MSC_action(0, ACT_database);
487 gpre_dbb* db = (gpre_dbb*) MSC_alloc(DBB_LEN);
488
489 // Get handle name token, make symbol for handle, and
490 // insert symbol into hash table
491
492 gpre_sym* symbol = PAR_symbol(SYM_dummy);
493 db->dbb_name = symbol;
494 symbol->sym_type = SYM_database;
495 symbol->sym_object = (gpre_ctx*) db;
496
497 if (!MSC_match(KW_EQUALS))
498 CPR_s_error("\"=\" in database declaration");
499
500 if (MSC_match(KW_STATIC))
501 db->dbb_scope = DBB_STATIC;
502 else if (MSC_match(KW_EXTERN))
503 db->dbb_scope = DBB_EXTERN;
504
505 MSC_match(KW_COMPILETIME);
506
507 // parse the compiletime options
508 TEXT* string;
509
510 for (;;)
511 {
512 if (MSC_match(KW_FILENAME) && !isQuoted(gpreGlob.token_global.tok_type))
513 CPR_s_error("quoted file name");
514
515 tok& token = gpreGlob.token_global;
516
517 if (isQuoted(token.tok_type))
518 {
519 if (base_directory)
520 {
521 db->dbb_filename = string =
522 (TEXT*) MSC_alloc(token.tok_length + static_cast<int>(strlen(base_directory)) + 1);
523 MSC_copy_cat(base_directory, static_cast<int>(strlen(base_directory)),
524 token.tok_string, token.tok_length, string);
525 }
526 else
527 {
528 db->dbb_filename = string = (TEXT *) MSC_alloc(token.tok_length + 1);
529 MSC_copy(token.tok_string, token.tok_length, string);
530 }
531 token.tok_length += 2;
532 }
533 else if (MSC_match(KW_PASSWORD))
534 {
535 if (!isQuoted(token.tok_type))
536 CPR_s_error("quoted password");

Callers 3

SQL_actionFunction · 0.85
act_setFunction · 0.85
PAR_actionFunction · 0.85

Calls 15

MSC_actionFunction · 0.85
MSC_allocFunction · 0.85
PAR_symbolFunction · 0.85
MSC_matchFunction · 0.85
CPR_s_errorFunction · 0.85
isQuotedFunction · 0.85
MSC_copy_catFunction · 0.85
MSC_copyFunction · 0.85
PAR_get_tokenFunction · 0.85
CPR_warnFunction · 0.85
SQL_var_or_stringFunction · 0.85
PAR_native_valueFunction · 0.85

Tested by

no test coverage detected