More congrats to Jim for SQLite Extender

Started by stanl, November 08, 2020, 10:46:38 AM

Previous topic - Next topic

stanl

Jim;


I have explored using your Extender to parse Json and it is impressive. For fun, and frustration, I tried to see if the Json Extension could operate w/out Extender but with SQLite in .NET.   I have made doubly sure [in 32-bit] that System.Data.SQLite and SQLite.Interop.dll are in the correct build. Just cannot load the Extension >:( >:(
Code (WINBATCH) Select


;FAILURE: cannot access SQLite Json Extension
IntControl(73,1,0,0,0)
Gosub udfs
strFile=dirscript():"zips.db"
ext = dirscript():"SQLite.Interop.dll"
If ! FileExist(ext) Then Terminate(@TRUE,"DLL Not Found",ext)


ObjectClrOption("appbase", Dirscript())
ObjectClrOption("use", "System.Data.SQLite")
bTrue = ObjectType( "BOOL", -1 )


;all 3 fail trying to load extension
;oSQLite = objectClrNew("System.Data.SQLite.SQLiteConnection", "Data Source=%strFile%;Pooling=true")
;oSQLite = objectClrNew("System.Data.SQLite.SQLiteConnection", "Data Source=%strFile%")
oSQLite = objectClrNew("System.Data.SQLite.SQLiteConnection", "Data Source=:memory:")
oSQLite.Open()


oSQLite.EnableExtensions(bTrue)
oSQLite.LoadExtension(ext,"sqlite3_json_init")


oSQLite = 0


Exit
;======================================================================================================
:WBERRORHANDLER
Terminate(@TRUE,"Error Encountered",err())
;======================================================================================================


:udfs
#DefineSubRoutine err()
wberroradditionalinfo = wberrorarray[6]
lasterr = wberrorarray[0]
handlerline = wberrorarray[1]
textstring = wberrorarray[5]
linenumber = wberrorarray[8]
errmsg = "Error: ":lasterr:@LF:textstring:@LF:"Line (":linenumber:")":@LF:wberroradditionalinfo
Return(errmsg)
#EndSubRoutine


Return



JTaylor

Apologies...was in a hurry and didn't read very closely.    What version are you using?   Read in one place that it must be version 1.0.99.0  or higher.   Can't vouch for that but wanted to pass it on.

Jim

JTaylor

Sorry.  I'm not having any luck either.

Jim

stanl

Best I could surmise... Json1 extension was incorporated into Sqlite3.exe/.dll which is more command line. Numerous googles about problems in .net trying to load extension; some suggest taking off connection pooling others just say 'it works for me' - the SQLite docs say LoadExtension() is overloaded, so maybe issues there.


Bottom line: this thread was not started to get SQLite .net to work with WB, but to congratulate your work on integrating it smoothly. ;D ;D ;D

JTaylor