コード例 #1
0
ファイル: helpers.go プロジェクト: BurntSushi/goim
// countEpisodes returns the number of episodes for the TV show given.
func countEpisodes(e imdb.Entity) int {
	assertDB()
	q := `
		SELECT COUNT(*)
		FROM episode
		WHERE tvshow_atom_id = $1 AND season > 0 AND episode_num > 0
	`
	return csql.Count(tplDB, q, e.Ident())
}
コード例 #2
0
ファイル: helpers.go プロジェクト: BurntSushi/goim
// countSeasons returns the number of seasons for the TV show given.
func countSeasons(e imdb.Entity) int {
	assertDB()
	q := `
		SELECT COUNT(*)
		FROM (
			SELECT season
			FROM episode
			WHERE tvshow_atom_id = $1 AND season > 0 AND episode_num > 0
			GROUP BY season
		) AS sub
	`
	return csql.Count(tplDB, q, e.Ident())
}