Subject | Re: More on problem with SearchingLinks. See Message 17027 |
---|---|
Author | menesoft |
Post date | 2002-11-07T12:11:02Z |
Hi again:
Thanks for your answer (very fast).
The table on which I want to use SearchinLinks is defined in Interbase with columns not using "NOT NULL", but there are no records with a NULL value on it. If I make a little program modeled as the SearchingLinks sample that comes with IBO I don't get the expected results. When I reorder a column that hasn't got "NOT NULL" on its definition all data in the dataset "disappears". I use the following code in the OnPrepareSQL (all columns are of type text):
procedure TfrmRelacionar.query1PrepareSQL(Sender: TIB_Statement);
const
START = 'STARTING WITH';
CONT = 'CONTAINING';
WHERECLAUSE ='UPPER(%s) %s :%s';
begin
with query1 do begin
if RadioGroup1.ItemIndex = 0 then
SQLWhereItems.Add(Format(WHERECLAUSE, [OrderingLink, START, OrderingLink]))
else
SQLWhereItems.Add(Format(WHERECLAUSE, [OrderingLink, CONT, OrderingLink]));
end; { with query1 do...}
But if the OnPrepareSQL is not used and I reorder the columns (even those with NULLs) everything works fine.
What could be the problem in this case?. I think this a problem in IBO. The only way to get around this problem here is the use of TIB_Query.ClearSearchingLinks everytime the ordering changes.
Sorry if I didn't explain very well before.
Thanks in advance,
Mene
Thanks for your answer (very fast).
The table on which I want to use SearchinLinks is defined in Interbase with columns not using "NOT NULL", but there are no records with a NULL value on it. If I make a little program modeled as the SearchingLinks sample that comes with IBO I don't get the expected results. When I reorder a column that hasn't got "NOT NULL" on its definition all data in the dataset "disappears". I use the following code in the OnPrepareSQL (all columns are of type text):
procedure TfrmRelacionar.query1PrepareSQL(Sender: TIB_Statement);
const
START = 'STARTING WITH';
CONT = 'CONTAINING';
WHERECLAUSE ='UPPER(%s) %s :%s';
begin
with query1 do begin
if RadioGroup1.ItemIndex = 0 then
SQLWhereItems.Add(Format(WHERECLAUSE, [OrderingLink, START, OrderingLink]))
else
SQLWhereItems.Add(Format(WHERECLAUSE, [OrderingLink, CONT, OrderingLink]));
end; { with query1 do...}
But if the OnPrepareSQL is not used and I reorder the columns (even those with NULLs) everything works fine.
What could be the problem in this case?. I think this a problem in IBO. The only way to get around this problem here is the use of TIB_Query.ClearSearchingLinks everytime the ordering changes.
Sorry if I didn't explain very well before.
Thanks in advance,
Mene
--- In IBObjects@y..., Helen Borrie <helebor@t...> wrote:
> At 09:26 AM 07-11-02 +0000, you wrote:
> >Hi forum.
> >
> >I have the same problem as it appears on Message 17027 (please see it)
> >about the SearchingLinks. I have read that messages, and I have discover
> >that the problem happens when the column on which you do the ordering
> >(searching) is not defined as "NOT NULL" on Interbase.
> >
> >To Team IBO: Is this a bug in IBO
>
> No.
>
> >or is it the desired effect?
>
> I wouldn't desire such an effect. But then I wouldn't put searchinglinks
> on a column that might contain nulls. I see no point in searching for
> something that will never be found. If I knew I was going to use a column
> for searching, I'd make sure that every row had at least a default value
> there.
>
> >The biggest problem is that all data in a TIB_Grid disappears.
>
> It disappears out of sight. All of your records with nulls are in a big
> disorderly heap at the bottom of the dataset and that is where the
> searching cursor ends up...nothing found, nowhere to go. I suggest that
> you add a where subclause to your query, ..'and MySearchingColumn is not
> null'... so that you don't even get those null records in the set...or
> reconsider the usefulness of setting a searchinglink on a column that has
> so many nulls.
>
> Helen