From: Richard B. <rb...@us...> - 2005-03-15 11:15:04
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29967 Modified Files: CCriteriaCondition.vb CPersistentCollection.vb Log Message: Removed some obsolete code. Fixed MySQL parameters to use new syntax. Index: CCriteriaCondition.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CCriteriaCondition.vb,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- CCriteriaCondition.vb 9 Feb 2005 06:24:44 -0000 1.17 +++ CCriteriaCondition.vb 15 Mar 2005 11:14:50 -0000 1.18 @@ -177,49 +177,7 @@ m_classMap = cm End Sub - '''----------------------------------------------------------------------------- - ''' <summary> - ''' Adds an SQL "OR" condition to the criteria - ''' </summary> - ''' <param name="orCriteria">Another CCriteriaCondition to be "OR"ed with this one.</param> - ''' <remarks>Adds a second criteria condition to this one, and marks it as an - ''' OR condition. The second criteria is used to populate the right hand side of the - ''' OR statement in the SQL when it is generated. - ''' <para>The orCriteria <see cref="P:AToMSFramework.CCriteriaCondition.Parent"/> property is set to the current object.</para></remarks> - ''' <history> - ''' [rbanks] 1/12/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - <Obsolete("This will be removed in future versions - use addSubCriteria")> _ - Public Sub addOrCriteria(ByVal orCriteria As CCriteriaCondition) - m_Simple = False - m_Parts.Add(orCriteria) - orCriteria.useOrWithParent = True - orCriteria.Parent = Me - End Sub - - '''----------------------------------------------------------------------------- - ''' <summary> - ''' Adds an SQL "AND" condition to the criteria - ''' </summary> - ''' <param name="orCriteria">Another CCriteriaCondition to be "AND"ed with this one.</param> - ''' <remarks>Adds a second criteria condition to this one, and marks it as an - ''' OR condition. The second criteria is used to populate the right hand side of the - ''' OR statement in the SQL when it is generated. - ''' <para>The orCriteria <see cref="P:AToMSFramework.CCriteriaCondition.Parent"/> property is set to the current object.</para></remarks> - ''' <history> - ''' [rbanks] 1/12/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - <Obsolete("This will be removed in future versions - use addSubCriteria")> _ - Public Sub addAndSubCriteria(ByVal andCriteria As CCriteriaCondition) - m_Simple = False - m_Parts.Add(andCriteria) - andCriteria.useOrWithParent = False - andCriteria.Parent = Me - End Sub - - ''' ----------------------------------------------------------------------------- + ''' ----------------------------------------------------------------------------- ''' <summary> ''' Adds a subcriteria to this criteria ''' </summary> @@ -361,51 +319,7 @@ End If End Sub - '''----------------------------------------------------------------------------- - ''' <summary> - ''' Obsolete. Do not use. - ''' </summary> - ''' <param name="attributeName"></param> - ''' <param name="cs"></param> - ''' <remarks></remarks> - ''' <history> - ''' [rbanks] 1/12/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - Private Sub setAttributeMap(ByVal attributeName As String, ByRef cs As CSelectionCriteria) - Dim AttrMap As CAttributeMap - Dim myArrayStrings As Object - myArrayStrings = Split(attributeName, ".", -1, CompareMethod.Text) - Dim clMap As CClassMap - clMap = m_classMap - - Dim i, j As Short - Dim strName As String - Dim udaMap As CUDAMap - For i = 0 To UBound(myArrayStrings) - 1 - strName = myArrayStrings(i) - udaMap = clMap.AssociationMaps(strName) - m_Associations.Add(udaMap) - - clMap = udaMap.toclass - If Not clMap Is Nothing Then - For j = 1 To clMap.Tables.Count() - m_Tables.Add(clMap.Tables.Item(j)) - Next j - Else - Exit For - End If - Next i - - If Not clMap Is Nothing Then - AttrMap = clMap.getAttributeMapByString(myArrayStrings(UBound(myArrayStrings)), True) - End If - - cs.AttrMap = AttrMap - cs.ClassMap = clMap - End Sub - - '''----------------------------------------------------------------------------- + '''----------------------------------------------------------------------------- ''' <summary> ''' Creates a Greater Than selection criteria. ''' </summary> Index: CPersistentCollection.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistentCollection.vb,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- CPersistentCollection.vb 14 Feb 2005 02:23:11 -0000 1.16 +++ CPersistentCollection.vb 15 Mar 2005 11:14:51 -0000 1.17 @@ -44,166 +44,166 @@ ''' [rbanks] 17/12/2003 Created ''' </history> '''----------------------------------------------------------------------------- - <Browsable(False), Obsolete("Changes in collection management have made this obsolete. Please use the ListChanged event for equivalent functionality")> _ - Public Property ContainerObject() As CPersistentObject - Get - Return m_container - End Get - Set(ByVal Value As CPersistentObject) - m_container = Value - End Set - End Property + <Browsable(False)> _ + Public Property ContainerObject() As CPersistentObject + Get + Return m_container + End Get + Set(ByVal Value As CPersistentObject) + m_container = Value + End Set + End Property - <Browsable(False)> Public Shadows ReadOnly Property Count() As Integer - Get - Return MyBase.Count - End Get - End Property + <Browsable(False)> Public Shadows ReadOnly Property Count() As Integer + Get + Return MyBase.Count + End Get + End Property - '''----------------------------------------------------------------------------- - ''' <summary> - ''' Adds an item to the collection. - ''' </summary> - ''' <param name="cp">A CPersistentObject to be added.</param> - ''' <remarks>The persistent object is added to the collection. If the container - ''' object reference is set then the dirty flag on the container object is set.</remarks> - ''' <history> - ''' [rbanks] 17/12/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - Public Sub Add(ByVal cp As CPersistentObject) - ' Debug.WriteLine("Coll: add method called") - list.Add(cp) - End Sub + '''----------------------------------------------------------------------------- + ''' <summary> + ''' Adds an item to the collection. + ''' </summary> + ''' <param name="cp">A CPersistentObject to be added.</param> + ''' <remarks>The persistent object is added to the collection. If the container + ''' object reference is set then the dirty flag on the container object is set.</remarks> + ''' <history> + ''' [rbanks] 17/12/2003 Created + ''' </history> + '''----------------------------------------------------------------------------- + Public Sub Add(ByVal cp As CPersistentObject) + ' Debug.WriteLine("Coll: add method called") + list.Add(cp) + End Sub - '''----------------------------------------------------------------------------- - ''' <summary> - ''' Removes an item from the collection. - ''' </summary> - ''' <param name="index">The zero-based position of the item in the collection to remove.</param> - ''' <remarks>Removes the specified item from the collection and sets the - ''' dirty flag on the container object. - ''' <para>An exception is thrown if the index is greater than the number of items in the collection or is - ''' less than zero.</para></remarks> - ''' <history> - ''' [rbanks] 17/12/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - Public Sub Remove(ByVal index As Integer) - ' Debug.WriteLine("Coll: Removing index " & index) - If index > Count - 1 Or index < 0 Then - Throw New Exception("PersistentCollection index value is outside of bounds") - End If - list.RemoveAt(index) - End Sub - '''----------------------------------------------------------------------------- - ''' <summary> - ''' Removes an object from the collection. - ''' </summary> - ''' <param name="value">The object to remove.</param> - ''' <remarks>Removes the specified object from the collection and sets the - ''' dirty flag on the container object.</remarks> - ''' <history> - ''' [rbanks] 17/12/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - Public Sub Remove(ByVal value As CPersistentObject) - ' Debug.WriteLine("Coll: Removing " & value.GetType.Name) - list.Remove(value) - End Sub - '''----------------------------------------------------------------------------- - ''' <summary> - ''' Retrieves the item at the specified position. - ''' </summary> - ''' <param name="index">The zero-based position of the item in the collection.</param> - ''' <value>The CPersistentObject from the specified position.</value> - ''' <remarks>If the index does not refer to a valid position within the collection - ''' and exception will be thrown.</remarks> - ''' <history> - ''' [rbanks] 17/12/2003 Created - ''' </history> - '''----------------------------------------------------------------------------- - Default Public ReadOnly Property Item(ByVal index As Integer) As CPersistentObject - Get - ' Debug.WriteLine("Coll: index property = " & index) - Return CType(list.Item(index), CPersistentObject) - End Get - End Property + '''----------------------------------------------------------------------------- + ''' <summary> + ''' Removes an item from the collection. + ''' </summary> + ''' <param name="index">The zero-based position of the item in the collection to remove.</param> + ''' <remarks>Removes the specified item from the collection and sets the + ''' dirty flag on the container object. + ''' <para>An exception is thrown if the index is greater than the number of items in the collection or is + ''' less than zero.</para></remarks> + ''' <history> + ''' [rbanks] 17/12/2003 Created + ''' </history> + '''----------------------------------------------------------------------------- + Public Sub Remove(ByVal index As Integer) + ' Debug.WriteLine("Coll: Removing index " & index) + If index > Count - 1 Or index < 0 Then + Throw New Exception("PersistentCollection index value is outside of bounds") + End If + list.RemoveAt(index) + End Sub + '''----------------------------------------------------------------------------- + ''' <summary> + ''' Removes an object from the collection. + ''' </summary> + ''' <param name="value">The object to remove.</param> + ''' <remarks>Removes the specified object from the collection and sets the + ''' dirty flag on the container object.</remarks> + ''' <history> + ''' [rbanks] 17/12/2003 Created + ''' </history> + '''----------------------------------------------------------------------------- + Public Sub Remove(ByVal value As CPersistentObject) + ' Debug.WriteLine("Coll: Removing " & value.GetType.Name) + list.Remove(value) + End Sub + '''----------------------------------------------------------------------------- + ''' <summary> + ''' Retrieves the item at the specified position. + ''' </summary> + ''' <param name="index">The zero-based position of the item in the collection.</param> + ''' <value>The CPersistentObject from the specified position.</value> + ''' <remarks>If the index does not refer to a valid position within the collection + ''' and exception will be thrown.</remarks> + ''' <history> + ''' [rbanks] 17/12/2003 Created + ''' </history> + '''----------------------------------------------------------------------------- + Default Public ReadOnly Property Item(ByVal index As Integer) As CPersistentObject + Get + ' Debug.WriteLine("Coll: index property = " & index) + Return CType(list.Item(index), CPersistentObject) + End Get + End Property - '''----------------------------------------------------------------------------- - ''' <summary> - ''' Attempts to save each item in the collection - ''' </summary> - ''' <value>An integer containing the number of objects that were actually saved.</value> - ''' <remarks>Each item in the collection is saved. If an error occurs during the saving - ''' of any object the process is immediately aborted and an exception is thrown. - ''' All objects are saved as part of a single transaction and the transaction is rolled back - ''' when there is an error.</remarks> - ''' <history> - ''' [rbanks] 21/05/2004 Created - ''' </history> - '''----------------------------------------------------------------------------- - Public Function Save() As Integer - Dim cp As CPersistentObject - Dim i As Integer = 0 - Dim pb As CPersistenceBroker = getPersistenceBrokerInstance() + '''----------------------------------------------------------------------------- + ''' <summary> + ''' Attempts to save each item in the collection + ''' </summary> + ''' <value>An integer containing the number of objects that were actually saved.</value> + ''' <remarks>Each item in the collection is saved. If an error occurs during the saving + ''' of any object the process is immediately aborted and an exception is thrown. + ''' All objects are saved as part of a single transaction and the transaction is rolled back + ''' when there is an error.</remarks> + ''' <history> + ''' [rbanks] 21/05/2004 Created + ''' </history> + '''----------------------------------------------------------------------------- + Public Function Save() As Integer + Dim cp As CPersistentObject + Dim i As Integer = 0 + Dim pb As CPersistenceBroker = getPersistenceBrokerInstance() - pb.startTransaction() - For Each cp In list - Try - If cp.IsDirty Then - cp.Save() - If Not cp.IsDirty Then - 'Object was saved - increment counter - i += 1 - End If - End If - Catch ex As Exception - pb.rollback() - Throw New SaveException(ex.Message, ex) - End Try - Next - pb.commit() - Return i - End Function + pb.startTransaction() + For Each cp In list + Try + If cp.IsDirty Then + cp.Save() + If Not cp.IsDirty Then + 'Object was saved - increment counter + i += 1 + End If + End If + Catch ex As Exception + pb.rollback() + Throw New SaveException(ex.Message, ex) + End Try + Next + pb.commit() + Return i + End Function - '''----------------------------------------------------------------------------- - ''' <summary> - ''' Attempts to delete each item in the collection - ''' </summary> - ''' <remarks>Each item in the collection is deleted. If an error occurs during the process - ''' an exception is thrown. All objects are deleted within a single transaction and the transaction is rolled back - ''' when there is an error.</remarks> - ''' <history> - ''' [rbanks] 21/05/2004 Created - ''' </history> - '''----------------------------------------------------------------------------- - Public Sub Delete() - Dim cp As CPersistentObject - Dim i As Integer = 0 - Dim pb As CPersistenceBroker = getPersistenceBrokerInstance() + '''----------------------------------------------------------------------------- + ''' <summary> + ''' Attempts to delete each item in the collection + ''' </summary> + ''' <remarks>Each item in the collection is deleted. If an error occurs during the process + ''' an exception is thrown. All objects are deleted within a single transaction and the transaction is rolled back + ''' when there is an error.</remarks> + ''' <history> + ''' [rbanks] 21/05/2004 Created + ''' </history> + '''----------------------------------------------------------------------------- + Public Sub Delete() + Dim cp As CPersistentObject + Dim i As Integer = 0 + Dim pb As CPersistenceBroker = getPersistenceBrokerInstance() - pb.startTransaction() - For Each cp In list - Try - cp.Delete() - Catch ex As Exception - pb.rollback() - Throw New DeleteException(ex.Message, ex) - End Try - Next - pb.commit() - Me.Clear() - End Sub + pb.startTransaction() + For Each cp In list + Try + cp.Delete() + Catch ex As Exception + pb.rollback() + Throw New DeleteException(ex.Message, ex) + End Try + Next + pb.commit() + Me.Clear() + End Sub - Private Sub ItemDirtiedHandler(ByVal sender As Object, ByVal e As EventArgs) - ' Debug.WriteLine("Collection trapped item dirtied event for " & sender.GetType.Name) - RaiseEvent ItemDirtied(Me, e) - 'If Not Me.ContainerObject Is Nothing Then - ' 'Debug.WriteLine("item dirtied - dirtying container") - ' ContainerObject.SetDirtyFlag() - 'End If - End Sub + Private Sub ItemDirtiedHandler(ByVal sender As Object, ByVal e As EventArgs) + ' Debug.WriteLine("Collection trapped item dirtied event for " & sender.GetType.Name) + RaiseEvent ItemDirtied(Me, e) + 'If Not Me.ContainerObject Is Nothing Then + ' 'Debug.WriteLine("item dirtied - dirtying container") + ' ContainerObject.SetDirtyFlag() + 'End If + End Sub #End Region #Region "IBindlingList" |