@@ -2293,7 +2293,10 @@ static void gen_for( const act* action, int column)
22932293 const gpre_req* request = action->act_request ;
22942294
22952295 if (action->act_error || (action->act_flags & ACT_sql))
2296- success (column, true , global_status_name, " {" );
2296+ {
2297+ printa (column, " if (%s && !(%s->getState() & Firebird::IStatus::STATE_ERRORS)) {" ,
2298+ request->req_handle , global_status_name);
2299+ }
22972300
22982301 printa (column, " while (1)" );
22992302 column += INDENT;
@@ -3075,11 +3078,10 @@ static void gen_s_start( const act* action, int column)
30753078 if (action->act_error || (action->act_flags & ACT_sql))
30763079 {
30773080 make_ok_test (action, request, column);
3081+ printa (column, " {" );
30783082 column += INDENT;
30793083 }
30803084 gen_start (action, port, column, false );
3081- if (action->act_error || (action->act_flags & ACT_sql))
3082- column -= INDENT;
30833085
30843086 const TEXT* pattern1 = " if (%V1->getErrors()[1] == isc_bad_req_handle) { %RH->release(); %RH = NULL; }" ;
30853087 PAT args;
@@ -3088,6 +3090,12 @@ static void gen_s_start( const act* action, int column)
30883090 PATTERN_expand ((USHORT) column, pattern1, &args);
30893091 printa (column, " else break;" );
30903092
3093+ if (action->act_error || (action->act_flags & ACT_sql))
3094+ {
3095+ column -= INDENT;
3096+ printa (column, " }" );
3097+ }
3098+
30913099 if (action->act_type == ACT_open)
30923100 {
30933101 endp (column);
0 commit comments