[pgsqlclient-checkins] pgsqlclient/PostgreSql.Data.PGSqlClient/source/NPGClient PGCharSetCollection.
Status: Inactive
Brought to you by:
carlosga_fb
From: <car...@us...> - 2003-07-29 10:15:19
|
Update of /cvsroot/pgsqlclient/pgsqlclient/PostgreSql.Data.PGSqlClient/source/NPGClient In directory sc8-pr-cvs1:/tmp/cvs-serv1416 Modified Files: PGCharSetCollection.cs PGClientErrorCollection.cs Log Message: * Changed cultureAwareCompare method in PGDataReader and all Collection classes for use it in a better way, and allow it to run on Mono:: Index: PGCharSetCollection.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient/PostgreSql.Data.PGSqlClient/source/NPGClient/PGCharSetCollection.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PGCharSetCollection.cs 12 Jul 2003 08:11:22 -0000 1.1.1.1 --- PGCharSetCollection.cs 29 Jul 2003 10:15:08 -0000 1.2 *************** *** 54,58 **** foreach(PGCharSet item in this) { ! if (_cultureAwareCompare(item.CharSet, charset) == 0) { return index; --- 54,58 ---- foreach(PGCharSet item in this) { ! if (cultureAwareCompare(item.CharSet, charset)) { return index; *************** *** 93,99 **** } ! private int _cultureAwareCompare(string strA, string strB) { ! return CultureInfo.CurrentCulture.CompareInfo.Compare(strA, strB, CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.IgnoreCase); } --- 93,106 ---- } ! private bool cultureAwareCompare(string strA, string strB) { ! try ! { ! return CultureInfo.CurrentCulture.CompareInfo.Compare(strA, strB, CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.IgnoreCase) == 0 ? true : false; ! } ! catch (NotSupportedException) ! { ! return strA.ToUpper() == strB.ToUpper() ? true : false; ! } } Index: PGClientErrorCollection.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient/PostgreSql.Data.PGSqlClient/source/NPGClient/PGClientErrorCollection.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PGClientErrorCollection.cs 12 Jul 2003 08:11:22 -0000 1.1.1.1 --- PGClientErrorCollection.cs 29 Jul 2003 10:15:08 -0000 1.2 *************** *** 53,57 **** foreach(PGClientError item in this) { ! if (0 == _cultureAwareCompare(item.Message, errorMessage)) { return index; --- 53,57 ---- foreach(PGClientError item in this) { ! if (cultureAwareCompare(item.Message, errorMessage)) { return index; *************** *** 81,87 **** } ! private int _cultureAwareCompare(string strA, string strB) { ! return CultureInfo.CurrentCulture.CompareInfo.Compare(strA, strB, CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.IgnoreCase); } --- 81,94 ---- } ! private bool cultureAwareCompare(string strA, string strB) { ! try ! { ! return CultureInfo.CurrentCulture.CompareInfo.Compare(strA, strB, CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.IgnoreCase) == 0 ? true : false; ! } ! catch (NotSupportedException) ! { ! return strA.ToUpper() == strB.ToUpper() ? true : false; ! } } |