Subject Re: Use of params in where clause on 'BLOB SUB_TYPE 1' fields?
Author flipmooooo
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@...>
wrote:
>
> At 10:51 PM 8/02/2006, you wrote:
>
> > > In what environment are you using the first syntax?
> >
> >In the application we are building. I tried the same query in
> >IBExpert and it won't work there either. We are using delphi with
FIB
> >datacomponents. But basically if i understood you correctly you
can't
> >pass a (string) parameter for a 'BLOB SUB_TYPE 1' field when
> >using '=,<,>' operators in the where clause right ?
> >
> >Greetings,
> >Filip Moons
> >
> >
> > with AQuery do
> > begin
> > Transaction.StartTransaction;
> > try
> > ParamByName('ADESCRIPTION').AsString := Edit1.Text;
>
> Edit1.Text isn't a blob, it's a string. If you want to
parameterise
> a blob, you have to assign a blob to it. I'm sure if you explore
the
> FIB help, you'll find a method that enables this - typically (for a
> text blob) passing the Lines object of a memo component to a stream
> (SaveToStream) and then assigning the stream to your blob parameter.
>
> It's a matter of convenience that the engine (in Fb 1.5 and higher)
> will accept a *literal* string and convert it to a text blob for
> you. A blob is a blob is a blob.
>
> > ExecQuery;
> > finally
> > if Open then
>
> Are you sure?
>
> > Close;
> > Transaction.Commit;
> > end;
> > end;
>
> ./heLen
>

Sorry to bother you again with a delphi problem in this forum, but
when i use streams the 'internal error' still persists. If the code
below should work normally, maybe its better to take this to FIB
support.

TempStream := TStringStream.Create(Trim(Edit1.Text));
try
with AQuery do
begin
Transaction.StartTransaction;
try
ParamByName('ADESCRIPTION').LoadFromStream(TempStream);
ExecQuery;
finally
if Open then
Close;
Transaction.Commit;
end;
end;
finally
FreeAndNil(TempStream);
end;

> > if Open then
>
> Are you sure?
>
> > Close;

Not good to close the query when its open in a finally clause?

Anyway thanks alot for the detailed info you gave me.

Greetings,
Filip Moons