| 1101 | // |
| 1102 | |
| 1103 | static int gen_cursor_open( const act* action, const gpre_req* request, int column) |
| 1104 | { |
| 1105 | TEXT s[MAX_CURSOR_SIZE]; |
| 1106 | const TEXT *pattern1 = |
| 1107 | "if (%RIs = nil) and (%RH <> nil)%IF and (%DH <> nil)%EN then", |
| 1108 | *pattern2 = "if (%RIs = nil)%IF and (%DH <> nil)%EN then", |
| 1109 | *pattern3 = "isc_dsql_alloc_statement2 (%V1, %RF%DH, %RF%RIs);", |
| 1110 | *pattern4 = "if (%RIs <> nil)%IF and (%S3 <> nil)%EN then", |
| 1111 | *pattern5 = "isc_dsql_set_cursor_name (%V1, %RF%RIs, %S1, 0);", |
| 1112 | *pattern6 = "isc_dsql_execute_m (%V1, %RF%S3, %RF%RIs, 0, gds__null, %N2, 0, gds__null);"; |
| 1113 | |
| 1114 | PAT args; |
| 1115 | args.pat_request = request; |
| 1116 | args.pat_database = request->req_database; |
| 1117 | args.pat_vector1 = status_vector(action); |
| 1118 | args.pat_condition = gpreGlob.sw_auto; |
| 1119 | args.pat_string1 = make_name(s, ((open_cursor*) action->act_object)->opn_cursor); |
| 1120 | args.pat_string3 = request_trans(action, request); |
| 1121 | args.pat_value2 = -1; |
| 1122 | |
| 1123 | PATTERN_expand(column, (action->act_type == ACT_open) ? pattern1 : pattern2, &args); |
| 1124 | PATTERN_expand(column + INDENT, pattern3, &args); |
| 1125 | PATTERN_expand(column, pattern4, &args); |
| 1126 | column += INDENT; |
| 1127 | begin(column); |
| 1128 | PATTERN_expand(column, pattern5, &args); |
| 1129 | printa(column, "if (gds__status[2] = 0) then"); |
| 1130 | column += INDENT; |
| 1131 | begin(column); |
| 1132 | PATTERN_expand(column, pattern6, &args); |
| 1133 | printa(column, "if (gds__status[2] = 0) then"); |
| 1134 | column += INDENT; |
| 1135 | begin(column); |
| 1136 | |
| 1137 | return column; |
| 1138 | } |
| 1139 | |
| 1140 | |
| 1141 | //____________________________________________________________ |
no test coverage detected