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

Function par_udf

src/gpre/sqe.cpp:3182–3409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3180//
3181
3182static gpre_nod* par_udf( gpre_req* request)
3183{
3184 if (!request)
3185 return NULL;
3186
3187 assert_IS_REQ(request);
3188
3189 // Check for user defined functions
3190 // resolve only if an identifier
3191 if ((isQuoted(gpreGlob.token_global.tok_type)) || gpreGlob.token_global.tok_type == tok_ident)
3192 SQL_resolve_identifier("<Udf Name>", NULL, NAME_SIZE);
3193
3194 gpre_nod* node;
3195 USHORT local_count;
3196
3197 udf* an_udf;
3198 if (request->req_database)
3199 an_udf = MET_get_udf(request->req_database, gpreGlob.token_global.tok_string);
3200 else
3201 {
3202 // no database was specified, check the metadata for all the databases
3203 // for the existence of the udf
3204
3205 an_udf = NULL;
3206 for (gpre_dbb* db = gpreGlob.isc_databases; db; db = db->dbb_next)
3207 {
3208 udf* tmp_udf = MET_get_udf(db, gpreGlob.token_global.tok_string);
3209 if (tmp_udf)
3210 if (an_udf)
3211 {
3212 // udf was found in more than one database
3213 SCHAR s[ERROR_LENGTH];
3214 fb_utils::snprintf(s, sizeof(s), "UDF %s is ambiguous", gpreGlob.token_global.tok_string);
3215 PAR_error(s);
3216 }
3217 else
3218 {
3219 an_udf = tmp_udf;
3220 request->req_database = db;
3221 }
3222 }
3223 }
3224
3225 if (an_udf)
3226 {
3227 if ((SQL_DIALECT_V5 == gpreGlob.sw_sql_dialect) &&
3228 (dtype_sql_date == an_udf->udf_dtype ||
3229 dtype_sql_time == an_udf->udf_dtype ||
3230 dtype_int64 == an_udf->udf_dtype))
3231 {
3232 SQL_dialect1_bad_type(an_udf->udf_dtype);
3233 }
3234
3235 node = MSC_node(nod_udf, 2);
3236 node->nod_count = 1;
3237 node->nod_arg[1] = (gpre_nod*) an_udf;
3238 PAR_get_token();
3239 EXP_left_paren(0);

Callers 3

par_notFunction · 0.70
par_statFunction · 0.70
par_udf_or_fieldFunction · 0.70

Calls 15

isQuotedFunction · 0.85
SQL_resolve_identifierFunction · 0.85
MET_get_udfFunction · 0.85
SQL_dialect1_bad_typeFunction · 0.85
MSC_nodeFunction · 0.85
PAR_get_tokenFunction · 0.85
EXP_left_parenFunction · 0.85
SQE_listFunction · 0.85
SQE_post_fieldFunction · 0.85
par_terminating_parensFunction · 0.85
MSC_matchFunction · 0.85
MSC_allocFunction · 0.85

Tested by

no test coverage detected