Skip to content

Commit

Permalink
CoverageSqliteData._file_id: fall back to SELECT
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Mar 31, 2019
1 parent 820b255 commit 54bae02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions coverage/sqldata.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ def dump(self): # pragma: debugging
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)

Expand Down

0 comments on commit 54bae02

Please sign in to comment.