WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: stanl on November 08, 2020, 10:46:38 AM

Title: More congrats to Jim for SQLite Extender
Post by: stanl on November 08, 2020, 10:46:38 AM
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


Title: Re: More congrats to Jim for SQLite Extender
Post by: JTaylor on November 11, 2020, 02:04:15 PM
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
Title: Re: More congrats to Jim for SQLite Extender
Post by: JTaylor on November 11, 2020, 02:28:55 PM
Sorry.  I'm not having any luck either.

Jim
Title: Re: More congrats to Jim for SQLite Extender
Post by: stanl on November 12, 2020, 06:55:11 AM
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
Title: Re: More congrats to Jim for SQLite Extender
Post by: JTaylor on November 12, 2020, 07:53:49 AM
Thanks.

Jim