Jump to content
McObject Forums
saxxi

select * where column = '%str%' ?

Recommended Posts

Hi

anybody know if is possible to search inside a field and not only with the beginning of a sentence?

Iterator iterator = root.TradLngEn.prefixIterator("b");

for (int i = 0; iterator.hasNext(); i++) {

Dict dict = (Dict)iterator.next();

trace("#"+i+"; "+dict.lngId+"; lngEn: "+dict.lngEn+"; lngIt: "+dict.lngIt+";");

}

is more like "SELECT * FROM dict WHERE TradLngEn LIKE 'b%' " and i would like to do "SELECT * FROM dict WHERE TradLngEn LIKE '%b%' "

S.

ps: my program is for j2me so i guess i can't use jsql or others, isn't it true?

Share this post


Link to post
Share on other sites
Hi

anybody know if is possible to search inside a field and not only with the beginning of a sentence?

Iterator iterator = root.TradLngEn.prefixIterator("b");

for (int i = 0; iterator.hasNext(); i++) {

Dict dict = (Dict)iterator.next();

trace("#"+i+"; "+dict.lngId+"; lngEn: "+dict.lngEn+"; lngIt: "+dict.lngIt+";");

}

is more like "SELECT * FROM dict WHERE TradLngEn LIKE 'b%' " and i would like to do "SELECT * FROM dict WHERE TradLngEn LIKE '%b%' "

S.

ps: my program is for j2me so i guess i can't use jsql or others, isn't it true?

SQL is not supported in Perst Lite.

In any case, no database index will help when the search expression begins with a wild card. While you can certainly form a query as "SELECT * FROM dict WHERE TradLngEn LIKE '%b%'", every database (SQL or not) will conduct a table scan. The only exception is integration with a full-text search engine, such as Perst's integration with Lucene. Unfortunately, that is also not available for Perst Lite.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×