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

Function EXT_store

src/jrd/ext.cpp:487–577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

485
486
487void EXT_store(thread_db* tdbb, record_param* rpb)
488{
489/**************************************
490 *
491 * E X T _ s t o r e
492 *
493 **************************************
494 *
495 * Functional description
496 * Update an external file.
497 *
498 **************************************/
499 jrd_rel* relation = rpb->rpb_relation;
500 ExternalFile* file = relation->rel_file;
501 Record* record = rpb->rpb_record;
502 const Format* const format = record->getFormat();
503
504 if (!file->ext_ifi) {
505 ext_fopen(tdbb->getDatabase(), file);
506 }
507
508 // Loop thru fields setting missing fields to either blanks/zeros or the missing value
509
510 // check if file is read only if read only then post error we cannot write to this file
511 if (file->ext_flags & EXT_readonly)
512 {
513 Database* dbb = tdbb->getDatabase();
514 CHECK_DBB(dbb);
515 // Distinguish error message for a ReadOnly database
516 if (dbb->readOnly())
517 ERR_post(Arg::Gds(isc_read_only_database));
518 else
519 {
520 ERR_post(Arg::Gds(isc_io_error) << Arg::Str("insert") << Arg::Str(file->ext_filename) <<
521 Arg::Gds(isc_io_write_err) <<
522 Arg::Gds(isc_ext_readonly_err));
523 }
524 }
525
526 dsc desc;
527 vec<jrd_fld*>::iterator field_ptr = relation->rel_fields->begin();
528 Format::fmt_desc_const_iterator desc_ptr = format->fmt_desc.begin();
529
530 for (USHORT i = 0; i < format->fmt_count; ++i, ++field_ptr, ++desc_ptr)
531 {
532 const jrd_fld* field = *field_ptr;
533 if (field && !field->fld_computation && desc_ptr->dsc_length && record->isNull(i))
534 {
535 UCHAR* p = record->getData() + (IPTR) desc_ptr->dsc_address;
536 LiteralNode* literal = nodeAs<LiteralNode>(field->fld_missing_value);
537
538 if (literal)
539 {
540 desc = *desc_ptr;
541 desc.dsc_address = p;
542 MOV_move(tdbb, &literal->litDesc, &desc);
543 }
544 else

Callers 1

storeMethod · 0.85

Calls 13

ext_fopenFunction · 0.85
CHECK_DBBFunction · 0.85
GdsClass · 0.85
StrClass · 0.85
MOV_moveFunction · 0.85
getDatabaseMethod · 0.80
readOnlyMethod · 0.80
ERR_postFunction · 0.70
getFormatMethod · 0.45
beginMethod · 0.45
isNullMethod · 0.45
getDataMethod · 0.45

Tested by

no test coverage detected