Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for advanced SQL expressions. Closes #1.
- Loading branch information
Showing
8 changed files
with
308 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
VERSION 1.0 CLASS | ||
BEGIN | ||
MultiUse = -1 'True | ||
Persistable = 0 'NotPersistable | ||
DataBindingBehavior = 0 'vbNone | ||
DataSourceBehavior = 0 'vbNone | ||
MTSTransactionMode = 0 'NotAnMTSObject | ||
END | ||
Attribute VB_Name = "ISQLExpression" | ||
Attribute VB_GlobalNameSpace = False | ||
Attribute VB_Creatable = False | ||
Attribute VB_PredeclaredId = False | ||
Attribute VB_Exposed = True | ||
' ___________________________________________________ | ||
' | ||
' © Hi-Integrity Systems 2014. All rights reserved. | ||
' www.hisystems.com.au - Toby Wicks | ||
' ___________________________________________________ | ||
' | ||
|
||
Option Explicit | ||
|
||
Public Property Get SQL(ByVal eValue As ConnectionTypeEnum) As String | ||
|
||
End Property |
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
VERSION 1.0 CLASS | ||
BEGIN | ||
MultiUse = -1 'True | ||
Persistable = 0 'NotPersistable | ||
DataBindingBehavior = 0 'vbNone | ||
DataSourceBehavior = 0 'vbNone | ||
MTSTransactionMode = 0 'NotAnMTSObject | ||
END | ||
Attribute VB_Name = "SQLArithmeticExpression" | ||
Attribute VB_GlobalNameSpace = False | ||
Attribute VB_Creatable = True | ||
Attribute VB_PredeclaredId = False | ||
Attribute VB_Exposed = True | ||
' ___________________________________________________ | ||
' | ||
' © Hi-Integrity Systems 2014. All rights reserved. | ||
' www.hisystems.com.au - Toby Wicks | ||
' ___________________________________________________ | ||
' | ||
|
||
Option Explicit | ||
|
||
Implements ISQLExpression | ||
|
||
Public Enum SQLArithmeticOperatorEnum | ||
dboArithmeticAdd | ||
dboArithmeticSubtract | ||
dboArithmeticMultiply | ||
dboArithmeticDivide | ||
dboArithmeticModulus | ||
End Enum | ||
|
||
Public Left As ISQLExpression | ||
Public Right As ISQLExpression | ||
Public Operator As SQLArithmeticOperatorEnum | ||
|
||
Private Sub Class_Initialize() | ||
|
||
Set Left = New SQLValueExpression | ||
Set Right = New SQLValueExpression | ||
Operator = dboArithmeticAdd | ||
|
||
End Sub | ||
|
||
Private Property Get ISQLExpression_SQL(ByVal eConnection As ConnectionTypeEnum) As String | ||
|
||
ISQLExpression_SQL = "(" & Left.SQL(eConnection) & " " & OperatorToString(Operator) & " " & Right.SQL(eConnection) & ")" | ||
|
||
End Property | ||
|
||
Private Function OperatorToString(ByVal eOperator As SQLArithmeticOperatorEnum) As String | ||
|
||
Select Case eOperator | ||
Case dboArithmeticAdd | ||
OperatorToString = "+" | ||
Case dboArithmeticDivide | ||
OperatorToString = "/" | ||
Case dboArithmeticModulus | ||
OperatorToString = "%" | ||
Case dboArithmeticMultiply | ||
OperatorToString = "*" | ||
Case dboArithmeticSubtract | ||
OperatorToString = "-" | ||
Case Else | ||
RaiseError dboErrorInvalidArgument | ||
End Select | ||
|
||
End Function |
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
VERSION 1.0 CLASS | ||
BEGIN | ||
MultiUse = -1 'True | ||
Persistable = 0 'NotPersistable | ||
DataBindingBehavior = 0 'vbNone | ||
DataSourceBehavior = 0 'vbNone | ||
MTSTransactionMode = 0 'NotAnMTSObject | ||
END | ||
Attribute VB_Name = "SQLBitwiseExpression" | ||
Attribute VB_GlobalNameSpace = False | ||
Attribute VB_Creatable = True | ||
Attribute VB_PredeclaredId = False | ||
Attribute VB_Exposed = True | ||
' ___________________________________________________ | ||
' | ||
' © Hi-Integrity Systems 2014. All rights reserved. | ||
' www.hisystems.com.au - Toby Wicks | ||
' ___________________________________________________ | ||
' | ||
|
||
Option Explicit | ||
|
||
Implements ISQLExpression | ||
|
||
Public Enum SQLBitwiseOperatorEnum | ||
dboBitwiseAnd | ||
dboBitwiseOr | ||
dboBitwiseXor | ||
End Enum | ||
|
||
Public Left As ISQLExpression | ||
Public Right As ISQLExpression | ||
Public Operator As SQLBitwiseOperatorEnum | ||
|
||
Private Sub Class_Initialize() | ||
|
||
Set Left = New SQLValueExpression | ||
Set Right = New SQLValueExpression | ||
Operator = dboArithmeticAdd | ||
|
||
End Sub | ||
|
||
Private Property Get ISQLExpression_SQL(ByVal eConnection As ConnectionTypeEnum) As String | ||
|
||
ISQLExpression_SQL = "(" & Left.SQL(eConnection) & " " & OperatorToString(Operator) & " " & Right.SQL(eConnection) & ")" | ||
|
||
End Property | ||
|
||
Private Function OperatorToString(ByVal eOperator As SQLBitwiseOperatorEnum) As String | ||
|
||
Select Case eOperator | ||
Case dboBitwiseAnd | ||
OperatorToString = "&" | ||
Case dboBitwiseOr | ||
OperatorToString = "|" | ||
Case dboBitwiseXor | ||
OperatorToString = "^" | ||
Case Else | ||
RaiseError dboErrorInvalidArgument | ||
End Select | ||
|
||
End Function | ||
|
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
VERSION 1.0 CLASS | ||
BEGIN | ||
MultiUse = -1 'True | ||
Persistable = 0 'NotPersistable | ||
DataBindingBehavior = 0 'vbNone | ||
DataSourceBehavior = 0 'vbNone | ||
MTSTransactionMode = 0 'NotAnMTSObject | ||
END | ||
Attribute VB_Name = "SQLComparisonExpression" | ||
Attribute VB_GlobalNameSpace = False | ||
Attribute VB_Creatable = True | ||
Attribute VB_PredeclaredId = False | ||
Attribute VB_Exposed = True | ||
' ___________________________________________________ | ||
' | ||
' © Hi-Integrity Systems 2014. All rights reserved. | ||
' www.hisystems.com.au - Toby Wicks | ||
' ___________________________________________________ | ||
' | ||
|
||
Option Explicit | ||
|
||
Implements ISQLExpression | ||
|
||
Public Left As ISQLExpression | ||
Public Compare As SQLComparisonOperatorEnum | ||
Public Right As ISQLExpression | ||
|
||
Private Sub Class_Initialize() | ||
|
||
Compare = dboComparisonEqualTo | ||
|
||
End Sub | ||
|
||
Private Property Get ISQLExpression_SQL(ByVal eConnectionType As ConnectionTypeEnum) As String | ||
|
||
ISQLExpression_SQL = "(" & Left.SQL(eConnectionType) & " " & SQLConvertCompare(Compare) & " " & Right.SQL(eConnectionType) & ")" | ||
|
||
End Property | ||
|
||
|
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
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
VERSION 1.0 CLASS | ||
BEGIN | ||
MultiUse = -1 'True | ||
Persistable = 0 'NotPersistable | ||
DataBindingBehavior = 0 'vbNone | ||
DataSourceBehavior = 0 'vbNone | ||
MTSTransactionMode = 0 'NotAnMTSObject | ||
END | ||
Attribute VB_Name = "SQLFieldExpression" | ||
Attribute VB_GlobalNameSpace = False | ||
Attribute VB_Creatable = True | ||
Attribute VB_PredeclaredId = False | ||
Attribute VB_Exposed = True | ||
' ___________________________________________________ | ||
' | ||
' © Hi-Integrity Systems 2014. All rights reserved. | ||
' www.hisystems.com.au - Toby Wicks | ||
' ___________________________________________________ | ||
' | ||
|
||
Option Explicit | ||
|
||
Implements ISQLExpression | ||
|
||
Public Table As SQLSelectTable | ||
Public FieldName As String | ||
|
||
Private Property Get ISQLExpression_SQL(ByVal eConnectionType As ConnectionTypeEnum) As String | ||
|
||
ISQLExpression_SQL = SQLFieldNameAndTablePrefix(Table, FieldName, eConnectionType) | ||
|
||
End Property | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
VERSION 1.0 CLASS | ||
BEGIN | ||
MultiUse = -1 'True | ||
Persistable = 0 'NotPersistable | ||
DataBindingBehavior = 0 'vbNone | ||
DataSourceBehavior = 0 'vbNone | ||
MTSTransactionMode = 0 'NotAnMTSObject | ||
END | ||
Attribute VB_Name = "SQLValueExpression" | ||
Attribute VB_GlobalNameSpace = False | ||
Attribute VB_Creatable = True | ||
Attribute VB_PredeclaredId = False | ||
Attribute VB_Exposed = True | ||
' ___________________________________________________ | ||
' | ||
' © Hi-Integrity Systems 2014. All rights reserved. | ||
' www.hisystems.com.au - Toby Wicks | ||
' ___________________________________________________ | ||
' | ||
|
||
Option Explicit | ||
|
||
Implements ISQLExpression | ||
|
||
Public Value As Variant | ||
|
||
Private Sub Class_Initialize() | ||
|
||
Value = Null | ||
|
||
End Sub | ||
|
||
Private Property Get ISQLExpression_SQL(ByVal eConnectionType As ConnectionTypeEnum) As String | ||
|
||
ISQLExpression_SQL = SQLConvertValue(Value, eConnectionType) | ||
|
||
End Property |
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