1

sqlite.swift code:

func get(name:String) -> Data? {
    var retData: Data = Data()
    guard let db: Connection = try? getReadableDatabase()! else {return nil}
    let query = TABLE_STORAGE.filter(COL_NAME == name).limit(1)
    guard let rData = try? db.prepare(query) else {return nil}
    for data in rData {
        retData.id = data[COL_ID]
        retData.name = data[COL_NAME]
        retData.value = data[COL_VALUE]
        retData.date = data[COL_DATE]
    }
    return retData
}

ionic home.ts code:

async ...
    let result:any = await storage.set({key:"session", value:"some_value Opened", date:"some_text"});

    result = await storage.get({key:"session"})

result returns an Object with key, value only.

I would like to return an Object with all columns id, key, value and date.

In the Xcode console the values are returned as I would expect it.

How do I have to adapt my code that the all columns in are returned in the 'result' Object ?

Ed Die
  • 219
  • 3
  • 18

0 Answers0