def fetch_unnotified(cls, db): sql = cls._get_select_stem() condition = AndCondition([ StrictEqualCondition(sql, 'completed', True), StrictEqualCondition(sql, 'notified', False), ]) sql.set_where(condition) return cls._select(db, sql)
def fetch_by_watch_and_changelist(cls, db, watch, changelist): sql = cls._get_select_stem() sql.set_where( AndCondition([ StrictEqualCondition(sql, 'watch_id', watch.id), StrictEqualCondition(sql, 'changelist', changelist), ])) rows = cls._select(db, sql) return rows[0] if len(rows) >= 1 else None
def fetch_by_watch(cls, db, watch): sql = Select('p4_paths_for_watch') sql.add_hidden_column('watch_id', IntColumnFormatter()) sql.add_column('path_id', IntColumnFormatter()) sql.add_column('path', StringColumnFormatter()) sql.set_where(StrictEqualCondition(sql, 'watch_id', watch.id)) return cls._select(db, sql)
def fetch_by_overtest_testrun_id(cls, db, overtest_testrun_id): sql = cls._get_select_stem() sql.set_where( StrictEqualCondition(sql, 'overtest_testrun_id', overtest_testrun_id)) rows = cls._select(db, sql) return rows[0] if len(rows) >= 1 else None
def fetch_by_subscriber(cls, db, user): sql = Select('bld_watches_for_subscriber') sql.add_hidden_column('subscriber_id', IntColumnFormatter()) sql.add_column('watch_id', IntColumnFormatter()) sql.add_column('name', StringColumnFormatter()) sql.set_where(StrictEqualCondition(sql, 'subscriber_id', user.id)) return cls._select(db, sql)
def fetch_by_watch(cls, db, watch): sql = Select('bld_subscribers_for_watch') sql.add_hidden_column('watch_id', IntColumnFormatter()) sql.add_column('subscriber_id', IntColumnFormatter()) sql.add_column('email', StringColumnFormatter()) sql.set_where(StrictEqualCondition(sql, 'watch_id', watch.id)) return cls._select(db, sql)
def fetch_by_path(cls, db, path): sql = cls._get_select_stem() sql.set_where(StrictEqualCondition(sql, 'path', path)) rows = cls._select(db, sql) return rows[0] if len(rows) >= 1 else None
def fetch_unsubmitted(cls, db): sql = cls._get_select_stem() sql.set_where(StrictEqualCondition(sql, 'overtest_testrun_id', None)) rows = cls._select(db, sql) return rows
def _get_primary_key_condition(self, sql): return AndCondition([ StrictEqualCondition(sql, 'changelist', self.changelist), StrictEqualCondition(sql, 'watch_id', self.watch_id) ])
def fetch_incomplete(cls, db): sql = cls._get_select_stem() sql.set_where(StrictEqualCondition(sql, 'completed', False)) return cls._select(db, sql)
def fetch_by_id(cls, db, id_): sql = cls._get_select_stem() sql.set_where(StrictEqualCondition(sql, 'id', id_)) rows = cls._select(db, sql) return rows[0] if len(rows) >= 1 else None
def _get_primary_key_condition(self, sql): return StrictEqualCondition(sql, 'id', self.id)
def _get_primary_key_condition(self, sql): return AndCondition([ StrictEqualCondition(sql, 'watch_id', self.watch_id), StrictEqualCondition(sql, 'path_id', self.path_id) ])
def fetch_by_name(cls, db, name): sql = cls._get_select_stem() sql.set_where(StrictEqualCondition(sql, 'name', name)) rows = cls._select(db, sql) return rows[0] if len(rows) >= 1 else None
def fetch_by_email(cls, db, email): sql = cls._get_select_stem() sql.set_where(StrictEqualCondition(sql, 'email', email)) rows = cls._select(db, sql) return rows[0] if len(rows) >= 1 else None
def fetch_by_fqdn(cls, db, fqdn): sql = cls._get_select_stem() sql.set_where(StrictEqualCondition(sql, 'fqdn', fqdn)) config = cls._select(db, sql) return config[0] if len(config) >= 1 else None