From 2394fa4ed466cfc1a4953c360737eb88c0b09161 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Sun, 24 Apr 2016 14:14:35 -0300 Subject: [PATCH] When checking if a person already exist use a diferrent query when email is NULL --- pycvsanaly2/DBContentHandler.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pycvsanaly2/DBContentHandler.py b/pycvsanaly2/DBContentHandler.py index 15bf0a2..e8f8bf5 100644 --- a/pycvsanaly2/DBContentHandler.py +++ b/pycvsanaly2/DBContentHandler.py @@ -201,8 +201,14 @@ def ensure_person(person): name = to_utf8(person.name) email = person.email - cursor.execute(statement("SELECT id from people where name = ? and email = ?", + + if not email: + cursor.execute(statement("SELECT id from people where name = ? and email IS NULL", + self.db.place_holder), (name,)) + else: + cursor.execute(statement("SELECT id from people where name = ? and email = ?", self.db.place_holder), (name, email)) + rs = cursor.fetchone() if not rs: p = DBPerson(None, person)