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 08:20 PM 8/02/2006, you wrote:
> >Hi,
> >
> >Ik get 'internal error' on executing the following query below.
> >DESCRIPTION is a 'BLOB SUB_TYPE 1' field. Is this syntax supported?
>
> In what environment are you using the first syntax? Stored
procedure
> shouldn't be a problem if AString has been defined as a text
> blob. I'm guessing that you're used to Delphi syntax from
somewhere
> and are trying to use it in a DSQL tool that doesn't know about
> Delphi, such as isql...
>
> >When i use constants instead of params the query works.
> >
> >select
> > ID
> >from
> > ART_OMS
> >where
> > DESCRIPTION = :AString
>
> FYI, the actual syntax that passes through the API is
>
> select
> ID
> from
> ART_OMS
> where
> DESCRIPTION = ?
>
> When the engine tries to prepare it, it has no idea what "?" is so
> you get an exception.
> But, if you pass a string parameter by some means, you'll have a
type
> mismatch, anyway. If the parameter is a string, it's not a
> blob; and, if it were a blob, it wouldn't work, either, because
blob
> = blob comparison can't be done without a UDF.
>
> You could pass a string parameter to this statement (properly
> prepared) because both of those expressions implicitly take string
arguments:
>
> select
> ID
> from
> ART_OMS
> where
> DESCRIPTION STARTING WITH ?
>
> or
>
> select
> ID
> from
> ART_OMS
> where
> DESCRIPTION CONTAINING ?
>
>
> >This works.
> >
> >select
> > ID
> >from
> > ART_OMS
> >where
> > DESCRIPTION = 'blablabla'
>
> That's because the constant value is being converted to a blob for
> comparison purposes (or vice versa, not quite sure which way around
> it is!) The constant is recognisably a string, and the engine
knows
> what to do.
>
> ./heLen
>

> 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;
ExecQuery;
finally
if Open then
Close;
Transaction.Commit;
end;
end;