Skip to content

Commit

Permalink
trying to fix db: the sequel
Browse files Browse the repository at this point in the history
  • Loading branch information
paoloose committed Dec 2, 2024
1 parent c9d7e2a commit c3e0682
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion stiller-backend/pkg/dbutils/generals.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,24 @@ func GetGalleryData(gallery int) (*StillerGalleryData, error) {
return nil, ErrTemplateNotFound
}

template_data, template_data_err := templates.GetTemplateData(template_id)
templateFileId := int(-1)
templateFileQuery_stmt := sqlf.Select("templatefile").
From("template").
Where("id = ?", template_id)
templateFileQuery_query, templateFileQuery_args := templateFileQuery_stmt.String(), templateFileQuery_stmt.Args()
templateFileQuery_err := sqlitex.ExecuteTransient(new_dbconn, templateFileQuery_query, &sqlitex.ExecOptions{
ResultFunc: func(stmt *sqlite.Stmt) error {
templateFileId = int(stmt.GetInt64("templatefile"))
return nil
},
Args: templateFileQuery_args,
})

if templateFileId == -1 {
return nil, templateFileQuery_err
}

template_data, template_data_err := templates.GetTemplateData(templateFileId)
if template_data_err != nil {
return nil, template_data_err
}
Expand Down

0 comments on commit c3e0682

Please sign in to comment.