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

Function SQL_par_field_collate

src/gpre/sql.cpp:487–520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

485//
486
487void SQL_par_field_collate(gpre_req*, //request,
488 gpre_fld* field)
489{
490 if (MSC_match(KW_COLLATE))
491 {
492
493 if ((field->fld_dtype != dtype_text) &&
494 (field->fld_dtype != dtype_cstring) &&
495 (field->fld_dtype != dtype_varying))
496 {
497 PAR_error("COLLATE applies only to character columns");
498 }
499 if (gpreGlob.token_global.tok_type != tok_ident)
500 CPR_s_error("<collation name>");
501 gpre_sym* symbol = MSC_find_symbol(gpreGlob.token_global.tok_symbol, SYM_collate);
502 if (!symbol)
503 PAR_error("The named COLLATION was not found");
504 field->fld_collate = (intlsym*) symbol->sym_object;
505
506 // Is the collation valid for declared character set?
507 // The character set is either declared (fld_character_set) or inferered
508 // from the global domain (fld_global & fld_charset_id)
509
510
511 if ((field->fld_character_set &&
512 field->fld_character_set->intlsym_charset_id != field->fld_collate->intlsym_charset_id)
513 ||
514 (field->fld_global && field->fld_charset_id != field->fld_collate->intlsym_charset_id))
515 {
516 PAR_error("Specified COLLATION is incompatible with column CHARACTER SET");
517 }
518 PAR_get_token();
519 }
520}
521
522
523//____________________________________________________________

Callers 4

act_create_domainFunction · 0.85
par_fieldFunction · 0.85
par_collateFunction · 0.85
par_udfFunction · 0.85

Calls 5

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

Tested by

no test coverage detected