diff options
Diffstat (limited to 'bitbake/lib/prserv/db.py')
-rw-r--r-- | bitbake/lib/prserv/db.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/bitbake/lib/prserv/db.py b/bitbake/lib/prserv/db.py index 7bc2b2dc2d..7c200602ed 100644 --- a/bitbake/lib/prserv/db.py +++ b/bitbake/lib/prserv/db.py | |||
@@ -78,6 +78,52 @@ class PRTable(object): | |||
78 | self.sync() | 78 | self.sync() |
79 | self.dirty = False | 79 | self.dirty = False |
80 | 80 | ||
81 | def test_package(self, version, pkgarch): | ||
82 | """Returns whether the specified package version is found in the database for the specified architecture""" | ||
83 | |||
84 | # Just returns the value if found or None otherwise | ||
85 | data=self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=?;" % self.table, | ||
86 | (version, pkgarch)) | ||
87 | row=data.fetchone() | ||
88 | if row is not None: | ||
89 | return True | ||
90 | else: | ||
91 | return False | ||
92 | |||
93 | def test_value(self, version, pkgarch, value): | ||
94 | """Returns whether the specified value is found in the database for the specified package and architecture""" | ||
95 | |||
96 | # Just returns the value if found or None otherwise | ||
97 | data=self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? and value=?;" % self.table, | ||
98 | (version, pkgarch, value)) | ||
99 | row=data.fetchone() | ||
100 | if row is not None: | ||
101 | return True | ||
102 | else: | ||
103 | return False | ||
104 | |||
105 | def find_value(self, version, pkgarch, checksum): | ||
106 | """Returns the value for the specified checksum if found or None otherwise.""" | ||
107 | |||
108 | data=self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, | ||
109 | (version, pkgarch, checksum)) | ||
110 | row=data.fetchone() | ||
111 | if row is not None: | ||
112 | return row[0] | ||
113 | else: | ||
114 | return None | ||
115 | |||
116 | def find_max_value(self, version, pkgarch): | ||
117 | """Returns the greatest value for (version, pkgarch), or None if not found. Doesn't create a new value""" | ||
118 | |||
119 | data = self._execute("SELECT max(value) FROM %s where version=? AND pkgarch=?;" % (self.table), | ||
120 | (version, pkgarch)) | ||
121 | row = data.fetchone() | ||
122 | if row is not None: | ||
123 | return row[0] | ||
124 | else: | ||
125 | return None | ||
126 | |||
81 | def _get_value_hist(self, version, pkgarch, checksum): | 127 | def _get_value_hist(self, version, pkgarch, checksum): |
82 | data=self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, | 128 | data=self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, |
83 | (version, pkgarch, checksum)) | 129 | (version, pkgarch, checksum)) |