| 6769 | // the output variable to put the result in it. |
| 6770 | |
| 6771 | void 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 | |
| 6828 | void SQL_dialect1_bad_type(USHORT field_dtype) |
no test coverage detected