Platforms to show: All Mac Windows Linux Cross-Platform
/SQL/SQLDatabaseMBS SQLite base64
Required plugins for this example: MBS SQL Plugin
Last modified Thu, 11th Jun 2025.
You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /SQL/SQLDatabaseMBS SQLite base64
Download this example: SQLDatabaseMBS SQLite base64.zip
Project "SQLDatabaseMBS SQLite base64.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
// use internal sqlite library with Base64 extension
InternalSQLiteLibraryMBS.Base64ExtensionEnabled = True
Call InternalSQLiteLibraryMBS.Use
Var db As New SQLDatabaseMBS
Var path As String = ":memory:" // in-memory database without a file
db.DatabaseName = "sqlite:"+path
db.Connect
// make an Base64
Var r As RowSet = db.SelectSQL("SELECT Base64(CAST('hello' AS BLOB))")
MessageBox "Base64: " + r.ColumnAt(0).StringValue
// shows aABlAGwAbABvAA==
r = nil
// create table with Base64 id field
db.SQLExecute "CREATE TABLE Test(id INTEGER PRIMARY KEY AUTOINCREMENT, Label TEXT, Data BLOB)"
// insert value using base64 to convert text to BLOB
db.ExecuteSQL "INSERT INTO Test(Label, Data) VALUES ('Bob', base64('aGVsbG8='))"
db.ExecuteSQL "INSERT INTO Test(Label, Data) VALUES ('John', base64(?))", "dGVzdA=="
// now query back the BLOB and also encode it as Base64 again
Var rec As RowSet = db.SelectSQL("SELECT Label, Data as DataBlob, base64(Data) as DataText FROM Test")
Var list As Listbox = SQLWindow.List
While Not rec.AfterLastRow
list.AddRow rec.Column("Label"), rec.Column("DataBlob"), rec.Column("DataText")
rec.MoveToNextRow
Wend
rec = Nil
// dump the database
Var lines() As String = InternalSQLiteLibraryMBS.DumpToStrings(db.SQLiteConnectionHandle, "main", "")
SQLWindow.TextArea1.Text = string.FromArray(lines, EndOfLine)
End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Sign
End Sign
Class SQLWindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control TextArea1 Inherits TextArea
ControlInstance TextArea1 Inherits TextArea
End Control
End Class
End Project
See also:
- /SQL/SQLDatabaseMBS CubeSQL prepared statement
- /SQL/SQLDatabaseMBS CubeSQL select version
- /SQL/SQLDatabaseMBS Microsoft SQL cross platform
- /SQL/SQLDatabaseMBS MSSQL Execute
- /SQL/SQLDatabaseMBS MySQL Fetch values
- /SQL/SQLDatabaseMBS ODBC Connect
- /SQL/SQLDatabaseMBS PostgreSQL Connect
- /SQL/SQLDatabaseMBS SQLite Blob test
- /SQL/SQLDatabaseMBS SQLite Connect console
- /SQL/SQLDatabaseMBS SQLite Create Encrypted
Download this example: SQLDatabaseMBS SQLite base64.zip
The items on this page are in the following plugins: MBS SQL Plugin.