diff --git a/targets.bas b/targets.bas index 977d4d4..759557d 100644 --- a/targets.bas +++ b/targets.bas @@ -16,12 +16,12 @@ Sub get_options() sql = "SELECT * FROM rlarp.get_options('" & mold & "');" res = x.ADOp_SelectS(0, sql, True, 100, True, PostgreSQLODBC, "usmidlnx01", False, "report", "", "Port=5030;Database=ubm") - ws.Range("L1:O350").ClearContents - Call x.SHTp_Dump(res, ws.Name, 1, 12, False, True, 13) + ws.Range("M1:P350").ClearContents + Call x.SHTp_Dump(res, ws.Name, 1, 13, False, True, 15) sql = "SELECT * FROM rlarp.get_option_costs('" & mold & "');" res = x.ADOp_SelectS(0, sql, True, 100, True, PostgreSQLODBC, "usmidlnx01", False, "report", "", "Port=5030;Database=ubm") - ws.Range("C1:J350").ClearContents + ws.Range("C1:K350").ClearContents Call x.SHTp_Dump(res, ws.Name, 1, 3, False, True, 8) Call x.ADOp_CloseCon(0) @@ -53,8 +53,8 @@ Sub combine_options() res = x.ADOp_SelectS(0, sql, True, 5000, True, PostgreSQLODBC, "usmidlnx01", False, "report", "", "Port=5030;Database=ubm") Call x.ADOp_CloseCon(0) - ws.Range("Q1:AC5000").ClearContents - Call x.SHTp_Dump(res, ws.Name, 1, 17, False, True) + ws.Range("R1:AD5000").ClearContents + Call x.SHTp_Dump(res, ws.Name, 1, 18, False, True) End Sub @@ -76,8 +76,8 @@ Sub save_targets() Set ws = ActiveSheet - opt = x.SHTp_Get(ws.Name, 1, 12, True) - tar = x.SHTp_Get(ws.Name, 1, 17, True) + opt = x.SHTp_Get(ws.Name, 1, 13, True) + tar = x.SHTp_Get(ws.Name, 1, 18, True) path = Sheets("env").Cells(1, 2) & "\" & ActiveSheet.Cells(2, 1) & "\options.csv" If Not x.FILEp_CreateCSV(path, opt) Then @@ -90,13 +90,14 @@ Sub save_targets() Exit Sub End If + '--------------------mssql merge---------------------------- sql() = x.FILEp_GetTXT(Sheets("env").Cells(1, 2) & "\000\merge.sql", 1000) For i = LBound(sql, 2) To UBound(sql, 2) sqlt = sqlt & sql(0, i) & vbCrLf Next i - targt = x.SQLp_build_sql_values(x.SHTp_Get(ws.Name, 1, 17, True), True, True, PostgreSQL, False, "N", "N", "S", "S", "S", "S", "S", "S", "N", "N", "N", "N", "N") + targt = x.SQLp_build_sql_values(x.SHTp_Get(ws.Name, 1, 18, True), True, True, PostgreSQL, False, "N", "N", "S", "S", "S", "S", "S", "S", "N", "N", "N", "N", "N") sqlt = Replace(sqlt, "replace_this", targt) @@ -104,10 +105,25 @@ Sub save_targets() Exit Sub End If - Dim Foldername As String - Foldername = Sheets("env").Cells(1, 2) & "\" & ActiveSheet.Cells(2, 1) + '--------------------postgres merge---------------------------- + sql() = x.FILEp_GetTXT(Sheets("env").Cells(1, 2) & "\000\merge.pg.sql", 1000) - Shell "C:\WINDOWS\explorer.exe """ & Foldername & "", vbNormalFocus + sqlt = "" + For i = LBound(sql, 2) To UBound(sql, 2) + sqlt = sqlt & sql(0, i) & vbCrLf + Next i + + targt = x.SQLp_build_sql_values(x.SHTp_Get(ws.Name, 1, 18, True), True, True, PostgreSQL, False, "N", "N", "S", "S", "S", "S", "S", "S", "N", "N", "N", "N", "N") + + sqlt = Replace(sqlt, "replace_this", targt) + + If Not x.FILEp_Create(Sheets("env").Cells(1, 2) & "\" & ActiveSheet.Cells(2, 1) & "\merge.pg.sql", sqlt) Then + Exit Sub + End If + + 'Dim Foldername As String + 'Foldername = Sheets("env").Cells(1, 2) & "\" & ActiveSheet.Cells(2, 1) + 'Shell "C:\WINDOWS\explorer.exe """ & Foldername & "", vbNormalFocus End Sub