Converting Xojo project to use MBS SQL Plugin
If you like to convert an example project from Xojo to use our plugin, you only need a few simple changes. For example in the SQLiteExample project, you need to only do a few steps:
- First, search for SQLiteDatabase and change the db property in app to use SQLDatabaseMBS as class name.
- Next change the new line to use SQLDatabaseMBS class for Action event in CreateDBButton class.
- Add line to enable SQLite internal database a bit higher there:
- Change from DatabaseFile to using path in DatabaseName:
App.DB.DatabaseName = "SQLite:"+dbFile.NativePath
The prefix SQLite: tells MBS Xojo SQL Plugin to use the right database client library, e.g. the internal one we activated before.
- Remove the call for CreateDatabase as database is created automatically with our plugin if needed. Instead call connect to connect to new empty database file:
Now you can run the project:
That was it. MBS Xojo SQL Plugin implements the database interface from Xojo and works with both older RecordSet and newer RowSet classes. A few examples are tricky to port as they used Edit/Update on the RecordSets, but we may have a solution for that soon.
Please don't hesitate to contact us if you have questions.