You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when I use FbDataReader to load some data from database on system with tr-TR locale it's not possible to use columns containing with character "i". It's simply because Char.ToUpper('i') does not returns I but "I with dot". So in this case "caseinsensitive" comparison is not enough.
Example
string description = aDataReader["ProductDescription"];
Workaround - use upper characters for I eg. - but it's awfull and hard to test
string description = aDataReader["ProductDescrIptIon"];
I tried to do some quick&dirty fix in FBDataReader.cs in method GetOrdinal. I simple replace original code
if (!columnsIndexes.TryGetValue(name.ToUpper(), out index))
throw new IndexOutOfRangeException("Could not find specified column in results.");
with
if (!columnsIndexes.TryGetValue(name.ToUpper(CultureInfo.InvariantCulture), out index))
throw new IndexOutOfRangeException("Could not find specified column in results.");
but in fact, I think that best fix should be by using something like this:
String.Equals("i", "I", StringComparison.InvariantCultureIgnoreCase)
And of course there can be more places where this can cause problems, but to me it seems to work (except similar bug in native .NET DataTable which suffers with same problem).
OK, I improved the logic little bit. The match is first trying to do ordinal CS, then ordinal CI match and then finally invariant CI. In your case, the ordinal CI will do the match.
The last option is there to help support some "normal-special" characters in your column names (does somebody use it?) and it's CI, because SQL by default is CI. If somebody needs match, that's failing on invariant culture, (s)he has to use exact name to match on ordinal match.
Submitted by: Robert Kindl (rkindl)
Relate to DNET699
when I use FbDataReader to load some data from database on system with tr-TR locale it's not possible to use columns containing with character "i". It's simply because Char.ToUpper('i') does not returns I but "I with dot". So in this case "caseinsensitive" comparison is not enough.
Example
string description = aDataReader["ProductDescription"];
Workaround - use upper characters for I eg. - but it's awfull and hard to test
string description = aDataReader["ProductDescrIptIon"];
I tried to do some quick&dirty fix in FBDataReader.cs in method GetOrdinal. I simple replace original code
if (!columnsIndexes.TryGetValue(name.ToUpper(), out index))
throw new IndexOutOfRangeException("Could not find specified column in results.");
with
if (!columnsIndexes.TryGetValue(name.ToUpper(CultureInfo.InvariantCulture), out index))
throw new IndexOutOfRangeException("Could not find specified column in results.");
but in fact, I think that best fix should be by using something like this:
String.Equals("i", "I", StringComparison.InvariantCultureIgnoreCase)
Commits: 12f85a8
The text was updated successfully, but these errors were encountered: