Subject Re: Can someone explain to me what's the best way to do this?
Author andrew_s_vaz
Hi Svein,

> Secondly, using locate is generally a bad idea, LIKE can be used in
some cases, but is likely to not use any index (in your case an index
could be used, whereas if you used a parameter rather than a
constant, no index would be used), whereas STARTING [WITH] normally
uses an index if available.

Ok, and if I'm building the queries on-the-fly and using the "select
a,b,c from names like 'MICHAEL%'" approach?


> > Does table.locate(...) does a search and drags all the records by
> > wire to the workstation untill the position of this 'MICHAEL%' guy?
> > Or does a select make it work faster?

Sorry, I should have written query.locate. Old habit.

> I think that will vary with your choice of tool. IBObjects only has
cursors and queries (for use in selecting datasets), but may fake
that it has a table object. Basically, it allows users to do silly
things and tries to convert it into intelligent queries. Using other
components, I would try to avoid table objects unless the table is
really small.

I'm using query objects. The locate method is implemented and
functional, but I am afraid that on such a big table the searches
wouldn't be something to be proud of.

I'm testing MDO (Mercury Database Objects). Pretty much like IBX, but
oriented to Firebird and Opensource.

> > Is there another (aka better) way to do these kind of searches?

>You ought to use SELECT, using a cursor if unidirectional access is
OK and a query if bidirectional access is neccessary.

Ok, thanks. I'll give it a try.

> > Using FB 1.5.1.
>
> Good choice!

I think too. :-)

Thanks
Andrew