|
@@ -300,7 +300,7 @@ func (this *Modules) RegisterAction_BlogCategoriesDelete() *Action {
|
|
|
}
|
|
|
|
|
|
// Start transaction with table lock
|
|
|
- _, err := wrap.DB.Exec("LOCK TABLE blog_cats WRITE;")
|
|
|
+ _, err := wrap.DB.Exec("LOCK TABLES blog_cats WRITE, blog_cat_post_rel WRITE;")
|
|
|
if err != nil {
|
|
|
wrap.MsgError(err.Error())
|
|
|
return
|
|
@@ -337,6 +337,11 @@ func (this *Modules) RegisterAction_BlogCategoriesDelete() *Action {
|
|
|
wrap.MsgError(err.Error())
|
|
|
return
|
|
|
}
|
|
|
+ if _, err = tx.Exec("DELETE FROM blog_cat_post_rel WHERE category_id = ?;", pf_id); err != nil {
|
|
|
+ tx.Rollback()
|
|
|
+ wrap.MsgError(err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
// Commit all changes and unlock table
|
|
|
err = tx.Commit()
|