libfic: Can retrieve the Theme from an exercice
This commit is contained in:
parent
859dbc68cb
commit
c1746f3dc7
1 changed files with 8 additions and 0 deletions
|
|
@ -107,6 +107,14 @@ func (e Exercice) Update() (int64, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (e Exercice) GetTheme() (Theme, error) {
|
||||||
|
var tid int
|
||||||
|
if err := DBQueryRow("SELECT id_theme FROM exercices WHERE id_exercice=?", e.Id).Scan(&tid); err != nil {
|
||||||
|
return Theme{}, err
|
||||||
|
}
|
||||||
|
return GetTheme(tid)
|
||||||
|
}
|
||||||
|
|
||||||
func (e Exercice) Delete() (int64, error) {
|
func (e Exercice) Delete() (int64, error) {
|
||||||
if res, err := DBExec("DELETE FROM exercices WHERE id_exercice = ?", e.Id); err != nil {
|
if res, err := DBExec("DELETE FROM exercices WHERE id_exercice = ?", e.Id); err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
|
|
|
||||||
Reference in a new issue