From: Michael D. <mik...@us...> - 2004-11-08 00:18:17
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2397/Driver Modified Files: NDataReader.cs Added Files: DB2Driver.cs Log Message: NH-144: DB2Dialect and DB2Driver Index: NDataReader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver/NDataReader.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NDataReader.cs 14 Sep 2004 17:49:54 -0000 1.3 --- NDataReader.cs 8 Nov 2004 00:18:06 -0000 1.4 *************** *** 432,438 **** public int GetOrdinal(string colName) { ! return (int)fieldNameToIndex[colName]; } public object GetValue(int rowIndex, int colIndex) { --- 432,459 ---- public int GetOrdinal(string colName) { ! // Martijn Boland, 20041106: perform a case-sensitive search first and if that returns ! // null, perform a case-insensitive search (as being described in the IDataRecord ! // interface, see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataIDataRecordClassItemTopic1.asp. ! // This is necessary for databases that don't preserve the case of field names when ! // they are created without quotes (e.g. DB2, PostgreSQL). ! if( fieldNameToIndex[colName]!=null ) ! { ! return (int)fieldNameToIndex[ colName ]; ! } ! else ! { ! string colNameUpper = colName.ToUpper(); ! foreach( DictionaryEntry entry in fieldNameToIndex ) ! { ! if( entry.Key.ToString().ToUpper()==colNameUpper ) ! { ! return (int)entry.Value; ! } ! } ! throw new IndexOutOfRangeException( String.Format( "No column with the specified name was found: {0}.", colName ) ); ! } } + public object GetValue(int rowIndex, int colIndex) { --- NEW FILE: DB2Driver.cs --- using System; namespace NHibernate.Driver { /// <summary> /// A NHibernate Driver for using the IBM.Data.DB2 DataProvider. /// </summary> public class DB2Driver : DriverBase { private System.Type connectionType; private System.Type commandType; public DB2Driver() { connectionType = System.Type.GetType("IBM.Data.DB2.DB2Connection, IBM.Data.DB2"); commandType = System.Type.GetType("IBM.Data.DB2.DB2Command, IBM.Data.DB2"); } public override System.Type CommandType { get { return commandType; } } public override System.Type ConnectionType { get { return connectionType; } } public override bool UseNamedPrefixInSql { get { return false; } } public override bool UseNamedPrefixInParameter { get { return false; } } public override string NamedPrefix { get { return String.Empty; } } public override bool SupportsMultipleOpenReaders { get { return false; } } } } |