You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(248) |
May
(82) |
Jun
(90) |
Jul
(177) |
Aug
(253) |
Sep
(157) |
Oct
(151) |
Nov
(143) |
Dec
(278) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(152) |
Feb
(107) |
Mar
(177) |
Apr
(133) |
May
(259) |
Jun
(81) |
Jul
(119) |
Aug
(306) |
Sep
(416) |
Oct
(240) |
Nov
(329) |
Dec
(206) |
2006 |
Jan
(466) |
Feb
(382) |
Mar
(153) |
Apr
(162) |
May
(133) |
Jun
(21) |
Jul
(18) |
Aug
(37) |
Sep
(97) |
Oct
(114) |
Nov
(110) |
Dec
(28) |
2007 |
Jan
(74) |
Feb
(65) |
Mar
(49) |
Apr
(76) |
May
(43) |
Jun
(15) |
Jul
(68) |
Aug
(55) |
Sep
(63) |
Oct
(59) |
Nov
(70) |
Dec
(66) |
2008 |
Jan
(71) |
Feb
(60) |
Mar
(120) |
Apr
(31) |
May
(48) |
Jun
(81) |
Jul
(107) |
Aug
(51) |
Sep
(80) |
Oct
(83) |
Nov
(83) |
Dec
(79) |
2009 |
Jan
(83) |
Feb
(110) |
Mar
(97) |
Apr
(91) |
May
(291) |
Jun
(250) |
Jul
(197) |
Aug
(58) |
Sep
(54) |
Oct
(122) |
Nov
(68) |
Dec
(34) |
2010 |
Jan
(50) |
Feb
(17) |
Mar
(63) |
Apr
(61) |
May
(84) |
Jun
(81) |
Jul
(138) |
Aug
(144) |
Sep
(78) |
Oct
(26) |
Nov
(30) |
Dec
(61) |
2011 |
Jan
(33) |
Feb
(35) |
Mar
(166) |
Apr
(221) |
May
(109) |
Jun
(76) |
Jul
(27) |
Aug
(37) |
Sep
(1) |
Oct
(4) |
Nov
(2) |
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2013 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(1) |
2014 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Michael D. <mik...@us...> - 2004-05-06 20:51:08
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22527 Removed Files: ICacheTest.cs SimpleCache.cs Log Message: Moved ICacheTest to testing project and renamed it. Removed SimpleCache infavor of HashtableCache. --- ICacheTest.cs DELETED --- --- SimpleCache.cs DELETED --- |
From: Michael D. <mik...@us...> - 2004-05-06 13:33:00
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27212 Modified Files: DriverBase.cs SqlClientDriver.cs Log Message: Changed SupportsMultipleOpenReaders to true by default and method is now virtual so it can be overridden. SqlClient overrides it with false. Index: DriverBase.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver/DriverBase.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DriverBase.cs 6 May 2004 13:13:11 -0000 1.2 --- DriverBase.cs 6 May 2004 13:32:51 -0000 1.3 *************** *** 67,73 **** } ! public bool SupportsMultipleOpenReaders { ! get { return false;} } --- 67,73 ---- } ! public virtual bool SupportsMultipleOpenReaders { ! get { return true;} } Index: SqlClientDriver.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver/SqlClientDriver.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SqlClientDriver.cs 10 Mar 2004 15:36:46 -0000 1.1 --- SqlClientDriver.cs 6 May 2004 13:32:51 -0000 1.2 *************** *** 38,41 **** --- 38,57 ---- } + /// <summary> + /// The SqlClient driver does NOT support more than 1 open IDataReader + /// with only 1 IDbConnection. + /// </summary> + /// <value><c>false</c> - it is not supported.</value> + /// <remarks> + /// Ms Sql 2000 (and 7) throws an Exception when multiple DataReaders are + /// attempted to be Opened. When Yukon comes out a new Driver will be + /// created for Yukon because it is supposed to support it. + /// </remarks> + public override bool SupportsMultipleOpenReaders + { + get { return false; } + } + + } |
From: Michael D. <mik...@us...> - 2004-05-06 13:19:13
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24015 Modified Files: NHibernate-1.1.csproj Log Message: Added file Driver.NDataReader Index: NHibernate-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate-1.1.csproj,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** NHibernate-1.1.csproj 3 May 2004 04:56:44 -0000 1.24 --- NHibernate-1.1.csproj 6 May 2004 13:19:05 -0000 1.25 *************** *** 521,524 **** --- 521,529 ---- /> <File + RelPath = "Driver\NDataReader.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Driver\OdbcDriver.cs" SubType = "Code" |
From: Michael D. <mik...@us...> - 2004-05-06 13:15:22
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23150 Added Files: NDataReader.cs Log Message: Helps solve the problem of multiple readers being opened. http://jira.nhibernate.org:8080/browse/NH-56 --- NEW FILE: NDataReader.cs --- using System; using System.Collections; using System.Data; namespace NHibernate.Driver { /// <summary> /// Some Data Providers (ie - SqlClient) do not support Multiple Active Result Sets (MARS). /// NHibernate relies on being able to create MARS to read Components and entities inside /// of Collections. /// </summary> /// <remarks> /// This is a completely off-line DataReader - the underlying IDataReader that was used to create /// this has been closed and no connections to the Db exists. /// </remarks> public class NDataReader : IDataReader { private NDataReader.NResult[] results; private bool isClosed = false; // a DataReader is positioned before the first valid record private int currentRowIndex = -1; // a DataReader is positioned on the first Result private int currentResultIndex = 0; private byte[] cachedByteArray; private char[] cachedCharArray; private int cachedColIndex = -1; /// <summary> /// Creates a NDataReader from a IDataReader /// </summary> /// <param name="reader">The IDataReader to get the records from the Database.</param> public NDataReader(IDataReader reader) { ArrayList resultList = new ArrayList(2); try { // there will be atleast one result resultList.Add( new NResult(reader) ); while( reader.NextResult() ) { resultList.Add( new NResult(reader) ); } results = (NResult[]) resultList.ToArray( typeof(NResult) ); } catch(Exception e) { throw new ADOException("There was a problem converting an IDataReader to NDataReader", e); } finally { reader.Close(); } } /// <summary> /// Sets the values that can be cached back to null and sets the /// index of the cached column to -1 /// </summary> private void ClearCache() { // clear out the caches because we have a new result with diff values. cachedByteArray = null; cachedCharArray = null; cachedColIndex = -1; } private NDataReader.NResult GetCurrentResult() { return results[currentResultIndex]; } private object GetValue(string name) { return GetCurrentResult().GetValue(currentRowIndex, name); } #region IDataReader Members public int RecordsAffected { get { // TODO: Add NDataReader.RecordsAffected getter implementation throw new NotImplementedException("NDataReader should only be used for SELECT statements!"); } } public bool IsClosed { get { return isClosed; } } public bool NextResult() { currentResultIndex++; if (currentResultIndex >= results.Length) { // move it back to the last result currentResultIndex--; return false; } ClearCache(); return true; } public void Close() { // TODO: Add NDataReader.Close implementation isClosed = true; } public bool Read() { currentRowIndex++; if (currentRowIndex >= results[currentResultIndex].RowCount) { // reset it back to the last row currentRowIndex--; return false; } ClearCache(); return true; } public int Depth { get { return currentResultIndex; } } public DataTable GetSchemaTable() { return GetCurrentResult().GetSchemaTable(); } #endregion #region IDisposable Members public void Dispose() { // TODO: Add NDataReader.Dispose implementation } #endregion #region IDataRecord Members public int GetInt32(int i) { return Convert.ToInt32( GetValue(i) ); } public object this[string name] { get { return GetValue(name); } } public object this[int i] { get { return GetValue(i); } } public object GetValue(int i) { return GetCurrentResult().GetValue(currentRowIndex, i); } public bool IsDBNull(int i) { return GetValue(i).Equals(System.DBNull.Value); } public long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferOffset, int length) { if(cachedByteArray==null || cachedColIndex!=i) { cachedColIndex = i; cachedByteArray = (byte[]) GetValue(i); } long remainingLength = cachedByteArray.Length - fieldOffset; if(remainingLength < length) { length = (int)remainingLength; } Array.Copy(cachedByteArray, fieldOffset, buffer, bufferOffset, length); return length; } public byte GetByte(int i) { return Convert.ToByte( GetValue(i) ); } public System.Type GetFieldType(int i) { return GetCurrentResult().GetFieldType(i); } public decimal GetDecimal(int i) { return Convert.ToDecimal( GetValue(i) ); } public int GetValues(object[] values) { return GetCurrentResult().GetValues(currentRowIndex, values); } public string GetName(int i) { return GetCurrentResult().GetName(i); } public int FieldCount { get { return GetCurrentResult().GetFieldCount(); } } public long GetInt64(int i) { return Convert.ToInt64( GetValue(i) ); } public double GetDouble(int i) { return Convert.ToDouble( GetValue(i) ); } public bool GetBoolean(int i) { return Convert.ToBoolean( GetValue(i) ); } public Guid GetGuid(int i) { return (Guid)GetValue(i); } public DateTime GetDateTime(int i) { return Convert.ToDateTime( GetValue(i) ); } public int GetOrdinal(string name) { return GetCurrentResult().GetOrdinal(name); } public string GetDataTypeName(int i) { return GetCurrentResult().GetDataTypeName(i); } public float GetFloat(int i) { return Convert.ToSingle( GetValue(i) ); } public IDataReader GetData(int i) { throw new NotImplementedException("GetData(int) has not been implemented."); } public long GetChars(int i, long fieldOffset, char[] buffer, int bufferOffset, int length) { if(cachedCharArray==null || cachedColIndex!=i) { cachedColIndex = i; cachedCharArray = (char[])GetValue(i); } long remainingLength = cachedCharArray.Length - fieldOffset; if(remainingLength < length) { length = (int)remainingLength; } Array.Copy(cachedCharArray, fieldOffset, buffer, bufferOffset, length); return length; } public string GetString(int i) { return Convert.ToString( GetValue(i) ); } public char GetChar(int i) { return Convert.ToChar( GetValue(i) ); } public short GetInt16(int i) { return Convert.ToInt16( GetValue(i) ); } #endregion /// <summary> /// Stores a Result from a DataReader in memory. /// </summary> private class NResult { // [row][column] private readonly object[][] records; private int colCount = 0; private DataTable schemaTable; // key = field name // index = field index private readonly IDictionary fieldNameToIndex = new Hashtable(); private readonly ArrayList fieldIndexToName = new ArrayList(); private readonly ArrayList fieldTypes = new ArrayList(); private readonly ArrayList fieldDataTypeNames = new ArrayList(); internal NResult(IDataReader reader) { schemaTable = reader.GetSchemaTable(); ArrayList recordsList = new ArrayList(); int rowIndex = 0; while( reader.Read() ) { if(rowIndex==0) { for(int i = 0; i < reader.FieldCount; i++) { string fieldName = reader.GetName(i); fieldNameToIndex.Add( fieldName, i); fieldIndexToName.Add(fieldName); fieldTypes.Add( reader.GetFieldType(i) ); fieldDataTypeNames.Add( reader.GetDataTypeName(i) ); } colCount = reader.FieldCount; } rowIndex++; object[] colValues = new object[reader.FieldCount]; reader.GetValues(colValues); recordsList.Add(colValues); } records = (object[][])recordsList.ToArray( typeof(object[]) ); } public string GetDataTypeName(int colIndex) { return (string)fieldDataTypeNames[colIndex]; } public int GetFieldCount() { return fieldIndexToName.Count; } public System.Type GetFieldType(int colIndex) { return (System.Type)fieldTypes[colIndex]; } public string GetName(int colIndex) { return (string)fieldIndexToName[colIndex]; } public DataTable GetSchemaTable() { return schemaTable; } public int GetOrdinal(string colName) { return (int)fieldNameToIndex[colName]; } public object GetValue(int rowIndex, int colIndex) { return records[rowIndex][colIndex]; } public object GetValue(int rowIndex, string colName) { return GetValue( rowIndex, GetOrdinal(colName) ); } public int GetValues(int rowIndex, object[] values) { Array.Copy(records[rowIndex], 0, values, 0, colCount); return colCount; } public int RowCount { get { return records.Length;} } } } } |
From: Michael D. <mik...@us...> - 2004-05-06 13:14:11
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22817/NHibernate/Type Modified Files: ComponentType.cs PersistentCollectionType.cs Log Message: Removed hacks that were added because of multiple open IDataReaders throwing exceptions with MsSql. Index: PersistentCollectionType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/PersistentCollectionType.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PersistentCollectionType.cs 26 Apr 2004 03:45:09 -0000 1.9 --- PersistentCollectionType.cs 6 May 2004 13:14:03 -0000 1.10 *************** *** 11,15 **** /// <summary> ! /// A specific PersistentCollectionType for a Role. /// </summary> public abstract class PersistentCollectionType : AbstractType, IAssociationType { --- 11,15 ---- /// <summary> ! /// PersistentCollectionType. /// </summary> public abstract class PersistentCollectionType : AbstractType, IAssociationType { *************** *** 41,108 **** } - /// <summary> - /// Returns a fully initialized Collection - be careful when calling this because it might - /// open another DataReader!!! - /// </summary> - /// <param name="rs"></param> - /// <param name="name"></param> - /// <param name="session"></param> - /// <param name="owner"></param> - /// <returns></returns> public override object NullSafeGet(IDataReader rs, string[] name, ISessionImplementor session, object owner) { return ResolveIdentifier( Hydrate(rs, name, session, owner), session, owner ); } - /// <summary> - /// Gets a Collection without opening a DataReader. - /// </summary> - /// <param name="rs"></param> - /// <param name="name"></param> - /// <param name="session"></param> - /// <param name="owner"></param> - /// <param name="partOfComponent"></param> - /// <returns> - /// The Collection returned from here is a lazy-load Collection regardless of what the map says. To - /// load this Collection partOfComponent must be true and then ResolveIdentifier must be called. This - /// method is only intended to be used by ComponentType to solve the problem of Getting a Collection - /// opens a second DataReader. - /// </returns> - public object NullSafeGet(IDataReader rs, string[] name, ISessionImplementor session, object owner, bool partOfComponent) - { - object id = session.GetEntityIdentifier(owner); - PersistentCollection collection = session.GetLoadingCollection(role, id); - if(collection!=null) return collection.GetCachedValue(); //TODO: yuck... call another method - H2.0.3comment - - CollectionPersister persister = session.Factory.GetCollectionPersister(role); - collection = persister.GetCachedCollection(id, owner, session); - if(collection!=null) - { - session.AddInitializedCollection(collection, persister, id); - return collection.GetCachedValue(); - } - else - { - - collection = Instantiate(session, persister); - session.AddUninitializedCollection(collection, persister, id); - - // hard coding in lazy here because we don't want it to load during it's Get - just - // initialize the Collection class as if it is being lazy loaded - we'll get back to - // loading it during ResolveIdentifier... - collection.GetInitialValue(true); - - // if we get to here then we have just created a lazy loaded (ie - uninitialized )Collection that might - // be a part of a Component. If it is part of a component then we need to mark it as - // needing to be a part of the batch that gets ResolveIdentifier called where it will be Initialized - // according to the IsLazy property of the Persister - if(partOfComponent) - { - session.AddUnresolvedComponentCollection(id, role, collection); - } - - return collection; - } - } - public virtual object GetCollection(object id, object owner, ISessionImplementor session) { PersistentCollection collection = session.GetLoadingCollection(role, id); --- 41,48 ---- *************** *** 216,228 **** } - /// <summary> - /// - /// </summary> - /// <param name="value">The id of the owner.</param> - /// <param name="session"></param> - /// <param name="owner"></param> - /// <returns></returns> - /// <remarks> - /// </remarks> public override object ResolveIdentifier(object value, ISessionImplementor session, object owner) { if (value==null) { --- 156,159 ---- *************** *** 234,278 **** } - /// <summary> - /// Resolves Collection that might be part of a Component. - /// </summary> - /// <param name="value">The id of the owner.</param> - /// <param name="session">The current Session.</param> - /// <param name="owner">The owner of the collection.</param> - /// <param name="partOfComponent">Indicates if this Collection is a part of a Component.</param> - /// <returns>A fully initialized collection according to its Persister's IsLazy property.</returns> - public object ResolveIdentifier(object value, ISessionImplementor session, object owner, bool partOfComponent) - { - if(partOfComponent==false) return ResolveIdentifier(value, session, owner); - - // check to see if this Collection is part of a Component and it has already been Instantiated - // and just needs to GetInitialValue because it has already been Instantiated and Added to the - // Session in NullSafeGet - object id = value; - - PersistentCollection collection = session.GetUnresolvedComponentCollection(id, role); - - if(collection==null) - { - // when the collection is null that means it is not an UnresolvedComponentCollection - // so we can let ResolveIdentifier get it however it needs to. - return ResolveIdentifier(id, session, owner); - } - else - { - // we already have a collection - CollectionPersister persister = session.Factory.GetCollectionPersister(role); - collection.GetInitialValue(persister.IsLazy); - - // we have resolved the Collection in the Component so remove it from the unresolved - session.RemoveUnresolvedComponentCollection(id, role); - - return collection; - } - - - - } - public virtual bool IsArrayType { get { return false; } --- 165,168 ---- Index: ComponentType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/ComponentType.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ComponentType.cs 26 Apr 2004 03:45:09 -0000 1.7 --- ComponentType.cs 6 May 2004 13:14:03 -0000 1.8 *************** *** 112,164 **** } ! /// <summary> ! /// Provides component specific implementation of ResolveIdentifier that is safe for Collections. ! /// </summary> ! /// <param name="value">The Component object.</param> ! /// <param name="session">The current Session.</param> ! /// <param name="owner">The Entity object the Component is contained in.</param> ! /// <returns>A fully resolved Component.</returns> ! public override object ResolveIdentifier(object value, ISessionImplementor session, object owner) ! { ! if(value==null) return null; ! ! for(int i=0; i < propertySpan; i++) ! { ! // the only types we need to resolve are PersistentCollectionTypes and ComponentTypes. ! // ComponentTypes only really need to be resolved when they contain other ComponentTypes ! // that contain Collections, I'm not sure how safe it is to call Set(target, val) during ! // ResolveIdentifier - commented out the Set because this is not creating new objects, just ! // modifying the existing ones so they don't need to be Set again. ! // Nor am I sure how safe it is to ignore ResolveIdentifer for everything ! // else. I know ManyToOneType and OneToOneType also override ResolveIdentifer and can potentially ! // connect to the db. ! ! if(types[i] is PersistentCollectionType) ! { ! object id = session.GetEntityIdentifier(owner); ! object val = ((PersistentCollectionType)types[i]).ResolveIdentifier(id, session, owner, true); ! //setters[i].Set(value, val); ! } ! else ! { ! object val = types[i].ResolveIdentifier(getters[i].Get(value), session, owner); ! //setters[i].Set(value, val); ! } ! } ! ! return value; ! ! } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="rs"></param> ! /// <param name="names"></param> ! /// <param name="session"></param> ! /// <param name="owner"></param> ! /// <returns></returns> ! public override object NullSafeGet(IDataReader rs, string[] names, ISessionImplementor session, object owner) ! { int begin = 0; bool notNull=false; --- 112,116 ---- } ! public override object NullSafeGet(IDataReader rs, string[] names, ISessionImplementor session, object owner) { int begin = 0; bool notNull=false; *************** *** 167,187 **** int length = types[i].GetColumnSpan( session.Factory ); string[] range = ArrayHelper.Slice(names, begin, length); ! object val = null; //types[i].NullSafeGet(rs, range, session, owner); ! ! // if the Component contains a collection type then use its special NullSafeGet ! // so that we don't create another IDataReader to Get the Collections values from ! // the Db. This breaks the nice OO'ness of being able to just call type.NullSafeGet ! // but it solves the problem of Collections inside of Components opening another ! // DataReader... ! if(types[i] is PersistentCollectionType) ! { ! val = ((PersistentCollectionType)types[i]).NullSafeGet(rs, range, session, owner, true); ! } ! else ! { ! val = types[i].NullSafeGet(rs, range, session, owner); ! } ! ! if (val!=null) notNull=true; values[i] = val; --- 119,123 ---- int length = types[i].GetColumnSpan( session.Factory ); string[] range = ArrayHelper.Slice(names, begin, length); ! object val = types[i].NullSafeGet(rs, range, session, owner); if (val!=null) notNull=true; values[i] = val; |
From: Michael D. <mik...@us...> - 2004-05-06 13:14:11
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22817/NHibernate/Impl Modified Files: SessionImpl.cs Log Message: Removed hacks that were added because of multiple open IDataReaders throwing exceptions with MsSql. Index: SessionImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionImpl.cs,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** SessionImpl.cs 3 May 2004 04:54:28 -0000 1.24 --- SessionImpl.cs 6 May 2004 13:14:02 -0000 1.25 *************** *** 3052,3152 **** } - #region - Session Helpers for handling PersistentCollections inside of a Component - - // key = ComponentCollectionKey(id, role) - // value = PersistentCollection - // contains the PersistentCollections that need to be resolved by a Component through - // the use of ResolveIdentifier. - private IDictionary unresolvedComponentCollections = new Hashtable(); - - /// <summary> - /// Key for the IDictionary that is storing the PersistentCollections that need to be - /// Resolved for a Component - /// </summary> - private class ComponentCollectionKey - { - private object id; - private string role; - - public ComponentCollectionKey(object id, string role) - { - this.id = id; - this.role = role; - } - - public override int GetHashCode() - { - unchecked - { - return id.GetHashCode() + role.GetHashCode(); - } - } - - public object Id - { - get { return id;} - } - - public string Role - { - get { return role; } - } - - public override bool Equals(object obj) - { - ComponentCollectionKey rhs = obj as ComponentCollectionKey; - - if(rhs==null) return false; - - return this.Equals(rhs); - } - - public bool Equals(ComponentCollectionKey obj) - { - // check for ref equality - if(this==obj) return true; - - return (this.id.Equals(obj.Id)) && (this.role==obj.role); - } - - public override string ToString() - { - return "Id=" + id.ToString() + " ; role=" + role; - } - - - } - - public void AddUnresolvedComponentCollection(object id, string role, PersistentCollection collection) - { - ComponentCollectionKey key = new ComponentCollectionKey(id, role); - - // I can't think of any valid reason that the same unresolved collection for a Component would - // get in here twice... - if( unresolvedComponentCollections.Contains(key) ) - { - throw new HibernateException("There is a problem adding the collection identified by " + key.ToString()); - } - - unresolvedComponentCollections[key] = collection; - - } - - public PersistentCollection GetUnresolvedComponentCollection(object id, string role) - { - ComponentCollectionKey key = new ComponentCollectionKey(id, role); - object returnValue = unresolvedComponentCollections[key]; - return returnValue==null ? null : (PersistentCollection) returnValue; - - } - - public void RemoveUnresolvedComponentCollection(object id, string role) - { - ComponentCollectionKey key = new ComponentCollectionKey(id, role); - unresolvedComponentCollections.Remove(key); - } - - #endregion - /// <summary> /// add a collection we just loaded up (still needs initializing) --- 3052,3055 ---- |
From: Michael D. <mik...@us...> - 2004-05-06 13:14:11
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22817/NHibernate/Loader Modified Files: Loader.cs Log Message: Removed hacks that were added because of multiple open IDataReaders throwing exceptions with MsSql. Index: Loader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/Loader.cs,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Loader.cs 30 Apr 2004 14:06:47 -0000 1.19 --- Loader.cs 6 May 2004 13:14:03 -0000 1.20 *************** *** 760,769 **** // of directly executing the reader IDataReader rs = st.ExecuteReader(); ! if( !UseLimit(selection, session.Factory.Dialect) ) { ! Advance(rs, selection, session); } ! return rs; ! } catch (Exception sqle) { --- 760,783 ---- // of directly executing the reader IDataReader rs = st.ExecuteReader(); ! ! //TODO: make this a much smarter implementation that looks at the Type ! // that is being loaded and determines wether or not to wrap this IDataReader ! // in a NDataReader. I believe the problem of multiple readers being opened ! // are occuring in <composite-id> with <many-to-one> and <component> with ! // a <collection>, <many-to-one>, and <one-to-one> inside of them. I believe ! // this is caused when the NullSafeGet() method calls other methods that can ! // potentially perform a Load of another object. ! if(!session.Factory.ConnectionProvider.Driver.SupportsMultipleOpenReaders) { ! rs = new Driver.NDataReader(rs); } ! ! if( !UseLimit(selection, session.Factory.Dialect) ) ! { ! Advance(rs, selection, session); ! } ! ! return rs; ! } catch (Exception sqle) { |
From: Michael D. <mik...@us...> - 2004-05-06 13:14:10
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22817/NHibernate/Engine Modified Files: ISessionImplementor.cs Log Message: Removed hacks that were added because of multiple open IDataReaders throwing exceptions with MsSql. Index: ISessionImplementor.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/ISessionImplementor.cs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ISessionImplementor.cs 26 Apr 2004 03:45:08 -0000 1.18 --- ISessionImplementor.cs 6 May 2004 13:14:02 -0000 1.19 *************** *** 354,382 **** ICollection GetOrphans(PersistentCollection coll); - - /// <summary> - /// Adds a PersistentCollection to the Session that a Component needs to Resolve. - /// </summary> - /// <param name="id">The Id of the Entity that contains the Component.</param> - /// <param name="role">The role that Identifies the PersistentCollection.</param> - /// <param name="collection">The PersistentCollection to add to the Session.</param> - void AddUnresolvedComponentCollection(object id, string role, PersistentCollection collection); - - /// <summary> - /// Returns the PersistentCollection from the Session that a Component needs to Resolve. - /// </summary> - /// <param name="id">The Id of the Entity that contains the Component.</param> - /// <param name="role">The role that Identifies the PersistentCollection.</param> - /// <returns>The PersistentCollection that has not been resolved.</returns> - PersistentCollection GetUnresolvedComponentCollection(object id, string role); - - /// <summary> - /// Removes the PersistentCollection from the Session because the Component has - /// Resolved the Identifier for it. - /// </summary> - /// <param name="id">The Id of the Entity that contains the Component.</param> - /// <param name="role">The role that Identifiers the PersistentCollection.</param> - void RemoveUnresolvedComponentCollection(object id, string role); - } } --- 354,357 ---- |
From: Michael D. <mik...@us...> - 2004-05-06 13:13:20
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22643/NHibernate/Driver Modified Files: DriverBase.cs IDriver.cs Log Message: Added a property to indicate if the Data Provider supports Multiple Open IDataReaders. If you're Driver supports having more than 1 open IDataReader at the same time against the same IDbConnection then override this with true. MsSql2000 is a DataProvider that only supports 1 open IDataReader. I don't know about the other Data Providers so they have not overridden the base class which default to false. Index: DriverBase.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver/DriverBase.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DriverBase.cs 10 Mar 2004 15:36:46 -0000 1.1 --- DriverBase.cs 6 May 2004 13:13:11 -0000 1.2 *************** *** 67,70 **** --- 67,75 ---- } + public bool SupportsMultipleOpenReaders + { + get { return false;} + } + #endregion } Index: IDriver.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver/IDriver.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IDriver.cs 10 Mar 2004 15:36:46 -0000 1.1 --- IDriver.cs 6 May 2004 13:13:12 -0000 1.2 *************** *** 125,129 **** string FormatNameForParameter(string tableAlias, string parameterName); ! } --- 125,147 ---- string FormatNameForParameter(string tableAlias, string parameterName); ! /// <summary> ! /// Does this Driver support having more than 1 open IDataReader with ! /// the same IDbConnection. ! /// </summary> ! /// <remarks> ! /// <para> ! /// A value of <c>false</c> indicates that an exception would be thrown if NHibernate ! /// attempted to have 2 IDataReaders open using the same IDbConnection. NHibernate ! /// (since this version is a close to straight port of Hibernate) relies on the ! /// ability to recursively open 2 IDataReaders. If the Driver does not support it ! /// then NHibernate will read the values from the IDataReader into an <see cref="NDataReader"/>. ! /// </para> ! /// <para> ! /// A value of <c>true</c> will result in greater performance because an IDataReader can be used ! /// instead of the <see cref="NDataReader"/>. So if the Driver supports it then make sure ! /// it is set to <c>true</c>. ! /// </para> ! /// </remarks> ! bool SupportsMultipleOpenReaders { get; } } |
From: Peter S. <sz...@us...> - 2004-05-03 14:33:27
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Tool/hbm2ddl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7876/NHibernate/Tool/hbm2ddl Modified Files: SchemaExport.cs Log Message: Added setdelimiter. Index: SchemaExport.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Tool/hbm2ddl/SchemaExport.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SchemaExport.cs 26 Mar 2004 16:57:28 -0000 1.7 --- SchemaExport.cs 3 May 2004 14:33:19 -0000 1.8 *************** *** 10,14 **** ! namespace NHibernate.Tool.hbm2ddl { /// <summary> /// Commandline tool to export table schema for a configured <c>Configuration</c> to the database --- 10,15 ---- ! namespace NHibernate.Tool.hbm2ddl ! { /// <summary> /// Commandline tool to export table schema for a configured <c>Configuration</c> to the database *************** *** 17,21 **** /// To compile run "csc SchemaExport.cs /reference:../../bin/debug/NHibernate.dll" /// </remarks> ! public class SchemaExport { private string[] dropSQL; private string[] createSQL; --- 18,23 ---- /// To compile run "csc SchemaExport.cs /reference:../../bin/debug/NHibernate.dll" /// </remarks> ! public class SchemaExport ! { private string[] dropSQL; private string[] createSQL; *************** *** 23,31 **** private string outputFile = null; private Dialect.Dialect dialect; /// <summary> /// Create a schema exported for a given Configuration /// </summary> ! public SchemaExport(Configuration cfg) : this(cfg, cfg.Properties) { } --- 25,35 ---- private string outputFile = null; private Dialect.Dialect dialect; + private string delimiter = null; /// <summary> /// Create a schema exported for a given Configuration /// </summary> ! public SchemaExport(Configuration cfg) : this(cfg, cfg.Properties) ! { } *************** *** 36,40 **** /// <param name="cfg"></param> /// <param name="connectionProperties"></param> ! public SchemaExport(Configuration cfg, IDictionary connectionProperties) { this.connectionProperties = connectionProperties; dialect = Dialect.Dialect.GetDialect(connectionProperties); --- 40,45 ---- /// <param name="cfg"></param> /// <param name="connectionProperties"></param> ! public SchemaExport(Configuration cfg, IDictionary connectionProperties) ! { this.connectionProperties = connectionProperties; dialect = Dialect.Dialect.GetDialect(connectionProperties); *************** *** 46,59 **** /// Set the output filename. The generated script will be written to this file /// </summary> ! public SchemaExport SetOutputFile(string filename) { outputFile = filename; return this; } ! /// <summary> /// Run the schema creation script /// </summary> ! public void Create(bool script, bool export) { ! Execute(script, export, false, true, null); } --- 51,74 ---- /// Set the output filename. The generated script will be written to this file /// </summary> ! public SchemaExport SetOutputFile(string filename) ! { outputFile = filename; return this; } ! ! /// <summary> ! /// Set the end of statement delimiter ! /// </summary> ! public SchemaExport SetDelimiter(string delimiter) ! { ! this.delimiter = delimiter; ! return this; ! } /// <summary> /// Run the schema creation script /// </summary> ! public void Create(bool script, bool export) ! { ! Execute(script, export, false, true); } *************** *** 61,69 **** /// Run the drop schema script /// </summary> ! public void Drop(bool script, bool export) { ! Execute(script, export, true, true, null); } ! private void Execute(bool script, bool export, bool justDrop, bool format, string delimiter) { IDbConnection connection = null; --- 76,85 ---- /// Run the drop schema script /// </summary> ! public void Drop(bool script, bool export) ! { ! Execute(script, export, true, true); } ! private void Execute(bool script, bool export, bool justDrop, bool format) { IDbConnection connection = null; *************** *** 197,200 **** --- 213,223 ---- } + /// <summary> + /// Format an SQL statement using simple rules: + /// a) Insert newline after each comma; + /// b) Indent three spaces after each inserted newline; + /// If the statement contains single/double quotes return unchanged, + /// it is too complex and could be broken by simple formatting. + /// </summary> private static string Format(string sql) { *************** *** 276,280 **** new SchemaExport(cfg) .SetOutputFile(outputFile) ! .Execute(script, export, drop, formatSQL, delimiter); } } catch(Exception e) { --- 299,304 ---- new SchemaExport(cfg) .SetOutputFile(outputFile) ! .SetDelimiter(delimiter) ! .Execute(script, export, drop, formatSQL); } } catch(Exception e) { |
From: Peter S. <sz...@us...> - 2004-05-03 14:33:27
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7876/NHibernate/Cfg Modified Files: Binder.cs Log Message: Added setdelimiter. Index: Binder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Binder.cs,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Binder.cs 3 May 2004 14:13:15 -0000 1.22 --- Binder.cs 3 May 2004 14:33:18 -0000 1.23 *************** *** 500,508 **** BindValue(node, model, isNullable, defaultColumnName); ! //TODO: H2.0.3 sets only the first column (shouldn't be more :)) foreach(Column col in model.ColumnCollection) { col.Type = NHibernate.Int32; col.TypeIndex = 0; } } --- 500,510 ---- BindValue(node, model, isNullable, defaultColumnName); ! if (model.ColumnCollection.Count > 1) ! log.Error("This shouldn't happen, check BindIntegerValue"); foreach(Column col in model.ColumnCollection) { col.Type = NHibernate.Int32; col.TypeIndex = 0; + break; } } |
From: Peter S. <sz...@us...> - 2004-05-03 14:13:55
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3242/NHibernate/Cfg Modified Files: Binder.cs Log Message: Deleted createindex from collection & binding. Index: Binder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Binder.cs,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Binder.cs 3 May 2004 04:56:35 -0000 1.21 --- Binder.cs 3 May 2004 14:13:15 -0000 1.22 *************** *** 1093,1099 **** model.Key.CreateForeignKeyOfClass( model.Owner.PersistentClazz ); } - - //TODO: Check, H2.0.3 doesn't have this line any more - if ( !model.IsIndexed ) model.CreateIndex(); } --- 1093,1096 ---- |
From: Peter S. <sz...@us...> - 2004-05-03 14:13:31
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3242/NHibernate/Mapping Modified Files: Collection.cs Log Message: Deleted createindex from collection & binding. Index: Collection.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/Collection.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Collection.cs 13 Apr 2004 02:06:54 -0000 1.5 --- Collection.cs 3 May 2004 14:13:16 -0000 1.6 *************** *** 117,130 **** } - //TODO: H2.0.3 - not in this class - where did it move to??? - public Index CreateIndex() { - string name = "IX" + table.UniqueColumnString( Key.ColumnCollection ); - Index index = table.GetIndex(name); - foreach(Column col in Key.ColumnCollection ) { - index.AddColumn(col); - } - return index; - } - public ICacheConcurrencyStrategy Cache { get { return cache; } --- 117,120 ---- |
From: Michael D. <mik...@us...> - 2004-05-03 04:56:53
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24639/NHibernate Modified Files: NHibernate-1.1.csproj Log Message: Added IdentifierBag to the NH Collections namespace. Index: NHibernate-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate-1.1.csproj,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** NHibernate-1.1.csproj 30 Apr 2004 18:39:47 -0000 1.23 --- NHibernate-1.1.csproj 3 May 2004 04:56:44 -0000 1.24 *************** *** 391,394 **** --- 391,399 ---- /> <File + RelPath = "Collection\IdentifierBag.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Collection\List.cs" SubType = "Code" *************** *** 1659,1662 **** --- 1664,1672 ---- /> <File + RelPath = "Type\IdentifierBagType.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Type\IDiscriminatorType.cs" SubType = "Code" |
From: Michael D. <mik...@us...> - 2004-05-03 04:56:52
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24639/NHibernate/Mapping Modified Files: IdentifierBag.cs Log Message: Added IdentifierBag to the NH Collections namespace. Index: IdentifierBag.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/IdentifierBag.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IdentifierBag.cs 14 Apr 2004 03:06:20 -0000 1.1 --- IdentifierBag.cs 3 May 2004 04:56:43 -0000 1.2 *************** *** 16,26 **** } - //TODO: need to implement an IdentifierBag in PersistentColleciton. public override PersistentCollectionType Type { get { ! throw new NotImplementedException("need to code IdentifierBag"); ! //return TypeFactory.Bag(Role)); } } --- 16,24 ---- } public override PersistentCollectionType Type { get { ! return TypeFactory.IdBag(Role); } } *************** *** 30,35 **** get { ! throw new NotImplementedException("need to code IdentifierBag"); ! //return typeof(NHCollection.IdentifierBag) ; } } --- 28,32 ---- get { ! return typeof(NHCollection.IdentifierBag) ; } } |
From: Michael D. <mik...@us...> - 2004-05-03 04:56:52
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24639/NHibernate/Type Modified Files: TypeFactory.cs Added Files: IdentifierBagType.cs Log Message: Added IdentifierBag to the NH Collections namespace. --- NEW FILE: IdentifierBagType.cs --- using System; using System.Collections; using NHibernate.Collection; using NHibernate.Engine; namespace NHibernate.Type { /// <summary> /// Summary description for IdentifierBagType. /// </summary> public class IdentifierBagType : PersistentCollectionType { public IdentifierBagType(string role) : base(role) { } public override PersistentCollection Instantiate(ISessionImplementor session, CollectionPersister persister) { return new IdentifierBag(session); } public override System.Type ReturnedClass { get { return typeof(ICollection); } } public override PersistentCollection Wrap(ISessionImplementor session, object collection) { return new IdentifierBag(session, (ICollection)collection); } public override PersistentCollection AssembleCachedCollection(ISessionImplementor session, CollectionPersister persister, object disassembled, object owner) { return new IdentifierBag(session, persister, disassembled, owner); } } } Index: TypeFactory.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TypeFactory.cs,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** TypeFactory.cs 30 Apr 2004 18:39:47 -0000 1.30 --- TypeFactory.cs 3 May 2004 04:56:44 -0000 1.31 *************** *** 1088,1091 **** --- 1088,1096 ---- } + public static PersistentCollectionType IdBag(string role) + { + return new IdentifierBagType(role); + } + public static PersistentCollectionType Map(string role) { |
From: Michael D. <mik...@us...> - 2004-05-03 04:56:51
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24639/NHibernate/Collection Added Files: IdentifierBag.cs Log Message: Added IdentifierBag to the NH Collections namespace. --- NEW FILE: IdentifierBag.cs --- using System; using System.Collections; using System.Data; using NHibernate.Engine; using NHibernate.Type; namespace NHibernate.Collection { /// <summary> /// An <c>IdentiferBag</c> implements "bag" semantics more efficiently than /// a regular <see cref="Bag" /> by adding a synthetic identifier column to the /// table. /// </summary> /// <remarks> /// <para> /// The identifier is unique for all rows in the table, allowing very efficient /// updates and deletes. The value of the identifier is never exposed to the /// application. /// </para> /// <para> /// <c>IdentifierBag</c>s may not be used for a many-to-one association. Furthermore, /// there is no reason to use <c>inverse="true"</c>. /// </para> /// </remarks> public class IdentifierBag : ODMGCollection, IList { private IList values; private IList valuesIdentifiers; private IDictionary identifiers; //element -> id public IdentifierBag(ISessionImplementor session) : base(session) { } public IdentifierBag(ISessionImplementor session, ICollection coll) : base(session) { if(coll is IList) { values = (IList)coll; } else { values = new ArrayList(); foreach(object obj in coll) { values.Add(obj); } } initialized = true; directlyAccessible = true; identifiers = new Hashtable(); } public IdentifierBag(ISessionImplementor session, CollectionPersister persister, object disassembled, object owner) : base(session) { BeforeInitialize(persister); object[] array = (object[])disassembled; for(int i=0; i < array.Length; i+=2) { object obj = persister.ElementType.Assemble( array[i+1], session, owner ); identifiers[obj] = persister.IdentifierType.Assemble( array[i], session, owner ); values.Add(obj); } initialized = true; } #region IList Members public bool IsReadOnly { get { return false; } } public object this[int index] { get { Read(); return values[index]; } set { Write(); values[index] = value; } } public void RemoveAt(int index) { Write(); values.RemoveAt(index); } public void Insert(int index, object value) { Write(); values.Insert(index, value); } public void Remove(object value) { Write(); values.Remove(value); } public bool Contains(object value) { Read(); return values.Contains(value); } public void Clear() { Write(); values.Clear(); identifiers.Clear(); } public int IndexOf(object value) { Read(); return values.IndexOf(value); } public int Add(object value) { Write(); return values.Add(value); } public bool IsFixedSize { get { return false; } } #endregion #region ICollection Members public override bool IsSynchronized { get { return false; } } public override int Count { get { Read(); return values.Count; } } public override void CopyTo(Array array, int index) { Read(); values.CopyTo(array, index); } public override object SyncRoot { get { return values.SyncRoot; } } #endregion #region IEnumerable Members public override IEnumerator GetEnumerator() { return values.GetEnumerator(); } #endregion public override void BeforeInitialize(CollectionPersister persister) { identifiers = new Hashtable(); values = new ArrayList(); valuesIdentifiers = new ArrayList(); } public override object Disassemble(CollectionPersister persister) { object[] result = new object[values.Count * 2]; int i = 0; foreach(object obj in values) { result[i++] = persister.IdentifierType.Disassemble( identifiers[obj], session ); result[i++] = persister.ElementType.Disassemble( obj, session ); } return result; } public override ICollection Elements() { return values; } public override bool Empty { get { return (values.Count == 0); } } public override void EndRead(CollectionPersister persister, object owner) { for(int i = 0 ;i < valuesIdentifiers.Count; i++) { object element = persister.ElementType.ResolveIdentifier(valuesIdentifiers[i], session, owner); values[i] = element; } } [Obsolete("See PersistentCollection.ReadEntries for reason")] public override void ReadEntries(ICollection entries) { throw new NotSupportedException("Should not call..."); } public override ICollection Entries() { return values; } public override bool EntryExists(object entry, int i) { return entry!=null; } public override bool EqualsSnapshot(IType elementType) { IDictionary snap = (IDictionary)GetSnapshot(); if(snap.Count!=values.Count) return false; int i = 0; foreach(object obj in values) { object id = identifiers[i++]; if(id==null) return false; object old = snap[id]; if( elementType.IsDirty( old, obj, session ) ) return false; } return true; } public override ICollection GetDeletes(IType elemType) { IDictionary snap = (IDictionary) GetSnapshot(); IList deletes = new ArrayList( snap.Keys ); int i = 0; foreach(object obj in values) { if( obj!=null ) deletes.Remove( identifiers[i++] ); } return deletes; } public override object GetIndex(object entry, int i) { return new NotImplementedException("Bags don't have indexes"); } public override bool NeedsInserting(object entry, int i, IType elemType) { IDictionary snap = (IDictionary)GetSnapshot(); object id = identifiers[i]; return entry!=null && ( id==null || snap[id]==null ); } public override bool NeedsUpdating(object entry, int i, IType elemType) { if(entry==null) return false; IDictionary snap = (IDictionary)GetSnapshot(); object id = identifiers[i]; if(id==null) return false; object old = snap[id]; return entry!=null && old!=null && elemType.IsDirty(old, entry, session); } public override object ReadFrom(IDataReader reader, CollectionPersister persister, object owner) { object elementIdentifier = persister.ReadElementIdentifier(reader, owner, session); values.Add(null); valuesIdentifiers.Add(elementIdentifier); identifiers[values.Count - 1] = persister.ReadIdentifier(reader, session); return elementIdentifier; } protected override object Snapshot(CollectionPersister persister) { IDictionary map = new Hashtable(values.Count); int i = 0; foreach(object obj in values) { object key = identifiers[i++]; map[key] = persister.ElementType.DeepCopy(obj); } return map; } public override ICollection GetOrphans(object snapshot) { IDictionary sn = (IDictionary)GetSnapshot(); ArrayList result = new ArrayList(); result.AddRange(sn.Values); PersistentCollection.IdentityRemoveAll(result, values, session); return result; } public override void PreInsert(CollectionPersister persister, object entry, int i) { try { object id = persister.IdentifierGenerator.Generate(session, entry); // TODO: native ids identifiers[i] = id; } catch (Exception sqle) { throw new ADOException("Could not generate collection row id.", sqle); } } public override void WriteTo(IDbCommand st, CollectionPersister persister, object entry, int i, bool writeOrder) { persister.WriteElement(st, entry, writeOrder, session); persister.WriteIdentifier(st, identifiers[i], writeOrder, session); } } } |
From: Michael D. <mik...@us...> - 2004-05-03 04:56:51
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24639/NHibernate/Cfg Modified Files: Binder.cs Log Message: Added IdentifierBag to the NH Collections namespace. Index: Binder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Binder.cs,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Binder.cs 30 Apr 2004 14:06:45 -0000 1.20 --- Binder.cs 3 May 2004 04:56:35 -0000 1.21 *************** *** 1301,1305 **** } ! //TODO: H2.0.3: IDBAG is missing private static CollectionType ARRAY = new CollectionTypeArray("array"); --- 1301,1316 ---- } ! private static CollectionType IDBAG = new CollectionTypeBag("idbag"); ! private class CollectionTypeIdBag : CollectionType ! { ! public CollectionTypeIdBag(string xmlTag) : base(xmlTag) {} ! public override Mapping.Collection Create(XmlNode node, string prefix, PersistentClass owner, Mappings mappings) ! { ! IdentifierBag bag = new IdentifierBag(owner); ! Binder.BindCollection(node, bag, prefix, mappings); ! return bag; ! } ! ! } private static CollectionType ARRAY = new CollectionTypeArray("array"); *************** *** 1332,1335 **** --- 1343,1347 ---- Instances.Add(MAP.ToString(), MAP); Instances.Add(BAG.ToString(), BAG); + Instances.Add(IDBAG.ToString(), IDBAG); Instances.Add(SET.ToString(), SET); Instances.Add(LIST.ToString(), LIST); |
From: Michael D. <mik...@us...> - 2004-05-03 04:54:36
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24302/NHibernate/Impl Modified Files: SessionImpl.cs Log Message: Added comments about where the problem with a test is occruing and changed an Add to a [] to mimic the use of Java's put method on HashMaps. Index: SessionImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionImpl.cs,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** SessionImpl.cs 26 Apr 2004 03:45:09 -0000 1.23 --- SessionImpl.cs 3 May 2004 04:54:28 -0000 1.24 *************** *** 1962,1967 **** if ( persister.HasProxy ) { proxy = null; //TODO: Create the proxy } ! proxiesByKey.Add(key, proxy); return proxy; } else { --- 1962,1972 ---- if ( persister.HasProxy ) { proxy = null; //TODO: Create the proxy + // this is the spot that is causing the problems with FooBarTest.FetchInitializedCollection + // when the following code "Assert.IsTrue( baz.fooBag.Count==2 );" is being executed. This + // is causing a null value to be returned when a "Proxied" version of the class is expected. + // So the method ThrowObjectNotFound is throwing an exception because it is given a null object + // - hence the error looks like it can't find a row in the DB. } ! proxiesByKey[key] = proxy; return proxy; } else { |
From: Michael D. <mik...@us...> - 2004-05-03 04:52:56
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24032/NHibernate.DomainModel Modified Files: Baz.hbm.xml Log Message: Fixed mapping of binary to Byte[] Index: Baz.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/Baz.hbm.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Baz.hbm.xml 9 Apr 2004 16:18:01 -0000 1.6 --- Baz.hbm.xml 3 May 2004 04:52:48 -0000 1.7 *************** *** 126,130 **** </collection-id> <key column="baz"/> ! <element type="binary" column="bytez" not-null="true"/> </idbag> --- 126,130 ---- </collection-id> <key column="baz"/> ! <element type="Byte[]" column="bytez" not-null="true"/> </idbag> |
From: Michael D. <mik...@us...> - 2004-05-03 04:52:19
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23970/NHibernate/Type Modified Files: BagType.cs Log Message: Small synch with H2.0.3 Index: BagType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/BagType.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BagType.cs 9 Apr 2004 12:37:56 -0000 1.2 --- BagType.cs 3 May 2004 04:52:11 -0000 1.3 *************** *** 23,27 **** public override System.Type ReturnedClass { ! get { return typeof(IList); } } --- 23,27 ---- public override System.Type ReturnedClass { ! get { return typeof(ICollection); } } |
From: Michael D. <mik...@us...> - 2004-04-30 18:39:56
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10155 Modified Files: NHibernate-1.1.csproj NHibernate.cs Log Message: Added AnsiStringType so there could be a mapping to a varchar column. Index: NHibernate-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate-1.1.csproj,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** NHibernate-1.1.csproj 30 Apr 2004 13:10:17 -0000 1.22 --- NHibernate-1.1.csproj 30 Apr 2004 18:39:47 -0000 1.23 *************** *** 1549,1552 **** --- 1549,1557 ---- /> <File + RelPath = "Type\AnsiStringType.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Type\ArrayType.cs" SubType = "Code" Index: NHibernate.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** NHibernate.cs 29 Apr 2004 14:00:51 -0000 1.17 --- NHibernate.cs 30 Apr 2004 18:39:47 -0000 1.18 *************** *** 17,20 **** --- 17,25 ---- /// <summary> + /// NHibernate Ansi String type + /// </summary> + public static readonly NullableType AnsiString = TypeFactory.GetAnsiStringType(); + + /// <summary> /// NHibernate binary type /// </summary> *************** *** 97,106 **** /// <summary> ! /// NHibernate string type /// </summary> public static readonly NullableType String = TypeFactory.GetStringType(); /// <summary> ! /// NHibernate time type /// </summary> public static readonly NullableType Time = TypeFactory.GetTimeType(); --- 102,111 ---- /// <summary> ! /// NHibernate String type /// </summary> public static readonly NullableType String = TypeFactory.GetStringType(); /// <summary> ! /// NHibernate Time type /// </summary> public static readonly NullableType Time = TypeFactory.GetTimeType(); *************** *** 117,131 **** /// <summary> ! /// NHibernate timestamp type /// </summary> public static readonly NullableType Timestamp = TypeFactory.GetTimestampType(); //new TimestampType(); /// <summary> ! /// NHibernate true_false type /// </summary> public static readonly NullableType TrueFalse = TypeFactory.GetTrueFalseType(); /// <summary> ! /// NHibernate yes_no type /// </summary> public static readonly NullableType YesNo = TypeFactory.GetYesNoType(); --- 122,136 ---- /// <summary> ! /// NHibernate Timestamp type /// </summary> public static readonly NullableType Timestamp = TypeFactory.GetTimestampType(); //new TimestampType(); /// <summary> ! /// NHibernate TrueFalse type /// </summary> public static readonly NullableType TrueFalse = TypeFactory.GetTrueFalseType(); /// <summary> ! /// NHibernate YesNo type /// </summary> public static readonly NullableType YesNo = TypeFactory.GetYesNoType(); |
From: Michael D. <mik...@us...> - 2004-04-30 18:39:55
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10155/Type Modified Files: TypeFactory.cs Added Files: AnsiStringType.cs Log Message: Added AnsiStringType so there could be a mapping to a varchar column. Index: TypeFactory.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TypeFactory.cs,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** TypeFactory.cs 29 Apr 2004 14:00:54 -0000 1.29 --- TypeFactory.cs 30 Apr 2004 18:39:47 -0000 1.30 *************** *** 23,27 **** /// a reference to the IType. /// </remarks> - public class TypeFactory { --- 23,26 ---- *************** *** 85,88 **** --- 84,88 ---- //basicTypes.Add(NHibernate.Timezone.Name, NHibernate.Timezone); + TypeFactory.GetAnsiStringType(); TypeFactory.GetBinaryType(); TypeFactory.GetBooleanType(); *************** *** 109,112 **** --- 109,113 ---- TypeFactory.GetTimeSpanType(); + getTypeDelegatesWithLength.Add(TypeFactory.GetAnsiStringType().Name, new GetNullableTypeWithLength(GetAnsiStringType)); getTypeDelegatesWithLength.Add(TypeFactory.GetBinaryType().Name, new GetNullableTypeWithLength(GetBinaryType)); getTypeDelegatesWithLength.Add(TypeFactory.GetDoubleType().Name, new GetNullableTypeWithLength(GetDoubleType)); *************** *** 381,384 **** --- 382,413 ---- } + public static NullableType GetAnsiStringType() + { + string key = typeof(AnsiStringType).FullName; + + NullableType returnType = (NullableType)typeByTypeOfName[key]; + if(returnType==null) + { + returnType = GetAnsiStringType(255); + AddToTypeOfName(key, returnType); + } + + return returnType; + } + + public static NullableType GetAnsiStringType(int length) + { + string key = GetKeyForLengthBased(typeof(AnsiStringType).FullName, length); + + NullableType returnType = (NullableType)typeByTypeOfName[key]; + if(returnType==null) + { + returnType = new AnsiStringType(SqlTypeFactory.GetAnsiString(length)); + AddToTypeOfNameWithLength(key, returnType); + } + return returnType; + } + + /// <summary> /// Gets the BinaryType with the default size. --- NEW FILE: AnsiStringType.cs --- using System; using System.Data; using NHibernate.SqlTypes; using NHibernate.Util; namespace NHibernate.Type { /// <summary> /// Maps a <see cref="System.String"/> Property /// to a <see cref="DbType.AnsiString"/> column. /// </summary> public class AnsiStringType : ImmutableType, IDiscriminatorType { internal AnsiStringType(AnsiStringSqlType sqlType) : base(sqlType) {} public override object Get(IDataReader rs, int index) { return rs.GetString(index); } public override object Get(IDataReader rs, string name) { return Get(rs, rs.GetOrdinal(name)); } public override System.Type ReturnedClass { get { return typeof(string); } } public override void Set(IDbCommand st, object value, int index) { IDataParameter parm = st.Parameters[index] as IDataParameter; parm.Value = value; } public override string Name { get { return "AnsiString"; } } public string ObjectToSQLString(object value) { return "'" + (string) value + "'"; } public object StringToObject(string xml) { return xml; } public override bool Equals(object x, object y) { return ObjectUtils.Equals(x, y); } public override string ToXML(object value) { return (string) value; } } } |
From: Peter S. <sz...@us...> - 2004-04-30 16:24:31
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15934/NHibernate/Type Modified Files: TimeSpanType.cs Log Message: Fixed typo Index: TimeSpanType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TimeSpanType.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TimeSpanType.cs 21 Apr 2004 14:33:07 -0000 1.1 --- TimeSpanType.cs 30 Apr 2004 16:24:23 -0000 1.2 *************** *** 19,23 **** public override object Get(IDataReader rs, int index) { ! return new DateTime(rs.GetInt64(index)); } --- 19,23 ---- public override object Get(IDataReader rs, int index) { ! return new TimeSpan(rs.GetInt64(index)); } |
From: Peter S. <sz...@us...> - 2004-04-30 15:51:20
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9589/NHibernate.Test Modified Files: FooBarTest.cs Log Message: Foobar Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** FooBarTest.cs 30 Apr 2004 15:03:06 -0000 1.18 --- FooBarTest.cs 30 Apr 2004 15:51:11 -0000 1.19 *************** *** 41,45 **** [Test] - [Ignore("don't know how to get aliased name for baz")] public void FetchInitializedCollection() { --- 41,44 ---- *************** *** 52,56 **** s.Save(baz); fooBag = baz.fooBag; ! s.Find("from Baz baz left join fetch baz.fooBag"); Assert.IsTrue( NHibernate.IsInitialized(fooBag) ); Assert.IsTrue( fooBag==baz.fooBag ); --- 51,55 ---- s.Save(baz); fooBag = baz.fooBag; ! s.Find("from Baz baz left join fetch fooBag"); Assert.IsTrue( NHibernate.IsInitialized(fooBag) ); Assert.IsTrue( fooBag==baz.fooBag ); *************** *** 62,66 **** Object bag = baz.fooBag; Assert.IsFalse( NHibernate.IsInitialized(bag) ); ! s.Find("from Baz baz left join fetch baz.fooBag"); Assert.IsFalse( NHibernate.IsInitialized(bag) ); Assert.IsTrue( bag==baz.fooBag ); --- 61,65 ---- Object bag = baz.fooBag; Assert.IsFalse( NHibernate.IsInitialized(bag) ); ! s.Find("from Baz baz left join fetch fooBag"); Assert.IsFalse( NHibernate.IsInitialized(bag) ); Assert.IsTrue( bag==baz.fooBag ); *************** *** 73,77 **** [Test] - //[Ignore("HQL is broke")] public void Sortables() { --- 72,75 ---- *************** *** 144,148 **** [Test] - [Ignore("don't know how to get aliased name for bazid")] public void FetchList() { --- 142,145 ---- *************** *** 162,166 **** } baz.fees = list; ! list = s.Find("from Foo foo, Baz baz left join fetch baz.fees"); Assert.IsTrue( NHibernate.IsInitialized( ( (Baz) ( (object[]) list[0] )[1] ).fees ) ); s.Delete(foo); --- 159,163 ---- } baz.fees = list; ! list = s.Find("from Foo foo, Baz baz left join fetch fees"); Assert.IsTrue( NHibernate.IsInitialized( ( (Baz) ( (object[]) list[0] )[1] ).fees ) ); s.Delete(foo); |