diff options
author | Daniel Hahler <git@thequod.de> | 2018-10-23 14:07:18 +0200 |
---|---|---|
committer | Daniel Hahler <git@thequod.de> | 2019-03-31 17:19:06 +0200 |
commit | 54bae0298d40502ebf43055ac9a6f28338633683 (patch) | |
tree | 1b0aa5561c9a5fdfbeb909ef637b626fb8dc62c8 /coverage/sqldata.py | |
parent | 820b255f34a0aac8670b0c819153bb8b38c4b2c6 (diff) | |
download | python-coveragepy-git-54bae0298d40502ebf43055ac9a6f28338633683.tar.gz |
CoverageSqliteData._file_id: fall back to SELECT
Fixes https://github.com/nedbat/coveragepy/issues/702
Diffstat (limited to 'coverage/sqldata.py')
-rw-r--r-- | coverage/sqldata.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/coverage/sqldata.py b/coverage/sqldata.py index 8bfb04be..d93bc062 100644 --- a/coverage/sqldata.py +++ b/coverage/sqldata.py @@ -181,13 +181,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) |