I would like to use Valentina Server with my SQLite Database projects, but I’ve got some bugs (with this wonderful error : “Not an Error !”
.
Most important of them : No Encryption
Test Code (With Valentina ADK 17.5.3 - Xojo 2026r2.1 - Windows)
Var fTest As FolderItem
Var cDB As VSqliteDataBase
Var sTmpKey As String
Var bCreated As Boolean
Const kKey = "MaCleDeTest_2026!"
fTest = SpecialFolder.Desktop.Child("vdbtools_selftest.sqlite")
If fTest.Exists Then
fTest.Remove
End If
cDB = New VSqliteDataBase
cDB.DatabaseFile = fTest
cDB.EncryptionKey = kKey // <= Put Encryption Key
Call cDB.CreateDataBaseFileEx()
sTmpKey = cdb.EncryptionKey // <= Try to read : OK
cDB.Encrypt(sTmpKey) // Try all 3 possibilities (Without and With cDB.Encrypt(Ex) )
cDB.ExecuteSQL("CREATE TABLE T (ID INTEGER PRIMARY KEY, V TEXT);")
cDB.ExecuteSQL("INSERT INTO T (V) VALUES ('secret');")
cDB.Close()
// Open SQLite file with other reader (Valentina Studio Pro or SQLiteManager) <= Full Read No Secrets !
Some people use the VSQLiteDataBase object in their Xojo Projects ?
There are differences with Xojo SQLite encryption:
- SQLCipher library is used for encryption
- The EncryptionKey property is used only for opening, not for creation, so you can encrypt the database after creation. We’ll try to change this in future builds.
So a working sample is:
Var fTest As FolderItem
Var cDB As VSqliteDataBase
Var sTmpKey As String
Var bCreated As Boolean
Const kKey = "MaCleDeTest_2026!"
fTest = SpecialFolder.Desktop.Child("vdbtools_selftest.sqlite")
If fTest.Exists Then
fTest.Remove
End If
cDB = New VSqliteDataBase
cDB.DatabaseFile = fTest
Call cDB.CreateDataBaseFileEx()
cDB.Encrypt(kKey)
cDB.ExecuteSQL("CREATE TABLE T (ID INTEGER PRIMARY KEY, V TEXT);")
cDB.ExecuteSQL("INSERT INTO T (V) VALUES ('secret');")
// Or encrypt here cDB.Encrypt(kKey)
cDB.Close()
We have an example for encryption:
Examples/RBDB_way/VSqliteDataBase_Encrypted/VSqliteDataBase_Encrypted.xojo_binary_project
It can be used for server mode too just set gClient App constant to True.
Okay, I didn’t understand that logic (I was relying solely on the documentation and not the example).
I’ve updated my code accordingly.
I don’t understand why the encryption key isn’t considered when creating the database
.
Thank you for your response.
I’m looking forward to version 18 to use my own AI server on Valentina Studio Pro
.