V4RB, Jon, project /// More explanation.

Ruslan Zasukhin sunshine at public.kherson.ua
Wed Sep 15 19:44:41 CDT 2004


On 9/15/04 7:06 PM, "jda" <jda at his.com> wrote:

>> sorry, I still not catch
>> 
>> say I define some field as UTF8 10 chars maxlenght
>> I store some 10 chars string with no double bytes chars ("abcdefghij")
>> the Vale kernel converts all in UTF16
>> 
>> result: I loose half my data
>> 
>> I got it well?
>> 
> 
> No -- at least that's not how I understand it.

Yes, Jon, you loose.

On disk is reserved 10 bytes for Vstring field.
So if you put 10 chars each 2 bytes then this is 20 bytes.
On disk can be stored only 10 bytes.


If, Erne, you will use VarChar(504), then all your 20 bytes will be written
to disk. No problems.


-------------------
Everything is simple, guys.


I offer you to remember such rules:

* if you use UTF16, and you make some

        Vstring(50)     -- this is 50 chars
        VarChar(50)     -- this is 50 chars
        Text            -- unlimited

   in this case Valentina allocate on disk bytes

        Vstring(50)     -- 50 * 2 = 100 bytes on disk
        VarChar(50)     -- 4KB+ pages.


* if you use any other encoding then you use single byte encoding.
And in this case if you say

    Vstring(50) -- you reserve 50 bytes on disk.

        if your chars eat one byte, then you get 50 chars.
        if your chars eat 2 bytes then you get 25 chars.
        
So if you will think in bytes then everything is clear.



--------------
Just in all both above cases we can THINK that we work with chars.
   in all EXCEPT UTF-8

SQL Standard also require to think in chars.

As for me, I prefer to control each byte. I am Developer.



-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina-beta mailing list