« Three weeks till year… | Home | MBS Xojo Conference S… »

LiteSync and Xojo

The company GENSIS SISTEMAS LTDA provides a variation of the SQLite library with a sync possibility. Developers can use their SQLite library litesync replacement to add a sync to their application. As a client asked whether it works in Xojo with MBS Xojo SQL Plugin and yes, it works.

For MacOS, you need the library files libbinn.1.dylib, libuv.1.dylib and liblitesync.0.dylib. Than you change the library and dependencies via Terminal like this:

install_name_tool -change libbinn.1.dylib @rpath/libbinn.1.dylib liblitesync.0.dylib
install_name_tool -change /usr/local/lib/libuv.1.dylib @rpath/libuv.1.dylib liblitesync.0.dylib
install_name_tool -id @rpath/liblitesync.0.dylib liblitesync.0.dylib
install_name_tool -id @rpath/libuv.1.dylib libuv.1.dylib
install_name_tool -id @rpath/libbinn.1.dylib libbinn.1.dylib

Next you can load them just like other SQLite library with our plugin classes SQLDatabaseMBS or SQLConnectionMBS.

Our example code looks like this:
dim db as new SQLDatabaseMBS // preload the libraries dim s2 as new SoftDeclareMBS if not s2.LoadDylib(GetFolderItem("libuv.1.dylib").NativePath) then break MsgBox s2.Liberror end if dim s1 as new SoftDeclareMBS if not s1.LoadDylib(GetFolderItem("libbinn.1.dylib").NativePath) then break MsgBox s1.Liberror end if dim s3 as new SoftDeclareMBS if not s3.LoadDylib(GetFolderItem("liblitesync.0.dylib").NativePath) then break MsgBox s3.Liberror end if // where is the library? db.Option(SQLConnectionMBS.kOptionLibrarySQLite) = GetFolderItem("liblitesync.0.dylib").NativePath // connect to database // in this example it is SQLite, // but can also be Sybase, Oracle, Informix, DB2, SQLServer, InterBase, MySQL, SQLBase and ODBC dim path as string = "/tmp/test.db" // put the database in the temporary folder db.DatabaseName = "sqlite:"+path if db.Connect then dim r as RecordSet = db.SQLSelect("select sqlite_version()") if r = nil or r.eof then MsgBox "Failed to query version." else MsgBox "Version: "+r.IdxField(1).StringValue end if else MsgBox db.ErrorMessage end if
The biggest plugin in space...
13 12 18 - 11:44