Hi,

I would like to confirm that I understand this simplified code properly:

If record is fragmented then always have 48 bit transaction id.

If not fragmented and transaction ID is less then 4G than record can be 
padded by zeroes and this zeros will come to compressor as regular part 
of compressed record.

Am I right?

Slavek

void DPM_store( thread_db* tdbb, record_param* rpb, PageStack& stack, 
const Jrd::RecordStorageType type)
{
/**************************************
  *
  *    D P M _ s t o r e
  *
  **************************************
  *
  * Functional description
  *    Store a new record in a relation.  If we can put it on a
  *    specific page, so much the better.
  *
  **************************************/
     SET_TDBB(tdbb);
     Database* dbb = tdbb->getDatabase();

     const Compressor dcc(*tdbb->getDefaultPool(), rpb->rpb_length, 
rpb->rpb_address);
     const ULONG size = (ULONG) dcc.getPackedLength();

     const FB_SIZE_T header_size = (rpb->rpb_transaction_nr > MAX_ULONG) 
? RHDE_SIZE : RHD_SIZE;

     SLONG fill = (RHDF_SIZE - header_size) - size;
     if (fill < 0)
         fill = 0;

     // Accomodate max record size i.e. 64K
     const SLONG length = header_size + size + fill;
     rhd* header = locate_space(tdbb, rpb, (SSHORT) length, stack, NULL, 
type);

     header->rhd_flags = rpb->rpb_flags;
     Ods::writeTraNum(header, rpb->rpb_transaction_nr, header_size);
     header->rhd_format = rpb->rpb_format_number;
     header->rhd_b_page = rpb->rpb_b_page;
     header->rhd_b_line = rpb->rpb_b_line;

     UCHAR* const data = (UCHAR*) header + header_size;

     dcc.pack(rpb->rpb_address, data);

     if (fill)
          memset(data + size, 0, fill);

-- 
Ing. Slavomir Skopalik
Executive Head
Elekt Labs s.r.o.
Collection and evaluation of data from machines and laboratories
by means of system MASA (http://www.elektlabs.cz/m2demo)
-----------------------------------------------------------------
Address:
Elekt Labs s.r.o.
Chaloupky 158
783 72 Velky Tynec
Czech Republic
---------------------------------------------------------------
Mobile: +420 724 207 851
icq:199 118 333
skype:skopaliks
e-mail:skopa...@elektlabs.cz
http://www.elektlabs.cz



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to