Alright, I thought SQL gracefully ignored adding a duplicate key but guess not. 
I've added this function:
    
    
    proc exists(database: Database, id: string): bool =
      result = if len(database.db.getValue(sql"SELECT id FROM Pages WHERE id = 
?;", id)) > 0: true else: false
    
    
    Run

eg.
    
    
    if not db.exists("bub_aaa"): db.insert("bub_aaa", "1,2,3,0,6")
    
    
    Run

Reply via email to