Hi,
That looks like the correct fix to me.
In addition, it looks like that's a bug that could be fixed in our base
DriverBase class. That function only gets used if we can't re-use
parameters by name (this is a limitation of Informix and ODBC). I suspect
we already have a test that fails for that somewhere (in amongst a lot of
tests that would fail on Informix). If you raise a JIRA, and reference this
e-mail thread, we could investigate it.
Finally, there is also a IfxDriver which might be more suitable as your
base-class (rather than the ODBC driver).
Cheers,
Richard
-----Original Message-----
From: Thanigai
Sent: Friday, July 08, 2011 6:32 AM
To: nhusers
Cc: [email protected]
Subject: [nhusers] Double byte problem
I faced an issue while using the NHibernate with double byte character
search. This was workign fine with version 2.1. Once I migarted to
Version 3.0 double byte charcter search breaked. We know that we have
to give the column lenght in the mapping file for varchar field with
double byte characters. This is how it worked in 2.1.
Version 3.0 have a method called "CloneParameter" in DriverBase.cs.
All drivers inherit this class. This method clones the parameter to
new set of parameters. This was copying only the dbtype and value and
not the size of the column . Even other parameter values too.
Solution:
Inherit a class from NHibernate OdbcDriver in our case for informix.
For others inherit from your corresponding NHibernate driver classes.
Override the clone parameter and update it to copy the column sizes
too.
//Create a class to inherit from OdbcDriver
public class IfDriver:OdbcDriver
{
protected override IDBDataParameter CloneParameter(IDBCommand
cmd,IDBDataParameter originalParameter)
{
vara param=cmd.CreateParameter();
param.DBType=originalParameter.DBType;
param.Value=originalParameter.Value;
param.Size=originalParameter.Size;
/// include other properties too if needed
return param;
}
}
//Mark your class to be used in NHibernate's config
NHibernate.Configuration cf=new NHibernate.Configuration();
IDictionary<string,string> props=new Dictionary<string,string>();
props.Add("connection.driver_class",typeof(IfDriver).AssemblyQualifiedName);
cf.SetProperties(props);
Feedback:
Please give me your feedback if my solution is ok.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.