Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS SQL Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /SQL/CubeSQL Version iOS
This example is the version from Mon, 21th Feb 2021.
Project "CubeSQL Version iOS.xojo_binary_project"
Class App Inherits MobileApplication
End Class
Class Screen1 Inherits MobileScreen
EventHandler Sub Opening()
// use internal CubeSQL library
Call InternalCubeSQLLibraryMBS.Use
Dim con As New SQLConnectionMBS
Try
// connect to database
// or use external DLL?
// con.Option("CUBESQL.LIBS") = "/Users/cs/Desktop/libcubesql.dylib"
con.Option("APPNAME") = "Xojo Test"
con.Option("ConnectionTimeout") = "5" // 5 seconds timeout?
'con.Option("ConnectionEncryption") = "AES128" // or "AES192" or "AES256"
con.Connect("localhost@mydatabase.sqlite","admin","admin",SQLConnectionMBS.kCubeSQLClient)
// create table
Dim cmd As New SQLCommandMBS
cmd.Connection = con
cmd.setCommandText("select sqlite_version()",cmd.kCommandTypeSQLStatement)
cmd.Execute
If cmd.FetchNext then
MessageBox "Version: "+cmd.Field(1).asStringValue
End If
// Disconnect is optional
// autodisconnect will ocur in destructor if needed
con.Disconnect
Catch r As RuntimeException
MessageBox r.message
// SAConnection::Rollback()
// can also throw an exception
// (if a network error for example),
// we will be ready
Try
// on error rollback changes
con.Rollback
Catch rr As runtimeexception
MessageBox rr.message
End Try
End Try
End EventHandler
End Class
Class LaunchScreen Inherits iosView
End Class
End Project
See also:
The items on this page are in the following plugins: MBS SQL Plugin.