whenever-do-continue.patch
binary/octet-stream
Filename: whenever-do-continue.patch
Type: binary/octet-stream
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| doc/src/sgml/ecpg.sgml | 12 | 0 |
| src/interfaces/ecpg/preproc/ecpg.trailer | 6 | 0 |
| src/interfaces/ecpg/preproc/output.c | 3 | 0 |
diff --git a/doc/src/sgml/ecpg.sgml b/doc/src/sgml/ecpg.sgml
index dead4c3..a32ba4f 100644
--- a/doc/src/sgml/ecpg.sgml
+++ b/doc/src/sgml/ecpg.sgml
@@ -4764,6 +4764,17 @@ EXEC SQL WHENEVER <replaceable>condition</replaceable> <replaceable>action</repl
</varlistentry>
<varlistentry>
+ <term><literal>DO CONTINUE</literal></term>
+ <listitem>
+ <para>
+ Execute the C statement <literal>continue</literal>. This should
+ only be used in loops statements. if executed, will cause the flow
+ of control to return to the top of the loop.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><literal>CALL <replaceable>name</replaceable> (<replaceable>args</replaceable>)</literal></term>
<term><literal>DO <replaceable>name</replaceable> (<replaceable>args</replaceable>)</literal></term>
<listitem>
@@ -7800,6 +7811,7 @@ WHENEVER { NOT FOUND | SQLERROR | SQLWARNING } <replaceable class="PARAMETER">ac
<programlisting>
EXEC SQL WHENEVER NOT FOUND CONTINUE;
EXEC SQL WHENEVER NOT FOUND DO BREAK;
+EXEC SQL WHENEVER NOT FOUND DO CONTINUE;
EXEC SQL WHENEVER SQLWARNING SQLPRINT;
EXEC SQL WHENEVER SQLWARNING DO warn();
EXEC SQL WHENEVER SQLERROR sqlprint;
diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer b/src/interfaces/ecpg/preproc/ecpg.trailer
index 1c10879..b42bca4 100644
--- a/src/interfaces/ecpg/preproc/ecpg.trailer
+++ b/src/interfaces/ecpg/preproc/ecpg.trailer
@@ -1454,6 +1454,12 @@ action : CONTINUE_P
$<action>$.command = NULL;
$<action>$.str = mm_strdup("break");
}
+ | DO CONTINUE_P
+ {
+ $<action>$.code = W_CONTINUE;
+ $<action>$.command = NULL;
+ $<action>$.str = mm_strdup("continue");
+ }
| SQL_CALL name '(' c_args ')'
{
$<action>$.code = W_DO;
diff --git a/src/interfaces/ecpg/preproc/output.c b/src/interfaces/ecpg/preproc/output.c
index 59d5d30..14d7066 100644
--- a/src/interfaces/ecpg/preproc/output.c
+++ b/src/interfaces/ecpg/preproc/output.c
@@ -51,6 +51,9 @@ print_action(struct when * w)
case W_BREAK:
fprintf(base_yyout, "break;");
break;
+ case W_CONTINUE:
+ fprintf(base_yyout, "continue;");
+ break;
default:
fprintf(base_yyout, "{/* %d not implemented yet */}", w->code);
break;