Unfortunately I have to do some interaction with IBM's UniData database system. I am doing this from c# code with UniObjects for .net.
I am building an ASP.NET search page that has a single search box. The problem I am having is that the criteria is case sensitive. How can I do a case insensitive search with UniQuery?
I could return everything and achieve case insensitivity in my Linq to XML statement, but that will lead to performance problems as it's not very efficient.
Here is the code that I have written:
using IBMU2.UODOTNET;
using UniObjectsHelper;
using System.Xml.Linq;
...
void DoSearch()
{
XElement xml;
using (UniSession us = UniHelper.OpenSession((UniDataConfig)ConfigurationManager.GetSection("unidataConfig")))
{
UniCommand cmd = us.CreateUniCommand();
// this is probably insecure. I will deal with that later
cmd.Command = string.Format(@"LIST UT.OPERS WITH @ID = ""{0}"" OR WITH LAST.NAME = ""{0}"" OR WITH FIRST.NAME = ""{0}"" OR WITH MIDDLE.NAME = ""{0}"" LAST.NAME FIRST.NAME MIDDLE.NAME TOXML", txtSearch.Text);
cmd.Execute();
xml = XElement.Parse(cmd.Response);
}
gvwResults.DataSource = from x in xml.Descendants("UT.OPERS")
select new
{
User = x.Attribute("_ID").Value,
FirstName = x.Attribute("FIRST.NAME").Value,
LastName = x.Attribute("LAST.NAME").Value,
MiddleName = x.Attribute("MIDDLE.NAME").Value
};
gvwResults.DataBind();
}
EDIT
I found this:
UDT.OPTIONS 92
U_INSENSITIVE_MATCH
This option affects queries run on data that contains Pick®-style conversions in dictionary definitions. The Pick®-style processing codes MCL, MCT, and MCU convert the case of characters. These conversions are applied to the data before the comparison and selection, thus omitting matching characters of unlike case. UDT.OPTIONS 92 makes LIKE convert both the data and the literal on which the selection is based, so that the selection is, in effect, not based on case.
I don't really know what "Pick®-style processing codes MCL, MCT, and MCU" are. Can anyone explain?