aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Opdenacker <michael.opdenacker@bootlin.com>2024-04-12 11:02:32 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-04-14 06:30:26 +0100
commite4ae5177861c9a27e93e5a2d3a6c393baecd6416 (patch)
tree5e90d8ded5064814a2b6cdf8963e233bd826ca2e
parent4cc4069987edd14f51715dfaf0c6e1a3aa307106 (diff)
downloadbitbake-contrib-e4ae5177861c9a27e93e5a2d3a6c393baecd6416.tar.gz
prserv: remove unnecessary code
In db.py, the ifnull() statement guarantees that the SQL request will return a value. It's therefore unnecessary to test the case when no value is found. Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com> Cc: Joshua Watt <JPEWhacker@gmail.com> Cc: Tim Orling <ticotimo@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/prserv/db.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/prserv/db.py b/lib/prserv/db.py
index 7c200602e..eb4150819 100644
--- a/lib/prserv/db.py
+++ b/lib/prserv/db.py
@@ -172,11 +172,7 @@ class PRTable(object):
if self.read_only:
data = self._execute("SELECT ifnull(max(value)+1, 0) FROM %s where version=? AND pkgarch=?;" % (self.table),
(version, pkgarch))
- row = data.fetchone()
- if row is not None:
- return row[0]
- else:
- return 0
+ return data.fetchone()[0]
try:
self._execute("INSERT OR REPLACE INTO %s VALUES (?, ?, ?, (select ifnull(max(value)+1, 0) from %s where version=? AND pkgarch=?));"