Subject | Re: [firebird-support] Re: Field type for Binary Short Strings? |
---|---|
Author | Olivier Mascia |
Post date | 2003-08-07T09:24:05Z |
Hello semprelliure,
Thursday, August 7, 2003, 11:18:01 AM, you wrote:
s> Thanks, Olivier, but how must I assign the value?
s> If I make
s> UPDATE MY_TABLE
s> SET MY_COMMAND=ASCII_CHAR(65)||ASCII_CHAR(0)||ASCII_CHAR(66);
s> then I only see MY_COMMAND='AB'
s> or ASCII_VAL(SUBSTR(MY_COMMAND,1,1))=65
s> ASCII_VAL(SUBSTR(MY_COMMAND,2,2))=66
s> ASCII_VAL(SUBSTR(MY_COMMAND,3,3))=32
s> ASCII_VAL(SUBSTR(MY_COMMAND,4,4))=32
s> ...
s> The 0 byte is missing again. Maybe ASCII_CHAR is not the right way?
I suppose so. I have no experience of playing with binary values through
the SQL syntax itself. Never had to do such. Through the C-API (used by
most client libraries/tools) I have no problems reading/writing
sequences of arbitrary bytes (including zero) in CHAR()/VARCHAR()
CHARACTER SET OCTETS.
I suppose you won't anyway use plain SQL commands as above to do so but
will also go through your favourite interface.
Others at rescue ?
--
Best regards,
Olivier Mascia
Thursday, August 7, 2003, 11:18:01 AM, you wrote:
s> Thanks, Olivier, but how must I assign the value?
s> If I make
s> UPDATE MY_TABLE
s> SET MY_COMMAND=ASCII_CHAR(65)||ASCII_CHAR(0)||ASCII_CHAR(66);
s> then I only see MY_COMMAND='AB'
s> or ASCII_VAL(SUBSTR(MY_COMMAND,1,1))=65
s> ASCII_VAL(SUBSTR(MY_COMMAND,2,2))=66
s> ASCII_VAL(SUBSTR(MY_COMMAND,3,3))=32
s> ASCII_VAL(SUBSTR(MY_COMMAND,4,4))=32
s> ...
s> The 0 byte is missing again. Maybe ASCII_CHAR is not the right way?
I suppose so. I have no experience of playing with binary values through
the SQL syntax itself. Never had to do such. Through the C-API (used by
most client libraries/tools) I have no problems reading/writing
sequences of arbitrary bytes (including zero) in CHAR()/VARCHAR()
CHARACTER SET OCTETS.
I suppose you won't anyway use plain SQL commands as above to do so but
will also go through your favourite interface.
Others at rescue ?
--
Best regards,
Olivier Mascia