mercredi 20 juillet 2016

How can I store a dictionary in an Azure SQL Database? (Swift)

I want to store a dictionary in a column in an Azure SQL Database. I've tried to store a dictionary by doing :

let item = ["text":["foo":"bar"]]
    let itemTable = client.tableWithName("TodoItem")
    itemTable.insert(item) {
        (insertedItem, error) in
        if (error != nil) {
            print("Error" + error!.description);
        } else {
            print("Item: " String(insertedItem!))
        }
    }

But when I query the database I get

Item: [Object object]

How can I store and query dictionaries in the database without the items changing?

Aucun commentaire:

Enregistrer un commentaire