Subject Re: Why can't CHAR and VARCHAR store binary data (ASCII 0)?
Author peter_jacobi.rm
Hi David

--- In firebird-support@yahoogroups.com, David Garamond <lists@z...> >
I still can't store pure binary data in CHAR or VARCHAR columns.


You must hit a problem with the UDFs used or with isql.

The database itself will happily fulfill your requirements.

I can test a similiar case OK with the somewhat
unintuitive ISQL session:
(using LIKEJAVA charset from my demo fbintl2.dll)

SQL> insert into t4 values (
cast (_LIKEJAVA'\u0001\u0002\u0003\u0004' as char(4)
character set ASCII));
SQL> insert into t4 values (
cast (_LIKEJAVA'\u0000\u0002\u0003\u0004' as char(4)
character set ASCII));
SQL> insert into t4 values (
cast (_LIKEJAVA'\u0001\u0000\u0003\u0004' as char(4)
character set ASCII));
SQL> insert into t4 values (
cast (_LIKEJAVA'\u0001\u0002\u0000\u0004' as char(4)
character set ASCII));
SQL> insert into t4 values (
cast (_LIKEJAVA'\u0001\u0002\u0003\u0000' as char(4)
character set ASCII));
SQL> commit;

SQL> select code from t4;

CODE
========

01020304
00020304
01000304
01020004
01020300

I assume you should use CHAR(8) and not VARCHAR(8)
for UUIDs. In fact, I for one, didn't see any useful
use of VARCHAR instead CHAR, but that's another thread.


Regards,
Peter Jacobi