Results 1 to 5 of 5

Thread: Database module?

  1. #1

    Database module?

    Hi there,
    I recently installed ThinBasic in my computer so I'm testing several functionalities and I have to say that I'm really astonished with the capabilities of ThinBasic :-)
    However I miss more clarity on Database management on this great product.
    Looking at the on-line help I see that are some pending non documented modules, among them one related to Database functionsNon_documented_thinBasic_modules.JPG
    Are those functions already available in current production ThinBasic version (not the beta one)
    If so, how can I use them? (which is the module I should include in my projects)
    When do you expect to have them documented? I need more help on that :-)
    thanks a lot

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Hi jjcmmgb and wellcome to thinBasic community forum.

    Database functionalities made in that way has been discontinued in favor of direct ODBC connections. Please check \thinBasic\SampleScripts\ODBC\ for few examples.

    Native ODBC connection is possible thanks to a wrapper José Roca has developed. Is quite vast at first but once you get used it you will find that is not that complex.

    Finally: honestly I would like to have more weapons in thinBasic arsenal working with database like native MySql and native SqLite or full ADO wrapper. But this will come in future if there will be real interest.

    Ciao
    Eros

    PS: please use thinBasic Beta 1.8.7.0. It is much better and even if in beta it is quite stable.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #3
    I thought thinBasic was a conglomeration of modules tightly coupled to the core thinBasic runtime. If this is the case, I would hope someone would help the project out with a MySQL extension module.

    Here is the ScriptBasic MySQL extension module C interface source. Maybe it could be the basis for a thinBasic version. Here is the documentation for the for the MySQL extension module.

    I have scripted a SQLite3 proof of concept but an extension module using the same SB syntax as the MySQL module still needs to be done.

    ' SQLite3 Demo Script
    
    DECLARE SUB DLL ALIAS "_gtk" LIB "gtk-server"
    DECLARE SUB VARPTR ALIAS "varptr" LIB "gtk-server"
    
    DLL("gtk_server_require libsqlite3.so")
    
    DLL("gtk_server_define sqlite3_open NONE INT 2 STRING LONG")
    DLL("gtk_server_define sqlite3_exec NONE INT 5 LONG STRING INT NULL PTR_STRING")
    DLL("gtk_server_define sqlite3_prepare_v2 NONE INT 5 LONG STRING INT PTR_LONG NULL")
    DLL("gtk_server_define sqlite3_step NONE INT 1 LONG")
    DLL("gtk_server_define sqlite3_column_text NONE STRING 2 LONG INT")
    DLL("gtk_server_define sqlite3_close NONE INT 1 LONG")
    
    CONST SQLITE_ROW = 100
    db = 0
    dberr = 0
    stmt = 0
    
    DLL("sqlite3_open \"testsql\" " & VARPTR(db))
    DLL("sqlite3_exec " & db & " \"CREATE TABLE demo(someval INTEGER,  sometxt TEXT);\" 0 0 " & VARPTR(dberr))
    DLL("sqlite3_exec " & db & " \"INSERT INTO demo VALUES (123, 'Hello');\" 0 0 " & VARPTR(dberr))
    DLL("sqlite3_exec " & db & " \"INSERT INTO demo VALUES (234, 'cruel');\" 0 0 " & VARPTR(dberr))
    DLL("sqlite3_exec " & db & " \"INSERT INTO demo VALUES (345, 'world');\" 0 0 " & VARPTR(dberr))
    result = DLL("sqlite3_prepare_v2 " & db & " \"SELECT * FROM demo;\" -1 " & VARPTR(stmt) & " 0")
    SPLIT result BY " " TO ok, stmt
    
    WHILE DLL("sqlite3_step " & stmt) = SQLITE_ROW
      PRINT DLL("sqlite3_column_text " & stmt & " " & 0) & " - " & DLL("sqlite3_column_text " & stmt & " " & 1),"\n"
    WEND
    
    DLL("sqlite3_close " & db)
    
    jrs@Laptop:~/SB/test$ scriba sqlite3.sb
    123 - Hello
    234 - cruel
    345 - world
    jrs@Laptop:~/SB/test$
    Last edited by John Spikowski; 17-05-2011 at 05:57.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    We (I and some colleagues of mine like Simone) use thinBasic at company to perform many transformation operations on data. We mainly use MSSQL 2008 to perform in/out data in many different situations all using ODBC.

    Some examples we use thinBasic for:
    • export invoicing data and send them to customers (we have 5000 customers and we produce about 6000 invoices for something like 250000 document lines per month)
    • import orders from 3rd party sales automation software (more than 15000 lines per day)
    • nigh update some customers and articles data


    So, whatever database that can be managed by an ODBC can be handled with thinBasic.

    That said, I feel thinBasic miss some kind of personal or single project DB handling like SQLite. It should be not so difficult to add a module to handle it. When I will finish this beta testing run (see support area) I will think about that. In the meantime if you need something, just ask or add a request in support area (I work that way) so everyone can follow.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  5. #5
    Junior Member
    Join Date
    Jan 2009
    Location
    UK
    Posts
    15
    Rep Power
    17
    [QUOTE=ErosOlmi;83343]
    Finally: honestly I would like to have more weapons in thinBasic arsenal working with database like native MySql and native SqLite or full ADO wrapper. But this will come in future if there will be real interest.


    Hi Eros,
    I would very much like to have a thinBasic module working natively with mySQL.
    But unfortunately I don't have the skills to write it myself.
    I use thinBasic with ODBC and mySQL to download and build a database of UK horse-racing results, on a daily basis.
    I intend to build a thinBasic front end to mySQL to query the database, looking for useful patterns for betting.

    I would like to add my congratulations on the excellent work you have done in writing such a speedy and reliable thinBasic Language. It's a real pleasure to use.

    JohnP

Similar Threads

  1. Interpreter inside a database
    By Chris Holbrook in forum Shout Box Area
    Replies: 15
    Last Post: 09-02-2010, 00:15
  2. Database of programs (minimalistic)
    By Charles Pegge in forum Programs
    Replies: 0
    Last Post: 07-02-2010, 14:30
  3. Alternative for ODBC Database
    By martin in forum thinBasic General
    Replies: 34
    Last Post: 29-08-2009, 08:17

Members who have read this thread: 0

There are no members to list at the moment.

Tags for this Thread

Posting Permissions

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