Subject Blob Field
Author Carlos Alberto Lima dos Santos
Delphi : 6.0
InterBase: 6.0 - Character Set: ISO8859_1
Win2000 : Service Pack 3

Hello All,

Due to amount of the data that will be recorded in a database,
created an algorithm to compress those data before include in the database.
For treating of a numeric string, I transform that string in Hexadecimal,
later I get the character corresponding of each two numbers in order to
generate the compressed string

Ex.:

String original : 605958575655
hexadecimal : 8D15F21627
compressed : i§=?'

8D: i
15: §
F2: =
16: ?
27: '

To store in the database I created a field of the type blob, and before
storing in the database I work with the string in a variable of the type
PByteArray.

Ex.:

Registro = PByteArray;
Registro := PByteArray(AllocMem(255));
(FieldByName('DADOS') as TBlobField).SetData(Registro);


When in some point of the array of bytes appears a byte 0 (zero), the
string is truncated and the rest of the array is not saved. I know that the
#0 are usually final of line, but I thought that once working with bytes, in
a field blob should be recorded what I want exactly independent of the value
of the recorded byte.

How to solve that problem?

=====
====================================
Carlos Alberto L. dos Santos (TOCA)
Eng. de Computação - Puc-Campinas(SP) - Brasil
tocals@...
------------------------------------------------

_______________________________________________________________________
Yahoo! GeoCities
Tudo para criar o seu site: ferramentas fáceis de usar, espaço de sobra e acessórios.
http://br.geocities.yahoo.com/