MCPcopy Create free account
hub / github.com/apache/cloudberry / exec_stmt_exit

Function exec_stmt_exit

src/pl/plpgsql/src/pl_exec.c:3103–3125  ·  view source on GitHub ↗

---------- * exec_stmt_exit Implements EXIT and CONTINUE * * This begins the process of exiting / restarting a loop. * ---------- */

Source from the content-addressed store, hash-verified

3101 * ----------
3102 */
3103static int
3104exec_stmt_exit(PLpgSQL_execstate *estate, PLpgSQL_stmt_exit *stmt)
3105{
3106 /*
3107 * If the exit / continue has a condition, evaluate it
3108 */
3109 if (stmt->cond != NULL)
3110 {
3111 bool value;
3112 bool isnull;
3113
3114 value = exec_eval_boolean(estate, stmt->cond, &isnull);
3115 exec_eval_cleanup(estate);
3116 if (isnull || value == false)
3117 return PLPGSQL_RC_OK;
3118 }
3119
3120 estate->exitlabel = stmt->label;
3121 if (stmt->is_exit)
3122 return PLPGSQL_RC_EXIT;
3123 else
3124 return PLPGSQL_RC_CONTINUE;
3125}
3126
3127
3128/* ----------

Callers 1

exec_stmtsFunction · 0.85

Calls 2

exec_eval_booleanFunction · 0.85
exec_eval_cleanupFunction · 0.85

Tested by

no test coverage detected