current state of Core List
This commit is contained in:
parent
3a83430fc2
commit
7d0b38e46a
@ -28,7 +28,7 @@ End Enum
|
||||
|
||||
Public Enum SQLsyntax
|
||||
Db2 = 0
|
||||
MSSQL = 1
|
||||
SqlServer = 1
|
||||
PostgreSQL = 2
|
||||
End Enum
|
||||
|
||||
@ -1876,64 +1876,6 @@ errh:
|
||||
|
||||
End Function
|
||||
|
||||
Function FILEp_GetCSV(filepath As String) As String()
|
||||
|
||||
Dim fileNo As Integer
|
||||
Dim fileContent As String
|
||||
Dim fileLines() As String
|
||||
Dim dataArray() As String
|
||||
Dim splitArray() As String
|
||||
Dim rowCount As Long, colCount As Long
|
||||
Dim i As Long, j As Long
|
||||
Dim final() As String
|
||||
|
||||
' Get an available file number
|
||||
fileNo = FreeFile
|
||||
|
||||
' Open the file with the available file number
|
||||
Open filepath For Input As fileNo
|
||||
|
||||
' Read the entire file content into a single string
|
||||
fileContent = Input(LOF(fileNo), fileNo)
|
||||
|
||||
' Close the file
|
||||
Close fileNo
|
||||
|
||||
' Split the file content into lines
|
||||
fileLines = Split(fileContent, vbCrLf)
|
||||
|
||||
' Get the number of rows (lines)
|
||||
rowCount = UBound(fileLines) - LBound(fileLines)
|
||||
|
||||
' Check if there are any lines in the file
|
||||
If rowCount > 0 Then
|
||||
' Split the first line into columns (using comma as a delimiter)
|
||||
dataArray = Split(fileLines(0), ",")
|
||||
|
||||
' Get the number of columns
|
||||
colCount = UBound(dataArray) - LBound(dataArray)
|
||||
|
||||
' Redimension the dataArray to the appropriate size
|
||||
ReDim dataArray(0 To rowCount, 0 To colCount)
|
||||
|
||||
' Loop through the lines and columns to populate the dataArray
|
||||
For i = 0 To rowCount
|
||||
' Split the current line into columns
|
||||
splitArray = Split(fileLines(i), ",")
|
||||
|
||||
' Loop through the columns
|
||||
For j = 0 To colCount
|
||||
' Assign the values to the dataArray
|
||||
dataArray(i, j) = splitArray(j)
|
||||
Next j
|
||||
Next i
|
||||
FILEp_GetCSV = dataArray
|
||||
Else
|
||||
MsgBox "The file is empty or not available."
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
Public Function ADOp_Exec(ByRef con As Integer, ByVal sql As String, Optional ApproxSixe As Long, Optional InclHeaders As Boolean, Optional ByVal value As ADOinterface, Optional ConnectTo As String, Optional IntgrtdSec As Boolean, Optional UserName As String, Optional Password As String, Optional textconfigs As String) As Boolean
|
||||
|
||||
On Error GoTo errflag
|
||||
@ -2251,7 +2193,7 @@ Function json_concat(list As Range) As String
|
||||
|
||||
End Function
|
||||
|
||||
Public Function ADOp_BuildInsertSQL(ByRef tbl() As String, Target As String, trim As Boolean, start As Long, ending As Long, ParamArray ftype()) As String
|
||||
Public Function ADOp_BuildInsertSQL(ByRef tbl() As String, target As String, trim As Boolean, start As Long, ending As Long, ParamArray ftype()) As String
|
||||
|
||||
|
||||
Dim i As Long
|
||||
@ -2260,7 +2202,7 @@ Public Function ADOp_BuildInsertSQL(ByRef tbl() As String, Target As String, tri
|
||||
Dim sql As String
|
||||
Dim rec As String
|
||||
|
||||
sql = "INSERT INTO " & Target & " VALUES " & vbCrLf
|
||||
sql = "INSERT INTO " & target & " VALUES " & vbCrLf
|
||||
For i = start To ending
|
||||
rec = ""
|
||||
If i <> start Then sql = sql & "," & vbCrLf
|
||||
@ -2718,7 +2660,7 @@ Public Function SQLp_build_sql_values(ByRef tbl() As String, trim As Boolean, he
|
||||
Select Case syntax
|
||||
Case SQLsyntax.Db2
|
||||
sql = "SELECT * FROM TABLE( VALUES" & vbCrLf & sql & vbCrLf & ") x"
|
||||
Case SQLsyntax.MSSQL
|
||||
Case SQLsyntax.SqlServer
|
||||
sql = "SELECT * FROM (VALUES" & vbCrLf & sql & vbCrLf & ") x"
|
||||
Case SQLsyntax.PostgreSQL
|
||||
sql = "SELECT * FROM (VALUES" & vbCrLf & sql & vbCrLf & ") x"
|
||||
@ -2882,7 +2824,7 @@ Public Function SQLp_build_sql_values_ranged(ByRef tbl() As String, trim As Bool
|
||||
Select Case syntax
|
||||
Case SQLsyntax.Db2
|
||||
sql = "SELECT * FROM TABLE( VALUES" & vbCrLf & sql & vbCrLf & ") x"
|
||||
Case SQLsyntax.MSSQL
|
||||
Case SQLsyntax.SqlServer
|
||||
sql = "SELECT * FROM (VALUES" & vbCrLf & sql & vbCrLf & ") x"
|
||||
Case SQLsyntax.PostgreSQL
|
||||
sql = "SELECT * FROM (VALUES" & vbCrLf & sql & vbCrLf & ") x"
|
||||
|
Loading…
Reference in New Issue
Block a user