| 2789 | // |
| 2790 | |
| 2791 | static void gen_request_data( const gpre_req* request) |
| 2792 | { |
| 2793 | // gpreGlob.requests are generated as raw BLR in longword chunks |
| 2794 | // because FORTRAN is a miserable excuse for a language |
| 2795 | // and doesn't allow byte value assignments to character |
| 2796 | // fields. |
| 2797 | |
| 2798 | if (!(request->req_flags & (REQ_exp_hand | REQ_sql_blob_open | REQ_sql_blob_create)) && |
| 2799 | request->req_type != REQ_slice && request->req_type != REQ_procedure) |
| 2800 | { |
| 2801 | fprintf(gpreGlob.out_file, "%sDATA %s /0/ %s{ init request handle }\n\n", |
| 2802 | COLUMN, request->req_handle, INLINE_COMMENT); |
| 2803 | } |
| 2804 | |
| 2805 | if (request->req_flags & (REQ_sql_blob_open | REQ_sql_blob_create)) |
| 2806 | fprintf(gpreGlob.out_file, "%sDATA isc_%dS /0/ %s{ init SQL statement handle }\n\n", |
| 2807 | COLUMN, request->req_ident, INLINE_COMMENT); |
| 2808 | |
| 2809 | if (request->req_flags & REQ_sql_cursor) |
| 2810 | fprintf(gpreGlob.out_file, "%sDATA isc_%dS /0/ %s{ init SQL statement handle }\n\n", |
| 2811 | COLUMN, request->req_ident, INLINE_COMMENT); |
| 2812 | |
| 2813 | // Changed termination test in for-loop from <= to < to fix bug#840. |
| 2814 | // We were generating data statements with bad bounds on the last data |
| 2815 | // statement if the data size was divisible by 75. mao 4/3/89 |
| 2816 | |
| 2817 | if ((request->req_type == REQ_ready) || (request->req_type == REQ_create_database)) |
| 2818 | { |
| 2819 | if (request->req_length || request->req_flags & REQ_extend_dpb) |
| 2820 | { |
| 2821 | fprintf(gpreGlob.out_file, "%sDATA isc_%dl /%d/ %s{ request length }\n\n", |
| 2822 | COLUMN, request->req_ident, request->req_length, INLINE_COMMENT); |
| 2823 | } |
| 2824 | } |
| 2825 | |
| 2826 | if (request->req_length) |
| 2827 | { |
| 2828 | for (int begin_i = 0; begin_i < request->req_length; begin_i = begin_i + (75 * sizeof(SLONG))) |
| 2829 | { |
| 2830 | const int end_i = MIN(request->req_length - 1, begin_i + (SLONG)(75 * sizeof(SLONG)) - 1); |
| 2831 | printa(COLUMN, "DATA (isc_%d(ISC_I)%s ISC_I=%d,%d) /", |
| 2832 | request->req_ident, COMMA, (begin_i / sizeof(SLONG)) + 1, |
| 2833 | (end_i / sizeof(SLONG)) + 1); |
| 2834 | gen_raw(request->req_blr, request->req_type, request->req_length, begin_i, end_i); |
| 2835 | } |
| 2836 | |
| 2837 | const TEXT* string_type; |
| 2838 | if (!gpreGlob.sw_raw) |
| 2839 | { |
| 2840 | printa(COMMENT, " "); |
| 2841 | printa(COMMENT, "FORMATTED REQUEST BLR FOR isc_%d = ", request->req_ident); |
| 2842 | switch (request->req_type) |
| 2843 | { |
| 2844 | case REQ_create_database: |
| 2845 | case REQ_ready: |
| 2846 | string_type = "DPB"; |
| 2847 | if (PRETTY_print_cdb(request->req_blr, gen_blr, 0, 0)) |
| 2848 | CPR_error("internal error during parameter generation"); |
no test coverage detected