Search using wildcard character %

When I do the following search in the name field on a form:
A%
I get all the names that start with A. :D
If I then do search
B%
I get ‘no results from search’ :(

At first I thought that this was a DB issue, since these searches work in the demo solutions that came with Servoy. The database I am using is Pervasive version 9.50. I tried the following in the Pervasive.SQL Contorl Center:
select * from “Lifil010” where name like ‘A%’
I got all of the names that start with A.
select * from “Lifil010” where name like ‘B%’
I got all of the names that start with B

Now I don’t know what the problem is.

Additional information:
If I search for A% and get all of the A names, then do B% and extend the search, I get all of the As and Bs, then do B% and reduce the search, I get just the B names.

Any suggestions would be greatly appreciated.

Thanks

That sounds like a bug…

Maybe you can do an additional test, what happens when you search for ‘ba%’ or ‘bb%’ and maybe ‘%a’ and ‘%b’.

Otherwise I suggest you add it to the issue system.

Hmm. But if it works in the Servoy demo solution, it can’t be a bug, can it?

Hmm, Patrick you are right when the demo is based on the same database.
Otherwise it looks like a Servoy or driver thing. Which brings me to the next thought.

Do you use the latest driver?

OK. I just tried it here and with my DB there is no problem. What I suggest is that you turn on debugging and have a look at the queries fired. To do this you have to set the value

log4j.logger.com.servoy.j2db.util.Debug=DEBUG

in your servoy.properties file.

I just tested with the CRM and got this result

2007-04-04 17:04:47,188 DEBUG [AWT-EventQueue-0] com.servoy.j2db.util.Debug - used sql select companies.company_id from companies where companies.company_industry like ? orde
r by companies.company_id questiondata.lenght 1
2007-04-04 17:04:47,194 DEBUG [AWT-EventQueue-0] com.servoy.j2db.util.Debug - questiondata[0]= ‘R%’ ,type: java.lang.String

2007-04-04 17:04:57,549 DEBUG [AWT-EventQueue-0] com.servoy.j2db.util.Debug - used sql select companies.company_id from companies where companies.company_category like ? orde
r by companies.company_id questiondata.lenght 1
2007-04-04 17:04:57,556 DEBUG [AWT-EventQueue-0] com.servoy.j2db.util.Debug - questiondata[0]= ‘W%’ ,type: java.lang.String

You can see the SQL fired and the arguments of the prepared statement. This should help to find the issue.

I just tried the same type of searches on another form that reads from a Pervasive DB and it worked. Therefore, the problem must be something with the first form.

I will try with the debugger turned on.

I have performed some additional testing with the debugger turned on. Attached is the log file.

I was successful in performing the searches on the map_x field but there is still a problem when performing the searches in the name field. The name field is the PK, would that make a difference?

below are the searches I performed. I am including the time of the tests to make it easier to find in the log.

At 11:31 searched for G% in field map_x, this was successful.
At 11:32 searched for H% in field map_x, this was successful.
At 11:33 searched for A% in field name, this was successful.
At 11:34 searched for B% in field name, this failed.
At 11:35 searched for A% in field name, this was successful.
At 11:36 searched for AC% in field name, this was successful.
At 11:37 searched for A% in field name, this was successful.
At 11:38 searched for B% in field name, this failed.
At 11:39 searched for B% in field name, this failed.

After each failure, the whole foundset was displayed (A to Z).

I looked at the log, but nothing that look like an error jumped out at me. Maybe someone else will see the problem.

Thanks again.

servoy_log_test.txt (138 KB)

Woops, I lost track of the time. The time of the tests was 12:31 through 12:39.

As far as I could see there is no problem. At least, Sevoy does everything as it should. The only thing that I saw is that all those columns are char (fixed length filled with blanks) and not varchar columns. Since I never use a char column for anything, I don’t really know how they behave…

I don’t know what changes I made that would have affected the search, but this seems to be working correctly today.

Thanks for your help Patrick and Marcel