Subject Re: [firebird-support] Varchar size overhead
Author Douglas Tosi
On Wed, Jan 21, 2009 at 3:04 PM, Alexandre Benson Smith
<iblist@...> wrote:
> Ivan Prenosil wrote:
>>> A bird told me some seconds ago that it is 127 to 2 not 512 to 2 :)
>>> I remember that I read that a very long time ago, but I don't know were
>>> it's documented, IIRC was a message in this list.

> 2.) 127 ->2 (from a friend)
> 3.) 128 -> 2 (Ivan)
> 4.) 256 -> 2 (Ann Harrison, message below),

I guess it's time to visit The Source. :)

Anyway I wonder why this scheme with several blocks of 127->2 is used.
Perhaps it's the fastest.
But I remember ASN.1 has a very simple and flexible way to encode
integers (including field sizes): If the first bit is 1, there is one
more byte. In the case of 1968 spaces, it would be encoded as a single
3 byte block (2 for size, one for space).

Of course, I agree with Hannes that varchars with trailing spaces is
odd to say the least.

Douglas Tosi