Subject RES: [IBO] IBO + OCTETS FIELD
Author Luiz Alves
Hi,

What about if you declare the field TESTE as CHAR(16)?

Luiz

-----Mensagem original-----
De: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] Em nome de
personalsoft_fabiano
Enviada em: quarta-feira, 19 de novembro de 2008 09:51
Para: IBObjects@yahoogroups.com
Assunto: [IBO] IBO + OCTETS FIELD

Hi all,

I´m facing a strange problem when trying to store octets values in a
field. The field is declared this way:

ALTER TABLE CAD1
ADD TESTE VARCHAR(16) CHARACTER SET OCTETS;

I´m trying to store the value (an UUID) in the field this way:

Q := TIBOQuery.Create(nil);
Q.SQL.Text := 'update cad1 set teste = :teste where numcad1 = 0';
Q.ParamByName('teste').AsString :=
#$3D#$09#$AB#$34#$EF#$12#$AB#$4E#$8F#$D4#$56#$A9#$1A#$BF#$90#$1A;
Q.ExecSQL;

After i execute this query, the value stored in the database is
missing the last digit:

SQL> select teste, char_length(teste) from cad1 where numcad1 = 0;
TESTE CHAR_LENGTH
================================ ============
3D09AB34EF12AB4E8FD456A91ABF90 15

If i put a breakpoint in the line "Q.ExecSQL", i can inspect the value
stored in the param 'teste', and it is correct (with the trailing #$1A).

After some tests, it seems that if i change the last digit to values
greater than #$20, it works fine:

Q.ParamByName('teste').AsString :=
#$3D#$09#$AB#$34#$EF#$12#$AB#$4E#$8F#$D4#$56#$A9#$1A#$BF#$90#$21;
Q.ExecSQL;

SQL> select teste, char_length(teste) from cad1 where numcad1 = 0;
TESTE CHAR_LENGTH
================================ ============
3D09AB34EF12AB4E8FD456A91ABF9021 16

Do someone have a clue about what is happening, and how can i solve it?

Regards,

Fabiano


------------------------------------

___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links




__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3623 (20081118) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com






Mensagem de e-mail verificada por Spyware Doctor (6.0.0.386)
Versão do banco de dados: 5.11160
http://www.pctools.com/br/spyware-doctor-antivirus/


__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3623 (20081118) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3623 (20081118) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com






Mensagem de e-mail verificada por Spyware Doctor (6.0.0.386)
Versão do banco de dados: 5.11160
http://www.pctools.com/br/spyware-doctor-antivirus/