Skip to content

Commit

Permalink
Refactored SQLLeftExpression and renamed to SQLLeftFunctionExpression.
Browse files Browse the repository at this point in the history
…Closes #30.

Renamed SQLLeftExpression to SQLLeftFunctionExpression for consistency.
  • Loading branch information
hisystems committed Mar 22, 2012
1 parent 691500c commit fb0d48b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 46 deletions.
2 changes: 1 addition & 1 deletion DatabaseObjects.vbproj
Expand Up @@ -201,7 +201,7 @@
<Compile Include="SQL\Expressions\SQLFieldExpression.vb" />
<Compile Include="SQL\Expressions\SQLFunctionExpression.vb" />
<Compile Include="SQL\Expressions\SQLGetDateFunctionExpression.vb" />
<Compile Include="SQL\Expressions\SQLLeftExpression.vb" />
<Compile Include="SQL\Expressions\SQLLeftFunctionExpression.vb" />
<Compile Include="SQL\Expressions\SQLLengthFunctionExpression.vb" />
<Compile Include="SQL\Select\SQLSelectHavingCondition.vb" />
<Compile Include="SQL\Select\SQLSelectHavingConditions.vb" />
Expand Down
81 changes: 36 additions & 45 deletions SQL/Expressions/SQLLeftExpression.vb → SQL/Expressions/SQLLeftFunctionExpression.vb 100755 → 100644
@@ -1,46 +1,37 @@
' ___________________________________________________
'
' (c) Hi-Integrity Systems 2010. All rights reserved.
' www.hisystems.com.au<http://www.hisystems.com.au> - Toby Wicks
' ___________________________________________________
'

Option Strict On
Option Explicit On

Namespace SQL

Public Class SQLLeftExpression
Inherits SQLExpression

Private pobjExpression As SQLExpression
Private pintLength As Integer

Public Sub New(ByVal strFieldName As String, ByVal intLength As Integer)

Me.New(New SQLFieldExpression(strFieldName), intLength)

End Sub

Public Sub New(ByVal objExpression As SQLExpression, ByVal intLength As Integer)

If objExpression Is Nothing Then
Throw New ArgumentNullException
ElseIf intLength < 0 Then
Throw New ArgumentException("Length: " & intLength)
End If

pobjExpression = objExpression
pintLength = intLength

End Sub

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

Return "LEFT(" & pobjExpression.SQL(eConnectionType) & ", " & pintLength & ")"

End Function

End Class

' ___________________________________________________
'
' (c) Hi-Integrity Systems 2010. All rights reserved.
' www.hisystems.com.au<http://www.hisystems.com.au> - Toby Wicks
' ___________________________________________________
'

Option Strict On
Option Explicit On

Namespace SQL

Public Class SQLLeftFunctionExpression
Inherits SQLFunctionExpression

Private pobjExpression As SQLExpression
Private pintLength As Integer

Public Sub New(ByVal strFieldName As String, ByVal intLength As Integer)

Me.New(New SQLFieldExpression(strFieldName), intLength)

End Sub

Public Sub New(ByVal objExpression As SQLExpression, ByVal intLength As Integer)

MyBase.New("LEFT", objExpression, New SQLValueExpression(intLength))

If intLength < 0 Then
Throw New ArgumentException("Length: " & intLength)
End If

End Sub

End Class

End Namespace

0 comments on commit fb0d48b

Please sign in to comment.