cat empty to null depending on new flag

This commit is contained in:
Paul Trowbridge 2022-05-05 09:38:13 -04:00
parent 1020edb0e3
commit b4b3b7a25a
2 changed files with 6 additions and 6 deletions

View File

@ -233,7 +233,7 @@ Sub price_load_plcore()
Next i
sql = "DELETE FROM rlarp.plcore WHERE listcode in (" & sql & ");"
sql = sql & vbCrLf & "INSERT INTO rlarp.plcore"
sql = sql & vbCrLf & x.SQLp_build_sql_values(load, True, True, PostgreSQL, False, "S", "S", "S", "S", "S", "S", "S", "N", "N", "S", "N", "N") & ";"
sql = sql & vbCrLf & x.SQLp_build_sql_values(load, True, True, PostgreSQL, False, False, "S", "S", "S", "S", "S", "S", "S", "N", "N", "S", "N", "N") & ";"
If Not x.ADOp_Exec(0, sql, 1, True, PostgreSQLODBC, "usmidlnx01", False, login.tbU, login.tbP, "Port=5030;Database=ubm") Then
MsgBox (x.ADOo_errstring)
@ -254,7 +254,7 @@ End Sub
Sub build_upload()
Sub build_csv()
Dim x As New TheBigOne
Dim pl() As String

View File

@ -2460,7 +2460,7 @@ Function MISCe_col_to_letter(ByRef x As Long) As String
End Function
Public Function SQLp_build_sql_values(ByRef tbl() As String, trim As Boolean, headers As Boolean, syntax As SQLsyntax, ByRef quote_headers As Boolean, ParamArray typeflag()) As String
Public Function SQLp_build_sql_values(ByRef tbl() As String, trim As Boolean, headers As Boolean, syntax As SQLsyntax, ByRef quote_headers As Boolean, empty_as_null As Boolean, ParamArray typeflag()) As String
Dim i As Long
@ -2553,7 +2553,7 @@ Public Function SQLp_build_sql_values(ByRef tbl() As String, trim As Boolean, he
End If
Case "S" '-------S = string------------------------------------------
rx.Pattern = strip_text
If LTrim(RTrim(tbl(j, i))) = "" Then
If LTrim(RTrim(tbl(j, i))) = "" And empty_as_null Then
rec = rec & "CAST(NULL AS " & nullText & ")"
Else
If trim Then
@ -2565,7 +2565,7 @@ Public Function SQLp_build_sql_values(ByRef tbl() As String, trim As Boolean, he
End If
Case "A" '-------A = string but dont apply any regex------------------
rx.Pattern = strip_text
If LTrim(RTrim(tbl(j, i))) = "" Then
If LTrim(RTrim(tbl(j, i))) = "" And empty_as_null Then
rec = rec & "CAST(NULL AS " & nullText & ")"
Else
If trim Then
@ -2584,7 +2584,7 @@ Public Function SQLp_build_sql_values(ByRef tbl() As String, trim As Boolean, he
End If
Case Else '-------Assume text------------------------------------------
rx.Pattern = strip_text
If LTrim(RTrim(tbl(j, i))) = "" Then
If LTrim(RTrim(tbl(j, i))) = "" And empty_as_null Then
rec = rec & "CAST(NULL AS " & nullText & ")"
Else
If trim Then