When trying to perform the following instructions I get an error: SQLError: ‘Error #3115: SQL Error.’, details:’near ‘WHERE’: syntax error’, operation:’execute’, detailID:’2003′. Any thoughts? Thanks!
dbStatement.text = "INSERT INTO person (idPerson,image) VALUES (:idPerson,:image) " +
"WHERE NOT EXISTS (SELECT idPerson FROM person WHERE idPerson=:idPerson)";
dbStatement.parameters[":idPerson"] = person.idPerson;
dbStatement.parameters[":image"] = person.image;
dbStatement.execute();
You’re probably looking for
INSERT OR REPLACE person ( ... ) VALUES( ... ).