Re: 4gl case sensitive
Posted in 1994
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL, Migration, Import/Export & Data Conversion
}
} ->From: palkoci@feld.cvut.cs (Milos Palkoci FIDO )
} ->Subject: 4gl case sensitive
} ->Date: Mon, 21 Mar 1994 19:54:30 MET
} ->Reply-To: palkoci@feld.cvut.cs (Milos Palkoci FIDO )
} ->Organization: Faculty of Electrical Engineering CTU Prague
} ->
} ->Hi everybody,
} ->
} ->I am an begginer in 4GL and have encounterd the problem of
} ->ignore case searching, after givving criteria by user (using construct
} ->command).
} ->I simply want ignore case searching like in FoxPro,...
} ->
} ->Is there any possibility, how to set ignore case searching in 4GL.
} ->
} ->Thanks, Milos
} ->
} ->palkoci@feld.cvut.cz
} ->DATA.22
}
} Milos,
}
} Informix does not support case insensitivity at the SQL level. Since you
} are using 4GL, you can use the 4GL library functions UPSHIFT and/or DOWNSHIFT
} to get most of the functionality that you want. If it is important for you
} to preserve the original case of data, but also to search ignoring case, then
} you may need to store key fields twice. For example:
}
} create table person
} ( lname char(15) { McNamara, de Neuve, O'Dell, etc. }
} , lnameup char(15) { MCNAMARA, DE NEUVE, O'DELL, etc. }
} , fname char(15) { Roger, LeRoy, Samantha, etc. }
} , fnameup char(15) { ROGER, LEROY, SAMANTHA, etc. }
} , other fields as needed )
}
} Your 4GL program would have to take any input data and generate the {x}nameup
} fields from the {x}name fields before storing the data. Similarly, your
} program would convert any search criteria to upper case, search on the
} {x}nameup fields, and then display the {x}name fields.
}
} I have to admit, this is one area where I prefer Oracle. They chose to
} include their UPPER and LOWER functions as extensions to the SQL language.
} I would encourage Informix to consider this as an enhancement to future
} versions of their SQL product.
}
} Regards,
} Alan ___________________________
} ______________________| R. Alan Popiel |__________________________
} \\ Internet: | Martin Marietta, SLS | /
} \\ alan@den.mmc.com | P.O. Box 179, M/S 3810 | Std disclaimers apply. /
} )Voice: | Denver, CO 80201-0179 USA | (
} / 303-977-9998 |___________________________| (But you knew that!) \\
} /________________________) (____________________________\\
}
how about using a reg-ex in the matches function
for e.g if you want to search for abc/aBc/aBC/ ...
and your input is "abc"
form a string "[aA][bB][cC]" (using cr_match_str function)
and use
select column from table
where column matches "[aA][bB][cC]"
(matches a or A in first position , b or B in 2nd pos, c or C in 3rd and so on).
the following function cr_match_str
returns "[aA][bB][cC]" if the input is abc/ABC ...
function cr_match_str (in_str)
define in_str char(100)
define out_str char(400)
define i,l integer
let out_str = null
let l = length(in_str clipped)
for i = 1 to l
let out_str = out_str clipped,
"[",upshift(in_str[i]), downshift(in_str[i]),"]"
end for
return out_str clipped
end function
Not a good solution though (but works).
+---------------------------+--------------------------+
| G.T.Madavan, | e-mail: gtmad@smi.mn.org |
| Systems Migration Inc., | Phone : (612) 890-0040 |
| Burnsville, MN, 55337 | Fax : (612) 890-0966 |
+---------------------------+--------------------------+
Disclaimer: The author's opinions are his own, and not
necessarily those of Systems Migration Inc.