[Firebird-docs] Firebird internals - NULL mask

2011-04-04 Thread dbori...@hotmail.com
I have (maybe silly) question about NULL mask. I write a Delphi program 
(for my study) related to Firebird 2.1.3 ODS.
After examining Firebird internals and some posts on firebird-devel, 
I've done some tests. I have a table named TEST with two fields
TEST1 char(10) and
TEST2 char(10).
I've inserted following data into table TEST:
('abc', 'def')
('aaaAAA', NULL)
(NULL, NULL).

On the bottom of the Data page, there are following hex values:
...
000A4FA0 | 00 00 00 00 00 00 00 00 00 00 00 00 80 01 00 00 | 
€...
000A4FB0 | 00 00 00 00 00 00 00 00 01 01 FF E9 00 00 00 00 | 
..ÿé
000A4FC0 | 00 00 00 00 48 01 00 00 00 00 00 00 00 00 00 00 | 
H...
000A4FD0 | 01 01 FE FD 00 FD 61 FD 41 FC 20 F6 00 00 00 00 | ..þý.ýaýAü 
ö
000A4FE0 | 41 01 00 00 00 00 00 00 00 00 00 00 01 01 FC FD | 
A.üý
000A4FF0 | 00 03 61 62 63 F9 20 03 64 65 66 F9 20 00 00 00 | ..abcù 
.defù ...

First record NULL mask (Dpg_offset was 0x0FE0):
01 FC FD 00 (FC 00 00 00) - OK,
Second record NULL mask:
01 FE FD 00 (FE 00 00 00) - OK
Third record NULL mask:
01 FF E9 00 -??? - this part I do not understand.

If I understand correctly, there is E9 (23) bytes with zeros in NULL 
mask? NULL mask should occupy 4 or 8 or 12 etc bytes. What am I missing?

Thanks in advance and sorry for my English
Boris.

--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Firebird-docs mailing list
Firebird-docs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-docs


Re: [Firebird-docs] Firebird internals - NULL mask

2011-04-05 Thread dbori...@hotmail.com
On 4.4.2011 21:30, Norman Dunbar wrote:
> Hi Boris,
>
> On 04/04/11 19:08, dbori...@hotmail.com wrote:
>
>> I have (maybe silly) question about NULL mask.
> There are no silly questions!
>
> 
>
>> First record NULL mask (Dpg_offset was 0x0FE0):
>> 01 FC FD 00 (FC 00 00 00) - OK,
>> Second record NULL mask:
>> 01 FE FD 00 (FE 00 00 00) - OK
>> Third record NULL mask:
>> 01 FF E9 00 -??? - this part I do not understand.
>>
>> If I understand correctly, there is E9 (23) bytes with zeros in NULL
>> mask? NULL mask should occupy 4 or 8 or 12 etc bytes. What am I missing?
> Nothing at all. There will be 23 zero bytes in this part of the page.
>
> However, they are simply padding in the case of the example record
> contents you supplied - two NULL fields. The data in entire record is
> effectively covered by the bits in the NULL mask.
>
> The zero bytes are most likely the initialised contents of the working
> buffer where the data was assembled before being written to the page.
>
> If you were to update the data in one or both of the columns, you would
> be able to examine the hex dump again and see that the NULL mask now
> shows not null, and the existing zeros will hold the compressed format
> of the new data.
>
> The NULL mask is a minimum of 4 bytes to allow for up to 32 fields. If
> there is 33 fields, then the NULL mask will consist of another 4 bytes,
> of which, only 1 single bit will be used. And so on, adding 4 bytes
> every time there is more than a multiple of 32 fields in a record.
>
>
>
>> Thanks in advance and sorry for my English
> Your English is fine, trust me. I speak *only* English I'm ashamed to say.
>
> HTH
>
> Cheers,
> Norman.
>
Thank you,
Boris.

--
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
___
Firebird-docs mailing list
Firebird-docs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-docs