lundi 27 avril 2015

Cannot invoke 'insert' with an argument list of type

The code to insert records into a table was working fine before the latest update, but now is throwing up this error so I was wondering what I was doing wrong.

Example code for record insert:

   Recipes.insert(Title <- "Chocolate Cake", Description <- "Rich and moist", CookTime <- 20, PictureURL <- "http://ift.tt/1cl8eH5", VideoURL <- "http://ift.tt/1IdQSi0", Instructions <- "Prepare ingredients into bowl. Whisk for 20 mins, and pour into cake moulding tin. Place in oven at 200C for 15 minutes. Allow 10 mins to cool before icing with chocolate frosting.", Category <- "Desert", Ingredients <- "50g Flour, 200ml Milk, 2 large eggs, Choclate frosting", Favourited <- false)

Example for database setup:

import Foundation
import SQLite
let path = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).first as! String  
let db = Database("\(path)/databasetest.sqlite3")

let Recipes = db["Recipes"]
let RecipeID = Expression<Int>("RecipeID")
let Title = Expression<String>("Title")
let Description = Expression<String>("Description")
let CookTime = Expression<Int>("CookTime")
let PictureURL = Expression<String>("PictureURL")
let VideoURL = Expression<String>("VideoURL")
let Instructions = Expression<String>("Instructions")
let Category = Expression<String>("Category")
let Ingredients = Expression<String>("Ingredients")
let Favourited = Expression<Bool>("Favourited")

func TableSetup() {

db.create(table: Recipes, ifNotExists: true) { t in
    t.column(RecipeID, primaryKey: true)
    t.column(Title)
    t.column(Description)
    t.column(CookTime)
    t.column(PictureURL)
    t.column(VideoURL)
    t.column(Instructions)
    t.column(Category)
    t.column(Ingredients)
    t.column(Favourited, defaultValue: false)
}

I am using stephencelis' SQLite.swift project. http://ift.tt/1pVlNmM

Aucun commentaire:

Enregistrer un commentaire