merge latest updates

This commit is contained in:
Paul Trowbridge 2024-03-05 08:36:02 -05:00
parent faf78de0c5
commit 40b02b2bc5
2 changed files with 22 additions and 7 deletions

23
FL.bas
View File

@ -535,6 +535,9 @@ Sub sql_from_range_db2_qh()
End Sub End Sub
Sub sql_from_range_db2_noqh() Sub sql_from_range_db2_noqh()
Dim x As New TheBigOne Dim x As New TheBigOne
@ -545,13 +548,25 @@ Sub sql_from_range_db2_noqh()
End Sub End Sub
Sub sql_from_range_pg_qh() Sub sql_from_range_pg_qh()
Dim x As New TheBigOne Dim x As New TheBigOne
Dim wapi As New Windows_API Dim wapi As New Windows_API
Dim r() As String Dim r() As String
Selection.CurrentRegion.Select Selection.CurrentRegion.Select
Call wapi.ClipBoard_SetData(x.SQLp_build_sql_values(x.ARRAYp_get_range_string(Selection), True, True, PostgreSQL, True)) Call wapi.ClipBoard_SetData(x.SQLp_build_sql_values(x.ARRAYp_get_range_string(Selection), True, True, PostgreSQL, True, True))
End Sub
Sub sql_from_range_pg_qh_all()
Dim x As New TheBigOne
Dim wapi As New Windows_API
Dim r() As String
Selection.CurrentRegion.Select
Call wapi.ClipBoard_SetData(x.SQLp_build_sql_values(x.ARRAYp_get_range_string(Selection), True, True, PostgreSQL, True, True, "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A"))
End Sub End Sub
@ -1661,7 +1676,7 @@ Sub pricegroup_upload()
'---------------------------postgres------------------------------ '---------------------------postgres------------------------------
sql = x.SQLp_build_sql_values(x.ARRAYp_get_range_string(Selection), True, True, PostgreSQL, False, True, "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "A", "A", "J") sql = x.SQLp_build_sql_values(x.ARRAYp_get_range_string(Selection), True, True, PostgreSQL, False, True, "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "A", "A", "J", "S")
sql = "BEGIN;" & vbCrLf & "DELETE FROM rlarp.price_map;" & vbCrLf & "INSERT INTO rlarp.price_map" & vbCrLf & sql & ";" sql = "BEGIN;" & vbCrLf & "DELETE FROM rlarp.price_map;" & vbCrLf & "INSERT INTO rlarp.price_map" & vbCrLf & sql & ";"
sql = sql & vbCrLf & "REFRESH MATERIALIZED VIEW rlarp.molds;" sql = sql & vbCrLf & "REFRESH MATERIALIZED VIEW rlarp.molds;"
sql = sql & vbCrLf & "COMMIT;" sql = sql & vbCrLf & "COMMIT;"
@ -1679,7 +1694,7 @@ Sub pricegroup_upload()
'---------------------------sql server------------------------------ '---------------------------sql server------------------------------
sql = x.SQLp_build_sql_values(x.ARRAYp_get_range_string(Selection), True, True, PostgreSQL, False, True, "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "A", "A", "A") sql = x.SQLp_build_sql_values(x.ARRAYp_get_range_string(Selection), True, True, PostgreSQL, False, True, "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "A", "A", "A", "S")
sql = "BEGIN" & vbCrLf & "DELETE FROM rlarp.price_map;" & vbCrLf & "INSERT INTO rlarp.price_map" & vbCrLf & sql & ";" & vbCrLf & "END" sql = "BEGIN" & vbCrLf & "DELETE FROM rlarp.price_map;" & vbCrLf & "INSERT INTO rlarp.price_map" & vbCrLf & sql & ";" & vbCrLf & "END"
If Not x.ADOp_Exec(1, sql, 1, True, ADOinterface.SqlServer, "usmidsql01", True) Then If Not x.ADOp_Exec(1, sql, 1, True, ADOinterface.SqlServer, "usmidsql01", True) Then
@ -1735,7 +1750,7 @@ Sub pricegroup_upload_db2()
inc = 250 inc = 250
Do While i <= UBound(ul, 2) Do While i <= UBound(ul, 2)
'sql = x.ADOp_BuildInsertSQL(ul, "rlarp.price_map", True, i, WorksheetFunction.Min(i + inc, UBound(ul, 2)), Array("S", "S", "S", "S", "S", "S", "S", "N", "S", "S")) 'sql = x.ADOp_BuildInsertSQL(ul, "rlarp.price_map", True, i, WorksheetFunction.Min(i + inc, UBound(ul, 2)), Array("S", "S", "S", "S", "S", "S", "S", "N", "S", "S"))
sql = x.SQLp_build_sql_values_ranged(ul, False, True, Db2, False, True, i, i + inc, "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "A", "A", "A") sql = x.SQLp_build_sql_values_ranged(ul, False, True, Db2, False, True, i, i + inc, "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "A", "A", "A", "S")
sql = "INSERT INTO rlarp.price_map " & vbCrLf & sql sql = "INSERT INTO rlarp.price_map " & vbCrLf & sql
If Not x.ADOp_Exec(0, sql) Then If Not x.ADOp_Exec(0, sql) Then
MsgBox (x.ADOo_errstring) MsgBox (x.ADOo_errstring)

View File

@ -28,7 +28,7 @@ End Enum
Public Enum SQLsyntax Public Enum SQLsyntax
Db2 = 0 Db2 = 0
SqlServer = 1 MSSQL = 1
PostgreSQL = 2 PostgreSQL = 2
End Enum End Enum
@ -2718,7 +2718,7 @@ Public Function SQLp_build_sql_values(ByRef tbl() As String, trim As Boolean, he
Select Case syntax Select Case syntax
Case SQLsyntax.Db2 Case SQLsyntax.Db2
sql = "SELECT * FROM TABLE( VALUES" & vbCrLf & sql & vbCrLf & ") x" sql = "SELECT * FROM TABLE( VALUES" & vbCrLf & sql & vbCrLf & ") x"
Case SQLsyntax.SqlServer Case SQLsyntax.MSSQL
sql = "SELECT * FROM (VALUES" & vbCrLf & sql & vbCrLf & ") x" sql = "SELECT * FROM (VALUES" & vbCrLf & sql & vbCrLf & ") x"
Case SQLsyntax.PostgreSQL Case SQLsyntax.PostgreSQL
sql = "SELECT * FROM (VALUES" & vbCrLf & sql & vbCrLf & ") x" sql = "SELECT * FROM (VALUES" & vbCrLf & sql & vbCrLf & ") x"
@ -2882,7 +2882,7 @@ Public Function SQLp_build_sql_values_ranged(ByRef tbl() As String, trim As Bool
Select Case syntax Select Case syntax
Case SQLsyntax.Db2 Case SQLsyntax.Db2
sql = "SELECT * FROM TABLE( VALUES" & vbCrLf & sql & vbCrLf & ") x" sql = "SELECT * FROM TABLE( VALUES" & vbCrLf & sql & vbCrLf & ") x"
Case SQLsyntax.SqlServer Case SQLsyntax.MSSQL
sql = "SELECT * FROM (VALUES" & vbCrLf & sql & vbCrLf & ") x" sql = "SELECT * FROM (VALUES" & vbCrLf & sql & vbCrLf & ") x"
Case SQLsyntax.PostgreSQL Case SQLsyntax.PostgreSQL
sql = "SELECT * FROM (VALUES" & vbCrLf & sql & vbCrLf & ") x" sql = "SELECT * FROM (VALUES" & vbCrLf & sql & vbCrLf & ") x"