Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored SQLLeftExpression and renamed to SQLLeftFunctionExpression. …
…Closes #30. Renamed SQLLeftExpression to SQLLeftFunctionExpression for consistency.
- Loading branch information
Showing
2 changed files
with
37 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 36 additions & 45 deletions
81
SQL/Expressions/SQLLeftExpression.vb → SQL/Expressions/SQLLeftFunctionExpression.vb
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |