The problem is that PowerBuilder supplies everything before the word 'like'. Here is the sequence of events:
- User types farm into the edit control for the column named name.
- User clicks out of that control and the itemchanged() function is called. This is code written by my predecessor and that I am maintaining. itemchanged() grabs farm and changes it to
like %[Ff][Aa][Rr][Mm]%
and puts all of that back into the edit control with a call to settext() and then calls accepttext() to get it into the Primary Buffer. (farm will be put back into the edit control and the user never notices the change. It is seen only in the debugger when stepping through the code.) - accepttext() causes PowerBuilder to automatically generate the DataWindow.table.select string which will now look like:
SELECT ... WHERE (((~"DBO~".~"CLIENTS~".~"NAME~" like '%[Ff][Aa][Rr][Mm]%')))
I don't have access to the column name to wrap it inside a call to upper() or lower(). I am supplying only half of the where clause (the half after the column name). And the [ ]'s that worked with our Sybase database do NOT work for the Oracle database and I have to change "my half" of the where clause to get case insensitive searches.
If I knew where PowerBuilder is parsing the SELECT statement maybe I could call lower() or upper().