Example: /SQL/SQLDatabaseMBS CubeSQL prepared statement iOS

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/SQL/SQLDatabaseMBS CubeSQL prepared statement iOS


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/SQLDatabaseMBS CubeSQL prepared statement iOS

This example is the version from Mon, 21th Feb 2021.

Project "SQLDatabaseMBS CubeSQL prepared statement iOS.xojo_binary_project"
Class App Inherits MobileApplication
End Class
Class Screen1 Inherits MobileScreen
Control List Inherits iOSMobileTable
ControlInstance List Inherits iOSMobileTable
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
End Control
EventHandler Sub Opening() // use internal CubeSQL library Call InternalCubeSQLLibraryMBS.Use Dim db As New SQLDatabaseMBS db.Option("APPNAME") = "Xojo Test" db.Option("ConnectionTimeout") = "5" // 5 seconds timeout? 'db.Option("ConnectionEncryption") = "AES128" // or "AES192" or "AES256" // connect to database // in this example it is CubeSQL, // but can also be Sybase, Oracle, Informix, DB2, SQLServer, InterBase, MySQL, SQLBase and ODBC db.DatabaseName = "cubesql:localhost@mydatabase.sqlite" db.UserName = "admin" db.Password = "admin" db.RaiseExceptions = True // prefer exceptions over checking error If db.Connect Then // CREATE TABLE "test" ("test" TEXT, first TEXT, last TEXT) // insert some data Dim p1 As SQLPreparedStatementMBS = db.Prepare("INSERT INTO test (test, first, last) VALUES (:test, :first, :last)") p1.Bind("test", "Test") p1.BindType("test", p1.kTypeString) p1.Bind("first", "") p1.BindType("first", p1.kTypeString) p1.Bind("last", "Last") p1.BindType("last", p1.kTypeString) p1.SQLExecute // edit some data Dim p2 As SQLPreparedStatementMBS = db.Prepare("UPDATE test SET first=:first WHERE RowID = 1") 'p2.Bind("first", "") p2.Bind("first", "Christian") 'p2.BindType("first", p.kTypeString) p2.SQLExecuteMT db.CommitTransaction // Show data Dim r As RowSet = db.SelectSQL("SELECT ROWID,test,first,last FROM test") While Not r.AfterLastRow List.AddRow r.ColumnAt(0).StringValue+" "+r.ColumnAt(1).StringValue+" "+r.ColumnAt(2).StringValue+" "+r.ColumnAt(3).StringValue r.MoveToNextRow Wend // show version 'dim r as RecordSet = db.SQLSelect("select sqlite_version()") ' 'if r = nil or r.eof then 'MessageBox "Failed to query version." 'else 'MessageBox "Version: "+r.IdxField(1).StringValue 'end if End If Exception d As DatabaseException MessageBox d.reason 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.


💬 Ask a question or report a problem