set header values, wrap the sql in a commit block, close the connection

This commit is contained in:
Paul Trowbridge 2021-03-15 16:02:45 -04:00
parent b1328fac50
commit 0101b45e8a

24
FL.bas
View File

@ -1489,6 +1489,18 @@ Sub price_load_pcore()
For pcount = 1 To UBound(pcol)
ReDim load(9, UBound(big, 2))
'----set headers-----
load(0, 0) = "stlc"
load(1, 0) = "coltier"
load(2, 0) = "branding"
load(3, 0) = "accs"
load(4, 0) = "suff"
load(5, 0) = "pckg"
load(6, 0) = "pack"
load(7, 0) = "mp"
load(8, 0) = "bulk"
load(9, 0) = "plist"
'-----populate------------
For i = 1 To UBound(big, 2)
load(0, i) = big(0, i)
load(1, i) = big(1, i)
@ -1501,13 +1513,21 @@ Sub price_load_pcore()
load(8, i) = Format(big(pcol(pcount) - 1, i), "####0.00")
load(9, i) = big(pcol(pcount) - 0, i)
Next i
sql = x.SQLp_build_sql_values(load, True, False, PostgreSQL, False, "S", "S", "S", "S", "S", "S", "N", "N", "N", "S")
sql = "INSERT INTO rlarp.pcore" & vbCrLf & sql
'------build insert statement for target price list-----
sql = "BEGIN;"
sql = sql & vbCrLf & "DELETE FROM rlarp.pcore WHERE plist = '" & load(9, 1) & "';"
sql = sql & vbCrLf & "INSERT INTO rlarp.pcore"
sql = sql & vbCrLf & x.SQLp_build_sql_values(load, True, True, PostgreSQL, False, "S", "S", "S", "S", "S", "S", "N", "N", "N", "S") & ";"
sql = sql & vbCrLf & "COMMIT;"
'------do the insert------------------------------------
If Not x.ADOp_Exec(0, sql) Then
MsgBox (x.ADOo_errstring)
Exit Sub
End If
Next pcount
Call x.ADOp_CloseCon(0)
End Sub