Hello:
> Carlos has fought against the very same problem (but surfacing for UTF-8,
> where all strings get triple length) for the .NET-provider.
>
> Perhaps his solution (if any) can be ported to ODBC.
Finally i have implemented your solution in the 1.6 sources, i need to
do more tests, but for now seems to be working.
It looks like this when reading char values:
string s = this.ReadString(
field.Charset.Encoding,
field.Length);
if ((field.Length % field.Charset.BytesPerCharacter) == 0 &&
s.Length > field.CharCount)
{
fieldValue = s.Substring(0, field.CharCount);
}
else
{
fieldValue = s;
}
I have applied a similar one for the char parameter values (committed
today):
string svalue = sqldata.ToString();
if ((param.Length % param.Charset.BytesPerCharacter) == 0 &&
svalue.Length > param.CharCount)
{
throw new IscException(335544321);
}
this.WriteOpaque(
param.Charset.Encoding.GetBytes(svalue),
param.Length);
--
Best regards
Carlos Guzmán Álvarez
Vigo-Spain
|