Results 1 to 8 of 8

Thread: Sqlite?

Share/Bookmark
  1. #1

    Sqlite?

    Dear All,

    I have just discovered ThinBasic, very impressive!

    I tried finding out if it supports SQLITE but could only find a couple of old (pre 2012) posts. Has there been any further development on this?

    All the best, Björn

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    50
    Posts
    8,114
    Blog Entries
    2
    Rep Power
    10
    Ciao Björn

    no, there is nothing native in thinBasic working on Sqlite.
    It is on my personal list but so far no time to develop a module for it.

    In few days there will be a new thinBasic version that will have a quite complete module working on ADODB (connections and recordset for all of the most important DB engines) but of course it is something different.

    Will see if I will be able to add something for Sqlite in successive versions.
    If you have any priority on which functionalities of Sqlite you would like to have first, le me know.

    Ciao
    Eros

    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  3. #3

    SQLite

    Dear Eros,

    thank you for a rapid answer!

    Just very basic ones: create database, create table, query, create, update and delete record

    I'm not sure if it helps but I am working a little bit with RFO-Basic for Android (http://rfo-basic.com/manual/#_Toc477209093). There are two commands:
    Sql.exec <DB_pointer_nvar>, <command_sexp>
    Execute ANY non-query SQL command string ("CREATE TABLE", "DELETE", "INSERT", etc.) using a previously opened database.

    Sql.raw_query <cursor_nvar>, <DB_pointer_nvar>, <query_sexp>
    Execute ANY SQL Query command using a previously opened database and return a Cursor for the results.

    that seem to communicate directly with the sqlite databases (there are also a number of others that makes life simpler for us newbie programmers). (The code for RFO Basic is freely available)

    All the best, Björn

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    50
    Posts
    8,114
    Blog Entries
    2
    Rep Power
    10
    I think I will be able to have something in few weeks, maybe days.
    I've already some code to adapt to thinBasic

    Stay tuned.
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  5. #5
    Excellent news. Thank you.

    Björn

  6. #6
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    50
    Posts
    8,114
    Blog Entries
    2
    Rep Power
    10
    Quite ready to publish a new thinBasic version with a "basic" SQLite module inside

    Example:
    uses "Console"
    uses "SQLIte"
    
    
      '---Quick and dirty
      sqlite_Open   app_sourcepath & "SQLIte_Test.SQLITE", "C"
      sqlite_Exe    "Drop Table If Exists T1"
      sqlite_Exe    "Create Table If Not Exists T1 (F1, F2, F3, F4)"
      sqlite_Close
    
    
      
      dim lStart  as Double
      dim lEnd    as Double
      dim NumRecs as Long
      
      '---Save starting time
      lStart = Timer
      '---Open sample database
      sqlite_Open app_sourcepath & "chinook.sqlite"
    
    
      '---Count records
      sqlite_Select "Select count(1) as nRec from Customers"
      sqlite_GetRow
      printl "Number of records expected:", SQLite_FieldValue("nRec")
      printl
      
      
      '---Select record set
      sqlite_Select "Select * from Customers order by CustomerId"
    
    
      '---Process records
      NumRecs = 0
      Do While sqlite_GetRow
        Incr NumRecs
        '---Print something
        printl strformat$("Rec: {1}, {2}, {3}, {4}", NumRecs, SQLite_FieldValue("FirstName"), SQLite_FieldValue("LastName"), SQLite_FieldValue("Company"))'SQLite_FieldValue(1), SQLite_FieldValue(2), SQLite_FieldValue("Address")
      Loop
    
    
      sqlite_Close
    
    
      '---Save the time it took to run this test so we can display it later.
      lEnd = Timer - lStart
    
    
      '---Display results
      printl "Test 1:  Retrieve " & NumRecs & " rows." & "  Time: " & Format$(lEnd, "##.0000") & " seconds."
    
    
    WaitKey
    
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  7. #7
    Very nice Eros, thank you!!

    Björn

  8. #8
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    50
    Posts
    8,114
    Blog Entries
    2
    Rep Power
    10
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

Posting Permissions

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