Skip to content

Commit

Permalink
update SqlTools (bugfix)
Browse files Browse the repository at this point in the history
  • Loading branch information
josef-poetzl committed Jan 22, 2024
1 parent 5df940e commit 97df07f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Binary file modified access-add-in/ACLibFilterFormWizard.accda
Binary file not shown.
2 changes: 1 addition & 1 deletion source/_config_Application.bas
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Option Explicit
Option Private Module

'Version
Private Const APPLICATION_VERSION As String = "1.8.3" '2024-01
Private Const APPLICATION_VERSION As String = "1.8.4" '2024-01

#Const USE_CLASS_APPLICATIONHANDLER_APPFILE = 1
#Const USE_CLASS_APPLICATIONHANDLER_VERSION = 1
Expand Down
18 changes: 10 additions & 8 deletions source/codelib/data/SqlTools.cls
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ Public Function BuildCriteria(ByVal FieldName As String, ByVal FieldDataType As
'Special cases (part 2):
If Not IsArray(FilterValue) Then

If FieldDataType = SQL_Numeric Then
If FieldDataType = SQL_Numeric Or FieldDataType = SQL_Date Then

If FilterValue = "*" And RelationalOperator = SQL_Equal Then
BuildCriteria = BuildCriteria(FieldName, FieldDataType, SQL_Not, Null, Null, 0, True)
Expand Down Expand Up @@ -354,7 +354,7 @@ Public Function BuildCriteria(ByVal FieldName As String, ByVal FieldDataType As
Exit Function
End If

If (RelationalOperator And SQL_Like) = SQL_Like Then
If (RelationalOperator And SQL_Like) = SQL_Like Or (RelationalOperator And SQL_UseLikeBehavior) = SQL_UseLikeBehavior Then
If SqlWildCardString <> "*" Then
If InStr(1, FilterValue, "*") > 0 Then
FilterValue = Replace(FilterValue, "[*]", "@@@|||STAR|||@@@")
Expand All @@ -372,7 +372,7 @@ Public Function BuildCriteria(ByVal FieldName As String, ByVal FieldDataType As
End If

If (RelationalOperator And SQL_Add_WildCardPrefix) = SQL_Add_WildCardPrefix Then
If (RelationalOperator And SQL_Like) = SQL_Like Then
If (RelationalOperator And SQL_Like) = SQL_Like Or (RelationalOperator And SQL_UseLikeBehavior) = SQL_UseLikeBehavior Then
FilterValue = SqlWildCardString & FilterValue
End If
End If
Expand Down Expand Up @@ -798,9 +798,9 @@ Private Function TryBuildWildCardSuffixOrPreBuildParams(ByVal FieldName As Strin
Dim Criteria1 As String
Dim Criteria2 As String

If (RelationalOperator And SQL_Like) = SQL_Like Then
If (RelationalOperator And SQL_Like) = SQL_Like Or (RelationalOperator And SQL_UseLikeBehavior) = SQL_UseLikeBehavior Then
FilterValue = FilterValue & SqlWildCardString
ElseIf (FieldDataType And SQL_Date) = SQL_Date Then
ElseIf FieldDataType = SQL_Date Then
If (RelationalOperator And SQL_LessThan) = 0 Then ' no < therefore: >, >= or only =
If (RelationalOperator And SQL_GreaterThan) = SQL_GreaterThan Then
' change nothing ... >= DataValue / SQL_Add_WildCardSuffix is not logical
Expand All @@ -817,7 +817,7 @@ Private Function TryBuildWildCardSuffixOrPreBuildParams(ByVal FieldName As Strin
End If
FilterValue = DateAdd("d", 1, CDate(CLng(FilterValue)))
End If
ElseIf (FieldDataType And SQL_Numeric) = SQL_Numeric Then
ElseIf FieldDataType = SQL_Numeric Then
If (RelationalOperator And SQL_LessThan) = 0 Then ' no < daher: >, >= or only =
If (RelationalOperator And SQL_GreaterThan) = SQL_GreaterThan Then
If FilterValue Like "*[,.]*[*]" Then
Expand Down Expand Up @@ -865,8 +865,10 @@ Private Function TryBuildNumericSpecialCasesCriteria(ByRef FieldName As String,

Const FilterValue2 As Variant = Null

FilterValue = Trim(FilterValue)

If VarType(FilterValue) = vbString Then
FilterValue = Trim(FilterValue)
End If

If FilterValue Like "[0-9]*..*[0-9]*" Or FilterValue Like "[+-][0-9]*..*[0-9]*" Then
TempArr = Split(FilterValue, "..")
Criteria = BuildCriteria(FieldName, FieldDataType, SQL_Between, Trim(TempArr(0)), Trim(TempArr(1)), IgnoreValue, DisableIgnoreNullValue)
Expand Down

0 comments on commit 97df07f

Please sign in to comment.