Subject Re: [IBO] Subtle Bug in RequestLive setting
Author Larry Baddock
Hi, Helen.

Something else I forgot...

> In fact, you shouldn't actually need AsRawString. A string of OCTETS is
> still a string. You only need to take the necessary care to ensure that
> Delphi doesn't mess with it - as happens when you pass it around unquoted.

I'm afraid that this is not the case.
Make yourself a cursor q, say, with SQL: 'SELECT A FROM B WHERE C=:C'.
Then try this:

q.ParamByName('C').AsRawString:=#55#56#57#0#58#59;
if(q.ParamByName('C').AsRawString<>q.ParamByName('C').AsString) then
begin
raise Exception.Create('Ouch!');
end;

The Exception Gets raised. This is why you DO actually need AsRawString with
binary data.
The AsString DOES chop the string at the 0, and AsRawString does not.

This is NOT delphi messing with the strings - It is IBO, and I'm pretty sure
it was designed that way.
The idea is that AsRawString returns the real buffer, and AsString applies
trimming rules, as per documentation.

The odd part here is that there are any trimming rules implemented at all
for OCTETS columns. Is this behaviour correct? I thought that the whole idea
of having OCTETS is that everything is passed through unmodified. I could be
wrong here, but modifying ANYTHING specified as OCTETS doesn't seem right to
me.

Kind regards
Larry