def show(self, attrs=[], cols=None, fformat='raw', limit=0): if not cols: cols = self.COLUMNS cidx = col_idx(self.COLIDXS, cols) if not attrs: attrs=[None] rows = [] for attr in attrs: cnd, err = cond(name=attr) rows += self.db.select(self.TABLE, self.COLUMNS, cnd, limit) if limit > 0: rows = rows[:limit] new_rows = [] for row in rows: row[self.FLAGIDX] = cv_flags(fformat, row[self.FLAGIDX]) new_row = [] for i in cidx: new_row.append(row[i]) new_rows.append(new_row) desc = self.db.describe(self.TABLE) desc = [ desc[i] for i in cols ] return new_rows, desc
def _show(self, cnd, err, cols, fformat, limit): if not cols: cols = self.COLUMNS cidx = col_idx(self.COLIDXS, cols) rows = self.db.select(self.TABLE, self.COLUMNS, cnd, limit) new_rows = [] for row in rows: row[self.FLAGIDX] = cv_flags(fformat, row[self.FLAGIDX]) new_row = [] for i in cidx: new_row.append(row[i]) new_rows.append(new_row) desc = self.db.describe(self.TABLE) desc = [ desc[i] for i in cols ] return new_rows, desc
def show_uid(self, uid, cols=None, fformat='raw', limit=0): if not cols: cols = self.COLUMNS cidx = col_idx(self.COLIDXS, cols) cnd, err = cond(uid=uid) rows = self.db.select(self.TABLE, self.COLUMNS, cnd, limit) new_rows = [] for row in rows: row[self.FLAGIDX] = cv_flags(fformat, row[self.FLAGIDX]) new_row = [] for i in cidx: new_row.append(row[i]) new_rows.append(new_row) desc = self.db.describe(self.TABLE) desc = [ desc[i] for i in cols ] return new_rows, desc