dcsimg
Results 1 to 10 of 10

Thread: sqlite3win32

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,535

    sqlite3win32

    This modified sqlite3 c library supports the _stdcall convention which VB needs to call this dll. (like any other win32 API call)

    The initial concept and core of this was developed by 'wqweto'. (vbsqlite)

    The source code of the project can also be viewed on GitHub. (incl. c source in the Lib subfolder)

    Out of this library an Ax-DLL COM-Wrapper was created.
    Attached Files Attached Files
    Last edited by Krool; Apr 4th, 2020 at 01:14 PM.

  2. #2
    Hyperactive Member
    Join Date
    Jan 2020
    Posts
    418

    Re: sqlite3win32

    dos it support sqlite3_get_table?, for best,if you can add sqlite3_get_table16,sqlite3_exec16,it's wonderful,thank you

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,535

    Re: sqlite3win32

    Quote Originally Posted by xiaoyao View Post
    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.

  4. #4
    Hyperactive Member
    Join Date
    Jan 2020
    Posts
    418

    Re: sqlite3win32

    Quote Originally Posted by Krool View Post
    Yes it supports all.
    no,maybe ca't support these api,no unicode api for exec,gettable。

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,535

    Re: sqlite3win32

    Quote Originally Posted by xiaoyao View Post
    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.

  6. #6
    PowerPoster
    Join Date
    Jun 2013
    Posts
    4,893

    Re: sqlite3win32

    deleted..., wrong thread, sorry...

  7. #7
    Hyperactive Member
    Join Date
    Jan 2020
    Posts
    418

    Re: sqlite3win32

    Quote Originally Posted by Krool View Post
    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.

  8. #8
    Hyperactive Member
    Join Date
    Jan 2020
    Posts
    418

    Re: sqlite3win32

    converters in vb6,This is cumbersome and slowly.
    if converters by vc++ in sqlite.dll ,This is of course the fastest method, and the most convenient and perfect.
    an itA few days ago I took over a project and found that every time I insert data or read data to add fields, all operations need to be converted.
    Writing code is cumbersome and error-prone.
    Just like when we are traveling, in order to save tires, we deliberately call an excavator to put the car on, and then drive to the beach to travel.
    we need enough unicode api,
    At least three functions are needed.Execute the sql sentence to get all the data in the table and get one row of data.
    It would be perfect if you could import or export csv format data.

  9. #9
    Hyperactive Member
    Join Date
    Jan 2020
    Posts
    418

    Re: sqlite3win32

    vc++,I do n’t use these. I need a little technology. If you understand, you can easily modify it.

    I test call sub or put value ,com activex dll is slowly (It takes more then 10 ~ 30 times(200%-400%).)
    If you need to obtain a whole row of data, or all the data of the entire table, if this table has 10,000 rows and 30 columns, you need to call the API at least 1 million times, which is not only cumbersome but also very slow.
    chinese: 我不会用vc++编程,需要一点技术,如果懂的人可以很轻松的给他修改,希望能够有高手花点时间,造福大家,非常感谢。
    如果需要获取一整行的数据,或者获取整个表格的所有数据,假如这个表格有一万行,30列,那需要调用API至少100万次,这样不仅很麻烦,而且速度很慢。
    for i=1 to 1000000000
    a=i or class1.a =i,activex.dll(class1.a or call method)
    next
    BasFile_Public_A=I used: 16.727 MS
    ClassA.A =125.8725 MS
    ActiveXDll.Class2.A =125.5622 MS
    ClassA.MethedSetB( sub) =352.0073 MS

    【download】my test page url:http://www.vbforums.com/showthread.p...dll(class1-a-)

    maybe call standard dll,or com object dll also slowly,so If we need to obtain the data of the entire table, it is best to convert it once in the sqlite source code (utf8 to unicode,) and use it directly in vb6.
    chinese: 如果我们需要获取整个表格的数据,最好在sqlite源码里一次性给它转换完成(utf8 to unicode,),vb6直接使用。

  10. #10

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2012
    Posts
    1,535

    Re: sqlite3win32

    The sqlite3 c source was upgraded from version 3.24.0 (2018-06-04) to 3.31.1 (2020-01-27).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width