diff options
author | Michael Opdenacker <michael.opdenacker@bootlin.com> | 2024-04-12 11:02:32 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-04-12 18:04:00 +0100 |
commit | ce557e42d566cc66ac9d48e62bcafed98eb04d75 (patch) | |
tree | ea38f7c4a618c94fe9c904cec51838fea70ff25f | |
parent | 2bc1f0465a4b42354a0529e36f8369631cd60737 (diff) | |
download | poky-ce557e42d566cc66ac9d48e62bcafed98eb04d75.tar.gz |
bitbake: 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.
(Bitbake rev: b34fdd96569cd62af99ca163bb994a3329bdc919)
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-- | bitbake/lib/prserv/db.py | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/bitbake/lib/prserv/db.py b/bitbake/lib/prserv/db.py index 7c200602ed..eb41508198 100644 --- a/bitbake/lib/prserv/db.py +++ b/bitbake/lib/prserv/db.py | |||
@@ -172,11 +172,7 @@ class PRTable(object): | |||
172 | if self.read_only: | 172 | if self.read_only: |
173 | data = self._execute("SELECT ifnull(max(value)+1, 0) FROM %s where version=? AND pkgarch=?;" % (self.table), | 173 | data = self._execute("SELECT ifnull(max(value)+1, 0) FROM %s where version=? AND pkgarch=?;" % (self.table), |
174 | (version, pkgarch)) | 174 | (version, pkgarch)) |
175 | row = data.fetchone() | 175 | return data.fetchone()[0] |
176 | if row is not None: | ||
177 | return row[0] | ||
178 | else: | ||
179 | return 0 | ||
180 | 176 | ||
181 | try: | 177 | try: |
182 | self._execute("INSERT OR REPLACE INTO %s VALUES (?, ?, ?, (select ifnull(max(value)+1, 0) from %s where version=? AND pkgarch=?));" | 178 | self._execute("INSERT OR REPLACE INTO %s VALUES (?, ?, ?, (select ifnull(max(value)+1, 0) from %s where version=? AND pkgarch=?));" |