Skip to content

Commit

Permalink
Sorting fix for PostgreSQL and Valentina
Browse files Browse the repository at this point in the history
Parameters do not need to be sorted based on the position they appear
in PostgreSQL and Valentina. The reason is because both PostgreSQL and
Valentina use numbered parameters and the numbers can be out of
sequence.
  • Loading branch information
pjzedalis committed Oct 29, 2016
1 parent 162f11c commit 69c9190
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
Binary file modified Source/.SQLdeLite.xojo_uistate
Binary file not shown.
27 changes: 21 additions & 6 deletions Source/SQLdeLite.xojo_code
Expand Up @@ -796,7 +796,23 @@ Protected Module SQLdeLite

Next

// Let's sort the parameters
// Update the SQLText property
SQLText = _selectText

// PostgreSQL and Valentina do not require parameter sorting as they use numbered parameters which match the positions of the parameters in the dictionary.
#If TargetIOS <> True Then

// PostgreSQLDatabase requires a parameter number (1-based)
If (_dbInfo.FullName = "PostgreSQLDatabase" Or _dbInfo.FullName = "VDatabase") Then

// Return the parameter array
Return _parameters

End If

#EndIf

// Let's sort the parameters for databases where they expect the parameters to be arranged as they appear.
Dim _positions() As Integer
For Each __parameter As SQLdeLite.Parameter In _parameters
_positions.Append(__parameter.Position)
Expand All @@ -814,9 +830,6 @@ Protected Module SQLdeLite

Redim _parameters(-1)

// Update the SQLText property
SQLText = _selectText

// Return the parameter array
Return _parametersSorted
End Function
Expand Down Expand Up @@ -1124,6 +1137,8 @@ Protected Module SQLdeLite
SQLdeLite Release Notes
===================

Version 2.1610.290 - October 30th, 2016
- Fixed issue with positioning parameters for PostgreSQL and Valentina databases (they use numbered parameters and hence do not need to be sorted).
Version 2.1609.130 - September 13th, 2016
- Added String support to support old framework Xojo classes. To enable string support for TextLiteral's navigate to the SQLDeLite.Record class and
rename the 'Operator_Lookup_STRINGSUPPORT' method to just 'Operator_Lookup'. It will join the other overloaded methods and now String support is enabled.
Expand All @@ -1139,7 +1154,7 @@ Protected Module SQLdeLite
#tag Constant, Name = PLUGIN_MSSQL_ENABLED, Type = Boolean, Dynamic = False, Default = \"False", Scope = Public
#tag EndConstant

#tag Constant, Name = PLUGIN_MYSQL_ENABLED, Type = Boolean, Dynamic = False, Default = \"True", Scope = Public
#tag Constant, Name = PLUGIN_MYSQL_ENABLED, Type = Boolean, Dynamic = False, Default = \"False", Scope = Public
#tag EndConstant

#tag Constant, Name = PLUGIN_ODBC_ENABLED, Type = Boolean, Dynamic = False, Default = \"False", Scope = Public
Expand All @@ -1148,7 +1163,7 @@ Protected Module SQLdeLite
#tag Constant, Name = PLUGIN_ORACLE_ENABLED, Type = Boolean, Dynamic = False, Default = \"False", Scope = Public
#tag EndConstant

#tag Constant, Name = PLUGIN_POSTGRESQL_ENABLED, Type = Boolean, Dynamic = False, Default = \"True", Scope = Public
#tag Constant, Name = PLUGIN_POSTGRESQL_ENABLED, Type = Boolean, Dynamic = False, Default = \"False", Scope = Public
#tag EndConstant


Expand Down
2 changes: 1 addition & 1 deletion Source/SQLdeLite.xojo_project
@@ -1,12 +1,12 @@
Type=Desktop
RBProjectVersion=2016.03
MinIDEVersion=20070100
Class=Record;SQLdeLite/Record.xojo_code;&h5A2367FF;&h332D3FFF;false
Class=App;App.xojo_code;&h36F27FFF;&h0;false
Window=Window1;Window1.xojo_window;&h4BD4EFFF;&h0;false
MenuBar=MainMenuBar;MainMenuBar.xojo_menu;&h6E9667FF;&h0;false
Module=SQLdeLite;SQLdeLite.xojo_code;&h332D3FFF;&h0;false
BuildSteps=Build Automation;Build Automation.xojo_code;&h1566BFFF;&h0;false
Class=Record;SQLdeLite/Record.xojo_code;&h5A2367FF;&h332D3FFF;false
Class=Parameter;SQLdeLite/Parameter.xojo_code;&h270EFFFF;&h332D3FFF;false
DefaultWindow=Window1
AppMenuBar=MainMenuBar
Expand Down
6 changes: 6 additions & 0 deletions Source/SQLdeLite/Parameter.xojo_code
Expand Up @@ -37,6 +37,12 @@ Protected Class Parameter
#tag ViewProperty
Name="Name"
Group="Behavior"
Type="String"
#tag EndViewProperty
#tag ViewProperty
Name="Position"
Group="Behavior"
InitialValue="0"
Type="Integer"
#tag EndViewProperty
#tag ViewProperty
Expand Down

0 comments on commit 69c9190

Please sign in to comment.