如何使用Swift将数据保存到sqlite3数据库?

时间:2018-09-18 13:18:24

标签: swift sqlite

我想将一组特定的数据保存到本地sqlite3数据库中。以下是我的代码,一切工作正常,但表中未填充值。请指导我该怎么做

func insertValues(){
        database?.open()
        let value = database?.executeUpdate("INSERT INTO cached_image (image_name,download_url) VALUES (?,?)", withArgumentsIn: ["back_stretch","back_stretch"])

        let value1 = database?.executeUpdate("INSERT INTO cached_image (image_name,download_url) VALUES (?,?)", withArgumentsIn: ["back_stretch1","back_stretch1"])

        print(value1)//The output is optional("true")
        print(value)//The output is optional("true")

        database?.close()

    }

0 个答案:

没有答案