|
-
Jan 27th, 2020, 03:01 PM
#1
Re: sqlite3win32
dos it support sqlite3_get_table?, for best,if you can add sqlite3_get_table16,sqlite3_exec16,it's wonderful,thank you
-
Jan 27th, 2020, 03:57 PM
#2
Re: sqlite3win32
 Originally Posted by xiaoyao
dos it support sqlite3_get_table?, for best,if you can add sqlite3_get_table16,sqlite3_exec16,it's wonderful,thank you
Yes it supports all.
-
Jan 27th, 2020, 04:20 PM
#3
Re: sqlite3win32
 Originally Posted by Krool
Yes it supports all.
no,maybe ca't support these api,no unicode api for exec,gettable。
-
Jan 27th, 2020, 11:58 PM
#4
Re: sqlite3win32
 Originally Posted by xiaoyao
no,maybe ca't support these api,no unicode api for exec,gettable。
Can you stop to claim false statements?
These API use UTF8. All of sqlite3 is UTF8.
Those API functions with a suffix 16 are just converters which takes a UTF16 string and pass internally to UTF8 function.
-
Jan 30th, 2020, 01:20 AM
#5
Re: sqlite3win32
 Originally Posted by Krool
Can you stop to claim false statements?
These API use UTF8. All of sqlite3 is UTF8.
Those API functions with a suffix 16 are just converters which takes a UTF16 string and pass internally to UTF8 function.
Code:
oices" (from SQLite NWind.db):
Code:
Option Explicit
Private Declare Function sqlite3_get_table Lib "vb_cairo_sqlite" (ByVal hDB As Long, ByVal SQL As String, lpTable As Long, iRow As Long, iCol As Long, lpErrMsg As Long) As Long
Private Declare Sub sqlite3_free_table Lib "vb_cairo_sqlite" (ByVal lpTable As Long)
Private Declare Function MultiByteToWideChar Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, lpMultiByteStr As Any, ByVal cchMultiByte As Long, lpWideCharStr As Any, ByVal cchWideChar As Long) As Long
Private Cnn1 As New VBSQLite10.SQLiteConnection, Cnn2 As vbRichClient5.cConnection
Private Sub Form_Load()
AutoRedraw = True
Dim Ds As SQLiteDataSet, Rs As cRecordset, T1$
Cnn1.OpenDB "c:\temp\nwind.db"
Set Cnn2 = New_c.Connection("c:\temp\nwind.db")
New_c.Timing True
Dim SArr() As String
SArr = GetTable(Cnn2.DBHdl, "Select * From Invoices")
Debug.Print "sqlite3_get_table", New_c.Timing
New_c.Timing True
Set Ds = Cnn1.OpenDataSet("Select * From Invoices")
Debug.Print "VBSQLite10-Select", New_c.Timing
New_c.Timing True
Set Rs = Cnn2.OpenRecordset("Select * From Invoices")
Debug.Print "vbRichClient-Select", New_c.Timing
End Sub
Public Function GetTable(hDB As Long, SQL As String) As String()
Dim pTbl&, Rows&, Cols&, pErr&, i&, j&, PArr&(), SArr$()
sqlite3_get_table hDB, SQL, pTbl, Rows, Cols, pErr
If pErr = 0 Then
ReDim PArr(0 To Cols - 1, 0 To Rows)
ReDim SArr(0 To Cols - 1, 0 To Rows)
New_c.MemCopy VarPtr(PArr(0, 0)), pTbl, (Rows + 1) * Cols * 4
For j = 0 To UBound(PArr, 2): For i = 0 To UBound(PArr, 1)
SArr(i, j) = StringFromPtr(PArr(i, j))
Next i, j
End If
If pTbl Then sqlite3_free_table pTbl
GetTable = SArr
End Function
Function StringFromPtr(ByVal pUTF8 As Long) As String
Dim Chars As Long
If pUTF8 = 0 Then Exit Function
Chars = MultiByteToWideChar(65001, 0&, ByVal pUTF8, -1, ByVal 0&, 0)
StringFromPtr = Space$(Chars - 1) 'a VB-BString already contains a trailing Zero, so we allocate it one char less
MultiByteToWideChar 65001, 0&, ByVal pUTF8, -1, ByVal StrPtr(StringFromPtr), Chars - 1
End Function
The results which are printed to the VB6-Debug-Window are (on my machine):
Code:
sqlite3_get_table 74.48msec(it's full test get table data )
VBSQLite10-Select 28.87msec ( need read all data to arrary (rows,cols ))
vbRichClient-Select 9.65msec ( need read all data to arrary (rows,cols ))
who can do full test ? ( need read all data to arrary (rows,cols ))
Last edited by xiaoyao; Jan 30th, 2020 at 01:24 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|