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$
Bookmarks