Skip to content

Commit

Permalink
Added * expression for indicating to select all fields from a table. C…
Browse files Browse the repository at this point in the history
…loses #11.

This is particular relevant when utilising the TableJoins because by default all fields are selected, however sometimes aliases need to be added to particular fields.
  • Loading branch information
hisystems committed Mar 10, 2012
1 parent 7ff02b6 commit 347bc73
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
1 change: 1 addition & 0 deletions DatabaseObjects.vbproj
Expand Up @@ -188,6 +188,7 @@
<Compile Include="Misc\AssemblyInfo.vb" />
<Compile Include="SQL\Amend\SQLInsertFromSelect.vb" />
<Compile Include="SQL\Amend\SQLUpdateField.vb" />
<Compile Include="SQL\Expressions\SQLAllFieldsExpression.vb" />
<Compile Include="SQL\Expressions\SQLRightFunctionExpression.vb" />
<Compile Include="SQL\Expressions\SQLArithmeticExpression.vb" />
<Compile Include="SQL\Expressions\SQLBitwiseExpression.vb" />
Expand Down
60 changes: 60 additions & 0 deletions SQL/Expressions/SQLAllFieldsExpression.vb
@@ -0,0 +1,60 @@
' ___________________________________________________
'
' (c) Hi-Integrity Systems 2012. All rights reserved.
' www.hisystems.com.au - Toby Wicks
' ___________________________________________________
'

Option Strict On
Option Explicit On

Namespace SQL

''' <summary>
''' Represents '*' or 'T.*' when used to select all fields from a table or join.
''' </summary>
''' <remarks></remarks>
Public Class SQLAllFieldsExpression
Inherits SQLExpression

Private pobjTable As SQLSelectTable

Public Sub New()

End Sub

Public Sub New(ByVal objTable As SQLSelectTable)

Me.Table = objTable

End Sub

Public Property Table() As SQLSelectTable
Get

Return pobjTable

End Get

Set(ByVal Value As SQLSelectTable)

pobjTable = Value

End Set
End Property

Friend Overrides Function SQL(ByVal eConnectionType As Database.ConnectionType) As String

Dim strSQL As String = String.Empty

If pobjTable IsNot Nothing Then
strSQL = SQLConvertIdentifierName(pobjTable.GetPrefix, eConnectionType) & "."
End If

Return strSQL & "*"

End Function

End Class

End Namespace

0 comments on commit 347bc73

Please sign in to comment.