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

Function EVL_field

src/jrd/evl.cpp:379–464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377
378
379bool EVL_field(jrd_rel* relation, Record* record, USHORT id, dsc* desc)
380{
381/**************************************
382 *
383 * E V L _ f i e l d
384 *
385 **************************************
386 *
387 * Functional description
388 * Evaluate a field by filling out a descriptor.
389 *
390 **************************************/
391
392 DEV_BLKCHK(record, type_rec);
393
394 if (!record)
395 {
396 // ASF: Usage of ERR_warning with Arg::Gds (instead of Arg::Warning) is correct here.
397 // Maybe not all code paths are prepared for throwing an exception here,
398 // but it will leave the engine as an error (when testing for req_warning).
399 ERR_warning(Arg::Gds(isc_no_cur_rec));
400 return false;
401 }
402
403 const Format* format = record->getFormat();
404 fb_assert(format);
405
406 if (id < format->fmt_count)
407 *desc = format->fmt_desc[id];
408
409 if (id >= format->fmt_count || desc->isUnknown())
410 {
411 // Map a non-existent field to a default value, if available.
412 // This enables automatic format upgrade for data rows.
413 // Reference: Bug 10424, 10116
414
415 if (relation)
416 {
417 thread_db* tdbb = JRD_get_thread_data();
418
419 const Format* const currentFormat = MET_current(tdbb, relation);
420
421 while (id >= format->fmt_defaults.getCount() ||
422 format->fmt_defaults[id].vlu_desc.isUnknown())
423 {
424 if (format->fmt_version >= currentFormat->fmt_version)
425 {
426 format = NULL;
427 break;
428 }
429
430 format = MET_format(tdbb, relation, format->fmt_version + 1);
431 fb_assert(format);
432 }
433
434 if (format)
435 {
436 *desc = format->fmt_defaults[id].vlu_desc;

Callers 15

executeMethod · 0.85
EVL_assign_toFunction · 0.85
eraseMethod · 0.85
VIO_copy_recordFunction · 0.85
VIO_eraseFunction · 0.85
VIO_modifyFunction · 0.85
VIO_storeFunction · 0.85
check_rel_field_classFunction · 0.85
check_classFunction · 0.85
check_nullify_sourceFunction · 0.85
check_ownerFunction · 0.85
check_repl_stateFunction · 0.85

Calls 9

ERR_warningFunction · 0.85
GdsClass · 0.85
JRD_get_thread_dataFunction · 0.85
makeTextMethod · 0.80
getFormatMethod · 0.45
isUnknownMethod · 0.45
getCountMethod · 0.45
isNullMethod · 0.45
getDataMethod · 0.45

Tested by

no test coverage detected