Hi Claude, sorry and thanks for you patience!!
I FIXED the issue!
- Could you show how you get data ?
The data is typed in the user interface configuration form. I made a kind of helper to use the SQLite, so it can read and update tables and there was one of the issues.
With this helper I can handle the database and table as easy as:
var db: OpaquePointer?
var sqlQuery: sqliteQuery
var sqlText: OpaquePointer? = nil
let fileURL = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
.appendingPathComponent("/mydatabase.sqlite")
let sqlText = "INSERT INTO TABLE (user, password, status, date) VALUES (:user, :password, :status, :date);"
if sqliteOpenDatabase(DatabaseURL: fileURL, Database: &db) == SQLITE_OK {
sqlQuery = sqliteQuery(Database: &db, Statement: &sqlText, Query: queryString)
sqlQuery.ParamByName(Param: "user", ValueType: .string, Value: "Username" )
sqlQuery.ParamByName(Param: "password", ValueType: .string, Value: "123456" )
sqlQuery.ParamByName(Param: "status", ValueType: .string, Value: "valid" )
sqlQuery.ParamByName(Param: "date", ValueType: .date , Value: Date() )
sqlQuery.ExecSQL()
print(sqlQuery.ParamByName(Param: "user"))
}
- Where do data come from ?
The data comes from a SQLite table
- What is exactly in value ? Is it an optional ?
Think about saving a email field into a table. You should open the table and read something like "myname@site. com" (this forum dont allow type emails, so theres no space here, its an example) but once you read it (any program including and besides yourself) you would get as email a weird string as I was tolding: "Optional("myname@site. com")" and that messed up with everything.
To fix that I had to dig into the code and change all old Optional string convertions, even things like String(cString: value) are depreciated . Things such:
return anyData == nil ? "" : anyData as! String
I had to change to return String(describing: anyData)
Also I had to perform a lot of changes in the ancient code. Again thanks for the support and patience!