| 716 | // |
| 717 | |
| 718 | ref* SQE_parameter(gpre_req* request) |
| 719 | { |
| 720 | ref* reference; |
| 721 | SCHAR* string; |
| 722 | |
| 723 | assert_IS_REQ(request); |
| 724 | |
| 725 | if (gpreGlob.token_global.tok_type == tok_number) |
| 726 | { |
| 727 | reference = (ref*) MSC_alloc(REF_LEN); |
| 728 | string = (TEXT *) MSC_alloc(gpreGlob.token_global.tok_length + 1); |
| 729 | MSC_copy(gpreGlob.token_global.tok_string, gpreGlob.token_global.tok_length, string); |
| 730 | reference->ref_value = string; |
| 731 | reference->ref_flags |= REF_literal; |
| 732 | CPR_token(); |
| 733 | return reference; |
| 734 | } |
| 735 | |
| 736 | if ((isQuoted(gpreGlob.token_global.tok_type) && gpreGlob.sw_sql_dialect == 1) || |
| 737 | gpreGlob.token_global.tok_type == tok_sglquoted) |
| 738 | { |
| 739 | // Since we have stripped the quotes, it is time now to put it back |
| 740 | // so that the host language will interpret it correctly as a string |
| 741 | // literal. |
| 742 | |
| 743 | reference = (ref*) MSC_alloc(REF_LEN); |
| 744 | string = (TEXT *) MSC_alloc(gpreGlob.token_global.tok_length + 3); |
| 745 | string[0] = '\"'; |
| 746 | MSC_copy(gpreGlob.token_global.tok_string, gpreGlob.token_global.tok_length, string + 1); |
| 747 | string[gpreGlob.token_global.tok_length + 1] = '\"'; |
| 748 | string[gpreGlob.token_global.tok_length + 2] = 0; |
| 749 | reference->ref_value = string; |
| 750 | reference->ref_flags |= REF_literal; |
| 751 | CPR_token(); |
| 752 | return reference; |
| 753 | } |
| 754 | |
| 755 | if (gpreGlob.token_global.tok_keyword == KW_PLUS || gpreGlob.token_global.tok_keyword == KW_MINUS) |
| 756 | { |
| 757 | int sign = 0; |
| 758 | if (gpreGlob.token_global.tok_keyword == KW_MINUS) |
| 759 | sign = 1; |
| 760 | |
| 761 | CPR_token(); |
| 762 | if (gpreGlob.token_global.tok_type != tok_number) |
| 763 | CPR_s_error("<host variable> or <constant>"); |
| 764 | reference = (ref*) MSC_alloc(REF_LEN); |
| 765 | char* s = string = (TEXT *) MSC_alloc(gpreGlob.token_global.tok_length + 1 + sign); |
| 766 | if (sign) |
| 767 | *s++ = '-'; |
| 768 | MSC_copy(gpreGlob.token_global.tok_string, gpreGlob.token_global.tok_length, s); |
| 769 | reference->ref_value = string; |
| 770 | reference->ref_flags |= REF_literal; |
| 771 | CPR_token(); |
| 772 | return reference; |
| 773 | } |
| 774 | |
| 775 | if (!MSC_match(KW_COLON)) |
no test coverage detected