I'm trying to do a check in my database, I want to make sure that there is only one entry (row) in my database and only use that row and must not add any additional entry (row).
if self.heroTable.count >= 1 {
let setHeroLevelandExpi = self.heroTable.insert(self.level <- 1, self.expi <- 25, self.maxExpi <- 30)
}
But it says that "Binary operator '>=' cannot be applied to operands of type 'ScalarQuery<Int>' and 'Int'". Am I missing anything?
heroTable? What SQLite library are you using? But why both checking the count? Perform an "INSERT OR REPLACE" query instead of a simple "INSERT". Of course that requires a unique key.let heroTable = Table("hero")is this information correct for your question?