Skip to content

Commit

Permalink
Provide access to the parent SQLSelect object from the SQLSelect.Tabl…
Browse files Browse the repository at this point in the history
…es.Joins object. Closes #12.
  • Loading branch information
hisystems committed Mar 10, 2012
1 parent 347bc73 commit 7cc2a8b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
3 changes: 2 additions & 1 deletion SQL/Select/SQLSelect.vb
Expand Up @@ -15,7 +15,7 @@ Namespace SQL
Inherits SQLStatement

Private pobjFields As SQLSelectFields = New SQLSelectFields
Private pobjTables As SQLSelectTables = New SQLSelectTables
Private pobjTables As SQLSelectTables = New SQLSelectTables(Me)
Private pobjConditions As SQLConditions = New SQLConditions
Private pobjHavingConditions As SQLSelectHavingConditions = New SQLSelectHavingConditions
Private pobjOrderByFields As SQLSelectOrderByFields = New SQLSelectOrderByFields
Expand Down Expand Up @@ -107,6 +107,7 @@ Namespace SQL
End If

pobjTables = Value
pobjTables.Parent = Me

End Set
End Property
Expand Down
31 changes: 31 additions & 0 deletions SQL/Select/SQLSelectTables.vb
Expand Up @@ -14,6 +14,7 @@ Namespace SQL
Public Class SQLSelectTables
Implements Collections.Generic.IEnumerable(Of SQLSelectTableBase)

Private pobjParent As SQLSelect
Private pobjTables As New Collections.Generic.List(Of SQLSelectTableBase)
Private pobjJoins As SQLSelectTableJoins = New SQLSelectTableJoins

Expand All @@ -23,6 +24,36 @@ Namespace SQL

End Sub

Friend Sub New(ByVal objParent As SQLSelect)

MyBase.New()

pobjParent = objParent

End Sub

''' <summary>
''' Returns the associated parent SQLSelect object associated with this table collection.
''' Returns nothing if the object is not assigned to an SQLSelect object.
''' </summary>
Public Property Parent As SQLSelect
Get

Return pobjParent

End Get

Friend Set(value As SQLSelect)

If value Is Nothing Then
Throw New ArgumentNullException
End If

pobjParent = value

End Set
End Property

Public Function Add() As SQLSelectTable

Return Add(String.Empty)
Expand Down

0 comments on commit 7cc2a8b

Please sign in to comment.