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

Function SQL_resolve_identifier

src/gpre/sql.cpp:6771–6825  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6769// the output variable to put the result in it.
6770
6771void SQL_resolve_identifier( const TEXT* err_mesg, TEXT* str_in, int in_size)
6772{
6773 static TEXT internal_buffer[MAX_CURSOR_SIZE];
6774 TEXT* str;
6775 int len;
6776 if (str_in)
6777 {
6778 str = str_in;
6779 len = in_size - 1;
6780 }
6781 else
6782 {
6783 str = internal_buffer;
6784 len = sizeof(internal_buffer) - 1;
6785 if (in_size > 0 && in_size <= len)
6786 len = in_size - 1;
6787 else if (in_size > len + 1)
6788 PAR_error("Provide your own buffer for sizes bigger than 64.");
6789 }
6790
6791 TEXT* const tk_string = gpreGlob.token_global.tok_string;
6792
6793 switch (gpreGlob.sw_sql_dialect)
6794 {
6795 case 2:
6796 if (gpreGlob.token_global.tok_type == tok_dblquoted)
6797 PAR_error("Ambiguous use of double quotes in dialect 2");
6798 // fall into
6799 case 1:
6800 if (gpreGlob.token_global.tok_type != tok_ident)
6801 CPR_s_error(err_mesg);
6802 else
6803 to_upcase(tk_string, str, len + 1);
6804 break;
6805 case 3:
6806 switch (gpreGlob.token_global.tok_type)
6807 {
6808 case tok_dblquoted:
6809 // strip_quotes is too dumb to handle C escape sequences
6810 // or SQL escape sequences in quoted identifiers.
6811 if (tk_string[0] == '\"')
6812 strip_quotes(gpreGlob.token_global);
6813 fb_utils::copy_terminate(str, tk_string, len + 1);
6814 break;
6815 case tok_ident:
6816 to_upcase(tk_string, str, len + 1);
6817 break;
6818 default:
6819 CPR_s_error(err_mesg);
6820 }
6821
6822 break;
6823 }
6824 strcpy(tk_string, str);
6825}
6826
6827
6828void SQL_dialect1_bad_type(USHORT field_dtype)

Callers 15

EXP_fieldFunction · 0.85
EXP_relationFunction · 0.85
lookup_fieldFunction · 0.85
SQL_par_field_dtypeFunction · 0.85
SQL_relation_nameFunction · 0.85
act_alter_indexFunction · 0.85
act_alter_tableFunction · 0.85
act_create_generatorFunction · 0.85
act_create_indexFunction · 0.85
act_declareFunction · 0.85
act_declare_filterFunction · 0.85
act_declare_udfFunction · 0.85

Calls 5

CPR_s_errorFunction · 0.85
to_upcaseFunction · 0.85
strip_quotesFunction · 0.85
PAR_errorFunction · 0.70
copy_terminateFunction · 0.50

Tested by

no test coverage detected