MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / act_execute

Function act_execute

src/gpre/sql.cpp:3008–3071  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3006//
3007
3008static act* act_execute()
3009{
3010 if (MSC_match(KW_PROCEDURE))
3011 return act_procedure();
3012
3013 // EXECUTE IMMEDIATE is a different sort of duck
3014
3015 if (MSC_match(KW_IMMEDIATE))
3016 {
3017 if (gpreGlob.isc_databases && gpreGlob.isc_databases->dbb_next)
3018 {
3019 TEXT s[ERROR_LENGTH];
3020 sprintf(s, "Executing dynamic SQL statement in context of database %s",
3021 gpreGlob.isc_databases->dbb_name->sym_string);
3022 CPR_warn(s);
3023 }
3024 dyn* statement = (dyn*) MSC_alloc(DYN_LEN);
3025 par_options(&statement->dyn_trans);
3026
3027 switch (gpreGlob.sw_sql_dialect)
3028 {
3029 case 1:
3030 if (!isQuoted(gpreGlob.token_global.tok_type) && !MSC_match(KW_COLON))
3031 CPR_s_error(": <string expression>");
3032 break;
3033
3034 default:
3035 if (gpreGlob.token_global.tok_type != tok_sglquoted && !MSC_match(KW_COLON))
3036 CPR_s_error(": <string expression>");
3037 break;
3038 }
3039 statement->dyn_string = PAR_native_value(false, false);
3040 par_using(statement);
3041 if (statement->dyn_using)
3042 PAR_error("Using host-variable list not supported.");
3043 par_into(statement);
3044 statement->dyn_database = gpreGlob.isc_databases;
3045
3046 act* action = (act*) MSC_alloc(ACT_LEN);
3047 action->act_type = ACT_dyn_immediate;
3048 action->act_object = (ref*) statement;
3049 action->act_whenever = gen_whenever();
3050 return action;
3051 }
3052
3053 // Ordinary form of EXECUTE
3054
3055 const TEXT* transaction;
3056 par_options(&transaction);
3057 dyn* statement = par_statement();
3058 statement->dyn_trans = transaction;
3059
3060 par_using(statement);
3061 if (statement->dyn_using)
3062 PAR_error("Using host-variable list not supported.");
3063 par_into(statement);
3064
3065 act* action = (act*) MSC_alloc(ACT_LEN);

Callers 1

SQL_actionFunction · 0.85

Calls 13

MSC_matchFunction · 0.85
act_procedureFunction · 0.85
CPR_warnFunction · 0.85
MSC_allocFunction · 0.85
isQuotedFunction · 0.85
CPR_s_errorFunction · 0.85
PAR_native_valueFunction · 0.85
par_usingFunction · 0.85
par_intoFunction · 0.85
par_statementFunction · 0.85
par_optionsFunction · 0.70
PAR_errorFunction · 0.70

Tested by

no test coverage detected