Subject Re: pass string that contains ascii (0)
Author Nick Upson
I found this below, is it still true? and does C count as middleware?

http://www.ibphoenix.com/main.nfs?a=ibphoenix&l=;MERS_ARCHIVE;MSG_ID='20471'

Actually, Ann, that's still there. From SQL, however, you get to it via
CHARACTER SET OCTETS. This stores "array of bytes" -- without
any assumption that they represent characters. (In particular, a zero byte
is stored and retrievied).

However, middleware layers still do not support it.

Workarounds:

a) store the data in HEX format, as character set ASCII -- this doubles
your storage requirement for the column.

b) store the data as character set OCTETS, but always manipulate it via
server side UDF's -- hex_to_binary() & binary_to_hex(), eg:
select binary_to_hex(password) from aTable ...
insert into aTable (password) values (hex_to_binary('ABCD'));

Dave


On 07/08/07, Nick Upson <nick.upson@...> wrote:
> I'm using firebird 1.5.4 on fedora core 5
>
> from C, using EXEC SQL INSERT (rather than the isc_ calls) I am trying
> to get a string of the form below into the database. I've tried
> inserting into char & varchar datatypes, character set none, octets.
> In all cases the string is terminated at the first ascii(0) character
> which must not happen.
>
> I know it can be done via the isc_ calls but I'm trying to write this
> without going to that level as all the other code just uses EXEC SQL.
>
> msg[0] = 0x64;
> msg[0] = 0x00;
> msg[0] = 0x01;
> msg[0] = 0x01;
> msg[0] = 0x64;
> msg[0] = 0x00;
>