summaryrefslogtreecommitdiff
path: root/coverage/sqldata.py
diff options
context:
space:
mode:
Diffstat (limited to 'coverage/sqldata.py')
-rw-r--r--coverage/sqldata.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/coverage/sqldata.py b/coverage/sqldata.py
index 065a1b4e..b44556a5 100644
--- a/coverage/sqldata.py
+++ b/coverage/sqldata.py
@@ -189,13 +189,13 @@ class CoverageSqliteData(SimpleReprMixin):
def _file_id(self, filename, add=False):
"""Get the file id for `filename`.
- If filename is not in the database yet, add if it `add` is True.
+ If filename is not in the database yet, add it if `add` is True.
If `add` is not True, return None.
"""
if filename not in self._file_map:
if add:
with self._connect() as con:
- cur = con.execute("insert into file (path) values (?)", (filename,))
+ cur = con.execute("insert or replace into file (path) values (?)", (filename,))
self._file_map[filename] = cur.lastrowid
return self._file_map.get(filename)