Browse Source

db.Exec -> db.ExecContext in transactions

Vova Tkach 5 years ago
parent
commit
eb33d7c47b

+ 4 - 3
engine/sqlw/txw.go

@@ -1,6 +1,7 @@
 package sqlw
 
 import (
+	"context"
 	"database/sql"
 	_ "github.com/go-sql-driver/mysql"
 
@@ -23,14 +24,14 @@ func (this *Tx) Commit() error {
 	return this.tx.Commit()
 }
 
-func (this *Tx) Exec(query string, args ...interface{}) (sql.Result, error) {
+func (this *Tx) Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error) {
 	if consts.ParamDebug {
 		s := time.Now()
-		r, e := this.tx.Exec(query, args...)
+		r, e := this.tx.ExecContext(ctx, query, args...)
 		log("[TX] "+query, s, e, true)
 		return r, e
 	}
-	return this.tx.Exec(query, args...)
+	return this.tx.ExecContext(ctx, query, args...)
 }
 
 func (this *Tx) Query(query string, args ...interface{}) (*sql.Rows, error) {

+ 4 - 4
modules/module_blog_act_delete.go

@@ -22,18 +22,18 @@ func (this *Modules) RegisterAction_BlogDelete() *Action {
 
 		if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 			// Block rows
-			if _, err := tx.Exec("SELECT id FROM blog_posts WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT id FROM blog_posts WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT post_id FROM blog_cat_post_rel WHERE post_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT post_id FROM blog_cat_post_rel WHERE post_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 
 			// Delete target post with category connection data
-			if _, err := tx.Exec("DELETE FROM blog_cat_post_rel WHERE post_id = ?;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "DELETE FROM blog_cat_post_rel WHERE post_id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("DELETE FROM blog_posts WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "DELETE FROM blog_posts WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 			return nil

+ 10 - 6
modules/module_blog_act_modify.go

@@ -61,6 +61,7 @@ func (this *Modules) RegisterAction_BlogModify() *Action {
 			if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 				// Insert row
 				res, err := tx.Exec(
+					ctx,
 					`INSERT INTO blog_posts SET
 						user = ?,
 						name = ?,
@@ -91,7 +92,7 @@ func (this *Modules) RegisterAction_BlogModify() *Action {
 				}
 
 				// Block rows
-				if _, err := tx.Exec("SELECT id FROM blog_posts WHERE id = ? FOR UPDATE;", lastID); err != nil {
+				if _, err := tx.Exec(ctx, "SELECT id FROM blog_posts WHERE id = ? FOR UPDATE;", lastID); err != nil {
 					return err
 				}
 
@@ -121,7 +122,8 @@ func (this *Modules) RegisterAction_BlogModify() *Action {
 						balkInsertArr = append(balkInsertArr, `(`+utils.Int64ToStr(lastID)+`,`+utils.IntToStr(el)+`)`)
 					}
 					if _, err = tx.Exec(
-						`INSERT INTO blog_cat_post_rel (post_id,category_id) VALUES ` + strings.Join(balkInsertArr, ",") + `;`,
+						ctx,
+						`INSERT INTO blog_cat_post_rel (post_id,category_id) VALUES `+strings.Join(balkInsertArr, ",")+`;`,
 					); err != nil {
 						return err
 					}
@@ -136,15 +138,16 @@ func (this *Modules) RegisterAction_BlogModify() *Action {
 		} else {
 			if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 				// Block rows
-				if _, err := tx.Exec("SELECT id FROM blog_posts WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+				if _, err := tx.Exec(ctx, "SELECT id FROM blog_posts WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 					return err
 				}
-				if _, err := tx.Exec("SELECT post_id FROM blog_cat_post_rel WHERE post_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+				if _, err := tx.Exec(ctx, "SELECT post_id FROM blog_cat_post_rel WHERE post_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 					return err
 				}
 
 				// Update row
 				if _, err := tx.Exec(
+					ctx,
 					`UPDATE blog_posts SET
 						name = ?,
 						alias = ?,
@@ -167,7 +170,7 @@ func (this *Modules) RegisterAction_BlogModify() *Action {
 				}
 
 				// Delete post and categories relations
-				if _, err := tx.Exec("DELETE FROM blog_cat_post_rel WHERE post_id = ?;", utils.StrToInt(pf_id)); err != nil {
+				if _, err := tx.Exec(ctx, "DELETE FROM blog_cat_post_rel WHERE post_id = ?;", utils.StrToInt(pf_id)); err != nil {
 					return err
 				}
 
@@ -197,7 +200,8 @@ func (this *Modules) RegisterAction_BlogModify() *Action {
 						balkInsertArr = append(balkInsertArr, `(`+pf_id+`,`+utils.IntToStr(el)+`)`)
 					}
 					if _, err := tx.Exec(
-						`INSERT INTO blog_cat_post_rel (post_id,category_id) VALUES ` + strings.Join(balkInsertArr, ",") + `;`,
+						ctx,
+						`INSERT INTO blog_cat_post_rel (post_id,category_id) VALUES `+strings.Join(balkInsertArr, ",")+`;`,
 					); err != nil {
 						return err
 					}

+ 10 - 10
modules/module_blog_categories_act_delete.go

@@ -22,38 +22,38 @@ func (this *Modules) RegisterAction_BlogCategoriesDelete() *Action {
 
 		err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 			// Block rows
-			if _, err := tx.Exec("SELECT id FROM blog_cats FOR UPDATE;"); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT id FROM blog_cats FOR UPDATE;"); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT category_id FROM blog_cat_post_rel WHERE category_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT category_id FROM blog_cat_post_rel WHERE category_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT id FROM blog_posts WHERE category = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT id FROM blog_posts WHERE category = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 
 			// Set root category
-			if _, err := tx.Exec("UPDATE blog_posts SET category = 1 WHERE category = ?;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "UPDATE blog_posts SET category = 1 WHERE category = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 
 			// Process
-			if _, err := tx.Exec("DELETE FROM blog_cat_post_rel WHERE category_id = ?;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "DELETE FROM blog_cat_post_rel WHERE category_id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT @ml := lft, @mr := rgt FROM blog_cats WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT @ml := lft, @mr := rgt FROM blog_cats WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("DELETE FROM blog_cats WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "DELETE FROM blog_cats WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("UPDATE blog_cats SET lft = lft - 1, rgt = rgt - 1 WHERE lft > @ml AND rgt < @mr;"); err != nil {
+			if _, err := tx.Exec(ctx, "UPDATE blog_cats SET lft = lft - 1, rgt = rgt - 1 WHERE lft > @ml AND rgt < @mr;"); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("UPDATE blog_cats SET lft = lft - 2 WHERE lft > @mr;"); err != nil {
+			if _, err := tx.Exec(ctx, "UPDATE blog_cats SET lft = lft - 2 WHERE lft > @mr;"); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("UPDATE blog_cats SET rgt = rgt - 2 WHERE rgt > @mr;"); err != nil {
+			if _, err := tx.Exec(ctx, "UPDATE blog_cats SET rgt = rgt - 2 WHERE rgt > @mr;"); err != nil {
 				return err
 			}
 			return nil

+ 18 - 17
modules/module_blog_categories_act_modify.go

@@ -12,24 +12,24 @@ func (this *Modules) blog_ActionCategoryAdd(wrap *wrapper.Wrapper, pf_id, pf_nam
 	var lastID int64 = 0
 	return wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 		// Block rows
-		if _, err := tx.Exec("SELECT id FROM blog_cats FOR UPDATE;"); err != nil {
+		if _, err := tx.Exec(ctx, "SELECT id FROM blog_cats FOR UPDATE;"); err != nil {
 			return err
 		}
 
 		// Process
-		if _, err := tx.Exec("SELECT @mr := rgt FROM blog_cats WHERE id = ?;", utils.StrToInt(pf_parent)); err != nil {
+		if _, err := tx.Exec(ctx, "SELECT @mr := rgt FROM blog_cats WHERE id = ?;", utils.StrToInt(pf_parent)); err != nil {
 			return err
 		}
-		if _, err := tx.Exec("UPDATE blog_cats SET rgt = rgt + 2 WHERE rgt > @mr;"); err != nil {
+		if _, err := tx.Exec(ctx, "UPDATE blog_cats SET rgt = rgt + 2 WHERE rgt > @mr;"); err != nil {
 			return err
 		}
-		if _, err := tx.Exec("UPDATE blog_cats SET lft = lft + 2 WHERE lft > @mr;"); err != nil {
+		if _, err := tx.Exec(ctx, "UPDATE blog_cats SET lft = lft + 2 WHERE lft > @mr;"); err != nil {
 			return err
 		}
-		if _, err := tx.Exec("UPDATE blog_cats SET rgt = rgt + 2 WHERE id = ?;", utils.StrToInt(pf_parent)); err != nil {
+		if _, err := tx.Exec(ctx, "UPDATE blog_cats SET rgt = rgt + 2 WHERE id = ?;", utils.StrToInt(pf_parent)); err != nil {
 			return err
 		}
-		res, err := tx.Exec("INSERT INTO blog_cats (id, user, name, alias, lft, rgt) VALUES (NULL, ?, ?, ?, @mr, @mr + 1);", wrap.User.A_id, pf_name, pf_alias)
+		res, err := tx.Exec(ctx, "INSERT INTO blog_cats (id, user, name, alias, lft, rgt) VALUES (NULL, ?, ?, ?, @mr, @mr + 1);", wrap.User.A_id, pf_name, pf_alias)
 		if err != nil {
 			return err
 		}
@@ -48,8 +48,9 @@ func (this *Modules) blog_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 		// If parent not changed, just update category data
 		return wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 			// Process
-			if _, err := tx.Exec(`
-				UPDATE blog_cats SET
+			if _, err := tx.Exec(
+				ctx,
+				`UPDATE blog_cats SET
 					name = ?,
 					alias = ?
 				WHERE
@@ -71,7 +72,7 @@ func (this *Modules) blog_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 	// Parent is changed, move category to new parent
 	return wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 		// Block all rows
-		if _, err := tx.Exec("SELECT id FROM blog_cats FOR UPDATE;"); err != nil {
+		if _, err := tx.Exec(ctx, "SELECT id FROM blog_cats FOR UPDATE;"); err != nil {
 			return err
 		}
 
@@ -112,13 +113,13 @@ func (this *Modules) blog_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 				// From right to left
 				// Shift
 				step := targetR - targetL + 1
-				if _, err := tx.Exec("UPDATE blog_cats SET lft = lft + ? WHERE lft > ? and lft < ?;", step, parentR, targetL); err != nil {
+				if _, err := tx.Exec(ctx, "UPDATE blog_cats SET lft = lft + ? WHERE lft > ? and lft < ?;", step, parentR, targetL); err != nil {
 					return err
 				}
-				if _, err := tx.Exec("UPDATE blog_cats SET rgt = rgt + ? WHERE rgt > ? and rgt < ?;", step, parentR, targetL); err != nil {
+				if _, err := tx.Exec(ctx, "UPDATE blog_cats SET rgt = rgt + ? WHERE rgt > ? and rgt < ?;", step, parentR, targetL); err != nil {
 					return err
 				}
-				if _, err := tx.Exec("UPDATE blog_cats SET rgt = rgt + ? WHERE id = ?;", step, utils.StrToInt(pf_parent)); err != nil {
+				if _, err := tx.Exec(ctx, "UPDATE blog_cats SET rgt = rgt + ? WHERE id = ?;", step, utils.StrToInt(pf_parent)); err != nil {
 					return err
 				}
 
@@ -126,7 +127,7 @@ func (this *Modules) blog_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 				for i, _ := range rows_id {
 					new_lft := rows_lft[i] - (targetL - parentR)
 					new_rgt := rows_rgt[i] - (targetL - parentR)
-					if _, err := tx.Exec("UPDATE blog_cats SET lft = ?, rgt = ? WHERE id = ?;", new_lft, new_rgt, rows_id[i]); err != nil {
+					if _, err := tx.Exec(ctx, "UPDATE blog_cats SET lft = ?, rgt = ? WHERE id = ?;", new_lft, new_rgt, rows_id[i]); err != nil {
 						return err
 					}
 				}
@@ -134,10 +135,10 @@ func (this *Modules) blog_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 				// From left to right
 				// Shift
 				step := targetR - targetL + 1
-				if _, err := tx.Exec("UPDATE blog_cats SET lft = lft - ? WHERE lft > ? and lft < ?;", step, targetR, parentR); err != nil {
+				if _, err := tx.Exec(ctx, "UPDATE blog_cats SET lft = lft - ? WHERE lft > ? and lft < ?;", step, targetR, parentR); err != nil {
 					return err
 				}
-				if _, err := tx.Exec("UPDATE blog_cats SET rgt = rgt - ? WHERE rgt > ? and rgt < ?;", step, targetR, parentR); err != nil {
+				if _, err := tx.Exec(ctx, "UPDATE blog_cats SET rgt = rgt - ? WHERE rgt > ? and rgt < ?;", step, targetR, parentR); err != nil {
 					return err
 				}
 
@@ -145,7 +146,7 @@ func (this *Modules) blog_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 				for i, _ := range rows_id {
 					new_lft := rows_lft[i] + (parentR - targetL - step)
 					new_rgt := rows_rgt[i] + (parentR - targetL - step)
-					if _, err := tx.Exec("UPDATE blog_cats SET lft = ?, rgt = ? WHERE id = ?;", new_lft, new_rgt, rows_id[i]); err != nil {
+					if _, err := tx.Exec(ctx, "UPDATE blog_cats SET lft = ?, rgt = ? WHERE id = ?;", new_lft, new_rgt, rows_id[i]); err != nil {
 						return err
 					}
 				}
@@ -156,7 +157,7 @@ func (this *Modules) blog_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 		}
 
 		// Update target cat data
-		if _, err := tx.Exec("UPDATE blog_cats SET name = ?, alias = ? WHERE id = ?;", pf_name, pf_alias, utils.StrToInt(pf_id)); err != nil {
+		if _, err := tx.Exec(ctx, "UPDATE blog_cats SET name = ?, alias = ? WHERE id = ?;", pf_name, pf_alias, utils.StrToInt(pf_id)); err != nil {
 			return err
 		}
 

+ 1 - 1
modules/module_index_act_delete.go

@@ -22,7 +22,7 @@ func (this *Modules) RegisterAction_IndexDelete() *Action {
 
 		err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 			// Process
-			if _, err := tx.Exec("DELETE FROM pages WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "DELETE FROM pages WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 			return nil

+ 2 - 0
modules/module_index_act_modify.go

@@ -50,6 +50,7 @@ func (this *Modules) RegisterAction_IndexModify() *Action {
 			var lastID int64 = 0
 			if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 				res, err := tx.Exec(
+					ctx,
 					`INSERT INTO pages SET
 						user = ?,
 						name = ?,
@@ -90,6 +91,7 @@ func (this *Modules) RegisterAction_IndexModify() *Action {
 			// Update page
 			if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 				_, err := tx.Exec(
+					ctx,
 					`UPDATE pages SET
 						name = ?,
 						alias = ?,

+ 252 - 79
modules/module_index_act_mysql_setup.go

@@ -73,6 +73,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 
 		// Table: blog_cats
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`CREATE TABLE blog_cats (
 				id int(11) NOT NULL AUTO_INCREMENT COMMENT 'AI',
 				user int(11) NOT NULL COMMENT 'User id',
@@ -90,6 +91,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 
 		// Table: blog_cat_post_rel
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`CREATE TABLE blog_cat_post_rel (
 				post_id int(11) NOT NULL COMMENT 'Post id',
 				category_id int(11) NOT NULL COMMENT 'Category id'
@@ -102,6 +104,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 
 		// Table: blog_posts
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`CREATE TABLE blog_posts (
 				id int(11) NOT NULL AUTO_INCREMENT COMMENT 'AI',
 				user int(11) NOT NULL COMMENT 'User id',
@@ -122,6 +125,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 
 		// Table: notify_mail
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`CREATE TABLE notify_mail (
 				id int(11) NOT NULL AUTO_INCREMENT COMMENT 'AI',
 				email varchar(255) NOT NULL COMMENT 'Email address',
@@ -140,6 +144,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 
 		// Table: pages
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`CREATE TABLE pages (
 				id int(11) NOT NULL AUTO_INCREMENT COMMENT 'AI',
 				user int(11) NOT NULL COMMENT 'User id',
@@ -161,6 +166,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 
 		// Table: settings
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`CREATE TABLE settings (
 				name varchar(255) NOT NULL COMMENT 'Setting name',
 				value text NOT NULL COMMENT 'Setting value'
@@ -173,6 +179,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 
 		// Table: shop_cat_product_rel
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`CREATE TABLE shop_cat_product_rel (
 				product_id int(11) NOT NULL COMMENT 'Product id',
 				category_id int(11) NOT NULL COMMENT 'Category id'
@@ -185,6 +192,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 
 		// Table: shop_cats
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`CREATE TABLE shop_cats (
 				id int(11) NOT NULL AUTO_INCREMENT COMMENT 'AI',
 				user int(11) NOT NULL COMMENT 'User id',
@@ -202,6 +210,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 
 		// Table: shop_currencies
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`CREATE TABLE shop_currencies (
 				id int(11) NOT NULL AUTO_INCREMENT COMMENT 'AI',
 				name varchar(255) NOT NULL COMMENT 'Currency name',
@@ -218,6 +227,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 
 		// Table: shop_filter_product_values
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`CREATE TABLE shop_filter_product_values (
 				product_id int(11) NOT NULL COMMENT 'Product id',
 				filter_value_id int(11) NOT NULL COMMENT 'Filter value id'
@@ -230,6 +240,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 
 		// Table: shop_filters
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`CREATE TABLE shop_filters (
 				id int(11) NOT NULL AUTO_INCREMENT COMMENT 'AI',
 				name varchar(255) NOT NULL COMMENT 'Filter name in CP',
@@ -244,6 +255,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 
 		// Table: shop_filters_values
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`CREATE TABLE shop_filters_values (
 				id int(11) NOT NULL AUTO_INCREMENT COMMENT 'AI',
 				filter_id int(11) NOT NULL COMMENT 'Filter id',
@@ -258,6 +270,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 
 		// Table: shop_order_products
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`CREATE TABLE shop_order_products (
 				id int(11) NOT NULL AUTO_INCREMENT COMMENT 'AI',
 				order_id int(11) NOT NULL COMMENT 'Order ID',
@@ -274,6 +287,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 
 		// Table: shop_orders
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`CREATE TABLE shop_orders (
 				id int(11) NOT NULL AUTO_INCREMENT COMMENT 'AI',
 				create_datetime datetime NOT NULL COMMENT 'Create date/time',
@@ -301,6 +315,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 
 		// Table: shop_product_images
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`CREATE TABLE shop_product_images (
 				id int(11) NOT NULL AUTO_INCREMENT,
 				product_id int(11) NOT NULL,
@@ -316,6 +331,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 
 		// Table: shop_products
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`CREATE TABLE shop_products (
 				id int(11) NOT NULL AUTO_INCREMENT COMMENT 'AI',
 				parent_id int(11) DEFAULT NULL,
@@ -346,6 +362,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 
 		// Table: users
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`CREATE TABLE users (
 				id int(11) NOT NULL AUTO_INCREMENT COMMENT 'AI',
 				first_name varchar(64) NOT NULL DEFAULT '' COMMENT 'User first name',
@@ -364,6 +381,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 
 		// Demo datas
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO blog_cats (id, user, name, alias, lft, rgt)
 				VALUES
 			(1, 1, 'ROOT', 'ROOT', 1, 24),
@@ -384,6 +402,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO blog_cat_post_rel (post_id, category_id) VALUES (1, 9), (2, 12), (3, 8);`,
 		); err != nil {
 			tx.Rollback()
@@ -391,6 +410,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO blog_posts SET
 				id = ?,
 				user = ?,
@@ -417,6 +437,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO blog_posts SET
 				id = ?,
 				user = ?,
@@ -443,6 +464,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO blog_posts SET
 				id = ?,
 				user = ?,
@@ -469,6 +491,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO pages SET
 				id = ?,
 				user = ?,
@@ -491,6 +514,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO pages SET
 				id = ?,
 				user = ?,
@@ -513,6 +537,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO pages SET
 				id = ?,
 				user = ?,
@@ -535,6 +560,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO settings (name, value) VALUES ('database_version', '000000020');`,
 		); err != nil {
 			tx.Rollback()
@@ -542,6 +568,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO shop_cat_product_rel (product_id, category_id)
 				VALUES
 			(1, 3),
@@ -553,6 +580,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO shop_cats (id, user, name, alias, lft, rgt)
 				VALUES
 			(1, 1, 'ROOT', 'ROOT', 1, 6),
@@ -564,6 +592,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO shop_currencies (id, name, coefficient, code, symbol)
 				VALUES
 			(1, 'US Dollar', 1.0000, 'USD', '$'),
@@ -574,6 +603,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO shop_filter_product_values (product_id, filter_value_id)
 				VALUES
 			(1, 3),
@@ -597,6 +627,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO shop_filters (id, name, filter)
 				VALUES
 			(1, 'Mobile phones manufacturer', 'Manufacturer'),
@@ -608,6 +639,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO shop_filters_values (id, filter_id, name)
 				VALUES
 			(1, 1, 'Apple'),
@@ -628,6 +660,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO shop_products SET
 				id = ?,
 				user = ?,
@@ -666,6 +699,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO shop_products SET
 				id = ?,
 				parent_id = ?,
@@ -706,6 +740,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO shop_products SET
 				id = ?,
 				parent_id = ?,
@@ -746,6 +781,7 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 			return
 		}
 		if _, err = tx.Exec(
+			wrap.R.Context(),
 			`INSERT INTO users (id, first_name, last_name, email, password, admin, active) VALUES (1, 'First Name', 'Last Name', 'example@example.com', '23463b99b62a72f26ed677cc556c44e8', 1, 1);`,
 		); err != nil {
 			tx.Rollback()
@@ -754,357 +790,494 @@ func (this *Modules) RegisterAction_IndexMysqlSetup() *Action {
 		}
 
 		// Indexes
-		if _, err = tx.Exec(`ALTER TABLE blog_cat_post_rel ADD UNIQUE KEY post_category (post_id,category_id) USING BTREE;`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE blog_cat_post_rel ADD UNIQUE KEY post_category (post_id,category_id) USING BTREE;`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE blog_cat_post_rel ADD KEY FK_blog_cat_post_rel_post_id (post_id);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE blog_cat_post_rel ADD KEY FK_blog_cat_post_rel_post_id (post_id);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE blog_cat_post_rel ADD KEY FK_blog_cat_post_rel_category_id (category_id);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE blog_cat_post_rel ADD KEY FK_blog_cat_post_rel_category_id (category_id);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE blog_cats ADD UNIQUE KEY alias (alias);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE blog_cats ADD UNIQUE KEY alias (alias);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE blog_cats ADD KEY lft (lft), ADD KEY rgt (rgt);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE blog_cats ADD KEY lft (lft), ADD KEY rgt (rgt);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE blog_cats ADD KEY FK_blog_cats_user (user);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE blog_cats ADD KEY FK_blog_cats_user (user);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE blog_posts ADD UNIQUE KEY alias (alias);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE blog_posts ADD UNIQUE KEY alias (alias);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE blog_posts ADD KEY FK_blog_posts_user (user);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE blog_posts ADD KEY FK_blog_posts_user (user);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE blog_posts ADD KEY FK_blog_posts_category (category);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE blog_posts ADD KEY FK_blog_posts_category (category);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE notify_mail ADD KEY status (status);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE notify_mail ADD KEY status (status);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE pages ADD UNIQUE KEY alias (alias);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE pages ADD UNIQUE KEY alias (alias);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE pages ADD KEY alias_active (alias,active) USING BTREE;`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE pages ADD KEY alias_active (alias,active) USING BTREE;`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE pages ADD KEY FK_pages_user (user);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE pages ADD KEY FK_pages_user (user);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE settings ADD UNIQUE KEY name (name);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE settings ADD UNIQUE KEY name (name);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_cat_product_rel ADD UNIQUE KEY product_category (product_id,category_id) USING BTREE;`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_cat_product_rel ADD UNIQUE KEY product_category (product_id,category_id) USING BTREE;`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_cat_product_rel ADD KEY FK_shop_cat_product_rel_product_id (product_id);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_cat_product_rel ADD KEY FK_shop_cat_product_rel_product_id (product_id);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_cat_product_rel ADD KEY FK_shop_cat_product_rel_category_id (category_id);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_cat_product_rel ADD KEY FK_shop_cat_product_rel_category_id (category_id);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_cats ADD UNIQUE KEY alias (alias);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_cats ADD UNIQUE KEY alias (alias);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_cats ADD KEY lft (lft), ADD KEY rgt (rgt);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_cats ADD KEY lft (lft), ADD KEY rgt (rgt);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_cats ADD KEY FK_shop_cats_user (user);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_cats ADD KEY FK_shop_cats_user (user);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_filter_product_values ADD UNIQUE KEY product_filter_value (product_id,filter_value_id) USING BTREE;`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_filter_product_values ADD UNIQUE KEY product_filter_value (product_id,filter_value_id) USING BTREE;`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_filter_product_values ADD KEY FK_shop_filter_product_values_product_id (product_id);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_filter_product_values ADD KEY FK_shop_filter_product_values_product_id (product_id);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_filter_product_values ADD KEY FK_shop_filter_product_values_filter_value_id (filter_value_id);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_filter_product_values ADD KEY FK_shop_filter_product_values_filter_value_id (filter_value_id);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_filters ADD KEY name (name);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_filters ADD KEY name (name);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_filters_values ADD KEY FK_shop_filters_values_filter_id (filter_id);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_filters_values ADD KEY FK_shop_filters_values_filter_id (filter_id);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_filters_values ADD KEY name (name);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_filters_values ADD KEY name (name);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_orders ADD KEY FK_shop_orders_currency_id (currency_id);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_orders ADD KEY FK_shop_orders_currency_id (currency_id);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_order_products ADD UNIQUE KEY order_product (order_id,product_id) USING BTREE;`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_order_products ADD UNIQUE KEY order_product (order_id,product_id) USING BTREE;`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_order_products ADD KEY FK_shop_order_products_order_id (order_id);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_order_products ADD KEY FK_shop_order_products_order_id (order_id);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_order_products ADD KEY FK_shop_order_products_product_id (product_id);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_order_products ADD KEY FK_shop_order_products_product_id (product_id);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_product_images ADD UNIQUE KEY product_filename (product_id,filename) USING BTREE;`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_product_images ADD UNIQUE KEY product_filename (product_id,filename) USING BTREE;`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_product_images ADD KEY FK_shop_product_images_product_id (product_id);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_product_images ADD KEY FK_shop_product_images_product_id (product_id);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_products ADD UNIQUE KEY alias (alias);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_products ADD UNIQUE KEY alias (alias);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_products ADD KEY FK_shop_products_user (user);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_products ADD KEY FK_shop_products_user (user);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_products ADD KEY FK_shop_products_currency (currency);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_products ADD KEY FK_shop_products_currency (currency);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_products ADD KEY FK_shop_products_category (category);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_products ADD KEY FK_shop_products_category (category);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_products ADD KEY FK_shop_products_parent_id (parent_id);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_products ADD KEY FK_shop_products_parent_id (parent_id);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE shop_products ADD KEY name (name);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_products ADD KEY name (name);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`ALTER TABLE users ADD UNIQUE KEY email (email);`); err != nil {
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE users ADD UNIQUE KEY email (email);`,
+		); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
 
 		// References
-		if _, err = tx.Exec(`
-			ALTER TABLE blog_cat_post_rel ADD CONSTRAINT FK_blog_cat_post_rel_post_id
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE blog_cat_post_rel ADD CONSTRAINT FK_blog_cat_post_rel_post_id
 			FOREIGN KEY (post_id) REFERENCES blog_posts (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE blog_cat_post_rel ADD CONSTRAINT FK_blog_cat_post_rel_category_id
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE blog_cat_post_rel ADD CONSTRAINT FK_blog_cat_post_rel_category_id
 			FOREIGN KEY (category_id) REFERENCES blog_cats (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE blog_cats ADD CONSTRAINT FK_blog_cats_user
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE blog_cats ADD CONSTRAINT FK_blog_cats_user
 			FOREIGN KEY (user) REFERENCES users (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE blog_posts ADD CONSTRAINT FK_blog_posts_user
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE blog_posts ADD CONSTRAINT FK_blog_posts_user
 			FOREIGN KEY (user) REFERENCES users (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE blog_posts ADD CONSTRAINT FK_blog_posts_category
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE blog_posts ADD CONSTRAINT FK_blog_posts_category
 			FOREIGN KEY (category) REFERENCES blog_cats (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE pages ADD CONSTRAINT FK_pages_user
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE pages ADD CONSTRAINT FK_pages_user
 			FOREIGN KEY (user) REFERENCES users (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE shop_cat_product_rel ADD CONSTRAINT FK_shop_cat_product_rel_product_id
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_cat_product_rel ADD CONSTRAINT FK_shop_cat_product_rel_product_id
 			FOREIGN KEY (product_id) REFERENCES shop_products (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE shop_cat_product_rel ADD CONSTRAINT FK_shop_cat_product_rel_category_id
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_cat_product_rel ADD CONSTRAINT FK_shop_cat_product_rel_category_id
 			FOREIGN KEY (category_id) REFERENCES shop_cats (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE shop_cats ADD CONSTRAINT FK_shop_cats_user
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_cats ADD CONSTRAINT FK_shop_cats_user
 			FOREIGN KEY (user) REFERENCES users (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE shop_filter_product_values ADD CONSTRAINT FK_shop_filter_product_values_product_id
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_filter_product_values ADD CONSTRAINT FK_shop_filter_product_values_product_id
 			FOREIGN KEY (product_id) REFERENCES shop_products (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE shop_filter_product_values ADD CONSTRAINT FK_shop_filter_product_values_filter_value_id
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_filter_product_values ADD CONSTRAINT FK_shop_filter_product_values_filter_value_id
 			FOREIGN KEY (filter_value_id) REFERENCES shop_filters_values (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE shop_filters_values ADD CONSTRAINT FK_shop_filters_values_filter_id
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_filters_values ADD CONSTRAINT FK_shop_filters_values_filter_id
 			FOREIGN KEY (filter_id) REFERENCES shop_filters (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE shop_orders ADD CONSTRAINT FK_shop_orders_currency_id
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_orders ADD CONSTRAINT FK_shop_orders_currency_id
 			FOREIGN KEY (currency_id) REFERENCES shop_currencies (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE shop_order_products ADD CONSTRAINT FK_shop_order_products_order_id
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_order_products ADD CONSTRAINT FK_shop_order_products_order_id
 			FOREIGN KEY (order_id) REFERENCES shop_orders (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE shop_order_products ADD CONSTRAINT FK_shop_order_products_product_id
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_order_products ADD CONSTRAINT FK_shop_order_products_product_id
 			FOREIGN KEY (product_id) REFERENCES shop_products (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE shop_product_images ADD CONSTRAINT FK_shop_product_images_product_id
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_product_images ADD CONSTRAINT FK_shop_product_images_product_id
 			FOREIGN KEY (product_id) REFERENCES shop_products (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE shop_products ADD CONSTRAINT FK_shop_products_user
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_products ADD CONSTRAINT FK_shop_products_user
 			FOREIGN KEY (user) REFERENCES users (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE shop_products ADD CONSTRAINT FK_shop_products_currency
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_products ADD CONSTRAINT FK_shop_products_currency
 			FOREIGN KEY (currency) REFERENCES shop_currencies (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE shop_products ADD CONSTRAINT FK_shop_products_category
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_products ADD CONSTRAINT FK_shop_products_category
 			FOREIGN KEY (category) REFERENCES shop_cats (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()
 			wrap.MsgError(err.Error())
 			return
 		}
-		if _, err = tx.Exec(`
-			ALTER TABLE shop_products ADD CONSTRAINT FK_shop_products_parent_id
+		if _, err = tx.Exec(
+			wrap.R.Context(),
+			`ALTER TABLE shop_products ADD CONSTRAINT FK_shop_products_parent_id
 			FOREIGN KEY (parent_id) REFERENCES shop_products (id) ON DELETE RESTRICT;
 		`); err != nil {
 			tx.Rollback()

+ 3 - 2
modules/module_shop_act_attach_product_to.go

@@ -47,8 +47,9 @@ func (this *Modules) RegisterAction_ShopAttachProductTo() *Action {
 			}
 
 			// Attach
-			if _, err := tx.Exec(`
-				UPDATE shop_products SET
+			if _, err := tx.Exec(
+				ctx,
+				`UPDATE shop_products SET
 					parent_id = ?
 				WHERE
 					id = ? AND

+ 8 - 8
modules/module_shop_act_delete.go

@@ -22,32 +22,32 @@ func (this *Modules) RegisterAction_ShopDelete() *Action {
 
 		if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 			// Block rows
-			if _, err := tx.Exec("SELECT id FROM shop_products WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT id FROM shop_products WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT product_id FROM shop_cat_product_rel WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT product_id FROM shop_cat_product_rel WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT product_id FROM shop_filter_product_values WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT product_id FROM shop_filter_product_values WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT product_id FROM shop_product_images WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT product_id FROM shop_product_images WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 
 			// Delete product attached images
-			if _, err := tx.Exec("DELETE FROM shop_product_images WHERE product_id = ?;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "DELETE FROM shop_product_images WHERE product_id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 
 			// Delete target product with category connection data
-			if _, err := tx.Exec("DELETE FROM shop_filter_product_values WHERE product_id = ?;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "DELETE FROM shop_filter_product_values WHERE product_id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("DELETE FROM shop_cat_product_rel WHERE product_id = ?;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "DELETE FROM shop_cat_product_rel WHERE product_id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("DELETE FROM shop_products WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "DELETE FROM shop_products WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 			return nil

+ 3 - 2
modules/module_shop_act_detach.go

@@ -21,8 +21,9 @@ func (this *Modules) RegisterAction_ShopDetach() *Action {
 		}
 
 		if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
-			if _, err := tx.Exec(`
-				UPDATE shop_products SET
+			if _, err := tx.Exec(
+				ctx,
+				`UPDATE shop_products SET
 					parent_id = NULL,
 					active = 0
 				WHERE

+ 7 - 6
modules/module_shop_act_duplicate.go

@@ -25,13 +25,13 @@ func (this *Modules) RegisterAction_ShopDuplicate() *Action {
 		var lastID int64 = 0
 		if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 			// Block rows
-			if _, err := tx.Exec("SELECT id FROM shop_products WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT id FROM shop_products WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT product_id FROM shop_cat_product_rel WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT product_id FROM shop_cat_product_rel WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT product_id FROM shop_filter_product_values WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT product_id FROM shop_filter_product_values WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 
@@ -42,6 +42,7 @@ func (this *Modules) RegisterAction_ShopDuplicate() *Action {
 
 			// Duplicate product
 			res, err := tx.Exec(
+				ctx,
 				`INSERT INTO shop_products (
 					parent_id,
 					user,
@@ -90,7 +91,7 @@ func (this *Modules) RegisterAction_ShopDuplicate() *Action {
 			}
 
 			// Block new product row
-			if _, err := tx.Exec("SELECT id FROM shop_products WHERE id = ? FOR UPDATE;", lastID); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT id FROM shop_products WHERE id = ? FOR UPDATE;", lastID); err != nil {
 				return err
 			}
 
@@ -122,7 +123,7 @@ func (this *Modules) RegisterAction_ShopDuplicate() *Action {
 				}
 			}
 			for _, sql_query := range cat_sqls {
-				tx.Exec(sql_query)
+				tx.Exec(ctx, sql_query)
 			}
 
 			// Duplicate attributes
@@ -153,7 +154,7 @@ func (this *Modules) RegisterAction_ShopDuplicate() *Action {
 				}
 			}
 			for _, sql_query := range attributes_sqls {
-				tx.Exec(sql_query)
+				tx.Exec(ctx, sql_query)
 			}
 
 			return nil

+ 1 - 1
modules/module_shop_act_images_reorder.go

@@ -34,7 +34,7 @@ func (this *Modules) RegisterAction_ShopImagesReorder() *Action {
 		if len(orders.Items) > 0 {
 			if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 				for _, value := range orders.Items {
-					if _, err := tx.Exec("UPDATE shop_product_images SET ord = ? WHERE id = ?;", value.Order, value.Id); err != nil {
+					if _, err := tx.Exec(ctx, "UPDATE shop_product_images SET ord = ? WHERE id = ?;", value.Order, value.Id); err != nil {
 						return err
 					}
 				}

+ 17 - 8
modules/module_shop_act_modify.go

@@ -107,6 +107,7 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 			if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 				// Insert row
 				res, err := tx.Exec(
+					ctx,
 					`INSERT INTO shop_products SET
 						user = ?,
 						currency = ?,
@@ -155,7 +156,7 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 				}
 
 				// Block rows
-				if _, err := tx.Exec("SELECT id FROM shop_products WHERE id = ? FOR UPDATE;", lastID); err != nil {
+				if _, err := tx.Exec(ctx, "SELECT id FROM shop_products WHERE id = ? FOR UPDATE;", lastID); err != nil {
 					return err
 				}
 
@@ -185,7 +186,8 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 						bulkInsertArr = append(bulkInsertArr, `(`+utils.Int64ToStr(lastID)+`,`+utils.IntToStr(el)+`)`)
 					}
 					if _, err = tx.Exec(
-						`INSERT INTO shop_cat_product_rel (product_id,category_id) VALUES ` + strings.Join(bulkInsertArr, ",") + `;`,
+						ctx,
+						`INSERT INTO shop_cat_product_rel (product_id,category_id) VALUES `+strings.Join(bulkInsertArr, ",")+`;`,
 					); err != nil {
 						return err
 					}
@@ -194,6 +196,7 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 				// Insert product and filter values relations
 				for vid, _ := range filter_values {
 					if _, err = tx.Exec(
+						ctx,
 						`INSERT INTO shop_filter_product_values SET
 							product_id = ?,
 							filter_value_id = ?
@@ -218,21 +221,22 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 		} else {
 			if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 				// Block rows
-				if _, err := tx.Exec("SELECT id FROM shop_products WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+				if _, err := tx.Exec(ctx, "SELECT id FROM shop_products WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 					return err
 				}
-				if _, err := tx.Exec("SELECT id FROM shop_currencies WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_currency)); err != nil {
+				if _, err := tx.Exec(ctx, "SELECT id FROM shop_currencies WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_currency)); err != nil {
 					return err
 				}
-				if _, err := tx.Exec("SELECT product_id FROM shop_cat_product_rel WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+				if _, err := tx.Exec(ctx, "SELECT product_id FROM shop_cat_product_rel WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 					return err
 				}
-				if _, err := tx.Exec("SELECT product_id FROM shop_filter_product_values WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+				if _, err := tx.Exec(ctx, "SELECT product_id FROM shop_filter_product_values WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 					return err
 				}
 
 				// Update row
 				if _, err := tx.Exec(
+					ctx,
 					`UPDATE shop_products SET
 						currency = ?,
 						price = ?,
@@ -271,6 +275,7 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 				// Update custom field 1
 				if _, ok := wrap.R.Form["custom1"]; ok {
 					if _, err := tx.Exec(
+						ctx,
 						`UPDATE shop_products SET
 							custom1 = ?
 						WHERE
@@ -286,6 +291,7 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 				// Update custom field 2
 				if _, ok := wrap.R.Form["custom2"]; ok {
 					if _, err := tx.Exec(
+						ctx,
 						`UPDATE shop_products SET
 							custom2 = ?
 						WHERE
@@ -299,7 +305,7 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 				}
 
 				// Delete product and categories relations
-				if _, err := tx.Exec("DELETE FROM shop_cat_product_rel WHERE product_id = ?;", utils.StrToInt(pf_id)); err != nil {
+				if _, err := tx.Exec(ctx, "DELETE FROM shop_cat_product_rel WHERE product_id = ?;", utils.StrToInt(pf_id)); err != nil {
 					return err
 				}
 
@@ -329,7 +335,8 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 						bulkInsertArr = append(bulkInsertArr, `(`+pf_id+`,`+utils.IntToStr(el)+`)`)
 					}
 					if _, err := tx.Exec(
-						`INSERT INTO shop_cat_product_rel (product_id,category_id) VALUES ` + strings.Join(bulkInsertArr, ",") + `;`,
+						ctx,
+						`INSERT INTO shop_cat_product_rel (product_id,category_id) VALUES `+strings.Join(bulkInsertArr, ",")+`;`,
 					); err != nil {
 						return err
 					}
@@ -337,6 +344,7 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 
 				// Delete product and filter values relations
 				if _, err := tx.Exec(
+					ctx,
 					`DELETE FROM shop_filter_product_values WHERE product_id = ?;`,
 					utils.StrToInt(pf_id),
 				); err != nil {
@@ -346,6 +354,7 @@ func (this *Modules) RegisterAction_ShopModify() *Action {
 				// Insert product and filter values relations
 				for vid, _ := range filter_values {
 					if _, err := tx.Exec(
+						ctx,
 						`INSERT INTO shop_filter_product_values SET
 							product_id = ?,
 							filter_value_id = ?

+ 2 - 0
modules/module_shop_act_order.go

@@ -102,6 +102,7 @@ func (this *Modules) RegisterAction_ShopOrder() *Action {
 		if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 			// Insert row
 			res, err := tx.Exec(
+				ctx,
 				`INSERT INTO shop_orders SET
 					create_datetime = ?,
 					update_datetime = ?,
@@ -148,6 +149,7 @@ func (this *Modules) RegisterAction_ShopOrder() *Action {
 			// Insert order products
 			for _, product := range *(*bdata).Products {
 				if _, err = tx.Exec(
+					ctx,
 					`INSERT INTO shop_order_products (id, order_id, product_id, price, quantity) VALUES (NULL, ?, ?, ?, ?);`,
 					lastID, product.A_product_id, product.A_price, product.A_quantity,
 				); err != nil {

+ 1 - 0
modules/module_shop_act_order_set_status.go

@@ -33,6 +33,7 @@ func (this *Modules) RegisterAction_ShopOrderSetStatus() *Action {
 
 		if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 			if _, err := tx.Exec(
+				ctx,
 				`UPDATE shop_orders SET
 					status = ?
 				WHERE

+ 3 - 3
modules/module_shop_act_upload_delete.go

@@ -29,15 +29,15 @@ func (this *Modules) RegisterAction_ShopUploadDelete() *Action {
 
 		if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 			// Block rows
-			if _, err := tx.Exec("SELECT id FROM shop_products WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT id FROM shop_products WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT product_id FROM shop_product_images WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT product_id FROM shop_product_images WHERE product_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 
 			// Delete row
-			if _, err := tx.Exec("DELETE FROM shop_product_images WHERE product_id = ? AND filename = ?;", utils.StrToInt(pf_id), pf_file); err != nil {
+			if _, err := tx.Exec(ctx, "DELETE FROM shop_product_images WHERE product_id = ? AND filename = ?;", utils.StrToInt(pf_id), pf_file); err != nil {
 				return err
 			}
 

+ 2 - 1
modules/module_shop_act_upload_image.go

@@ -55,12 +55,13 @@ func (this *Modules) RegisterAction_ShopUploadImage() *Action {
 								var lastID int64 = 0
 								if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 									// Block rows
-									if _, err := tx.Exec("SELECT id FROM shop_products WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+									if _, err := tx.Exec(ctx, "SELECT id FROM shop_products WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 										return err
 									}
 
 									// Insert row
 									res, err := tx.Exec(
+										ctx,
 										`INSERT INTO shop_product_images SET
 											product_id = ?,
 											filename = ?,

+ 6 - 2
modules/module_shop_attributes_act_delete.go

@@ -22,13 +22,14 @@ func (this *Modules) RegisterAction_ShopAttributesDelete() *Action {
 
 		err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 			// Block rows
-			if _, err := tx.Exec("SELECT id FROM shop_filters WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT id FROM shop_filters WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT id FROM shop_filters_values WHERE filter_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT id FROM shop_filters_values WHERE filter_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 			if _, err := tx.Exec(
+				ctx,
 				`SELECT
 					shop_filter_product_values.product_id
 				FROM
@@ -45,6 +46,7 @@ func (this *Modules) RegisterAction_ShopAttributesDelete() *Action {
 
 			// Process
 			if _, err := tx.Exec(
+				ctx,
 				`DELETE
 					shop_filter_product_values
 				FROM
@@ -59,12 +61,14 @@ func (this *Modules) RegisterAction_ShopAttributesDelete() *Action {
 				return err
 			}
 			if _, err := tx.Exec(
+				ctx,
 				`DELETE FROM shop_filters_values WHERE filter_id = ?;`,
 				utils.StrToInt(pf_id),
 			); err != nil {
 				return err
 			}
 			if _, err := tx.Exec(
+				ctx,
 				`DELETE FROM shop_filters WHERE id = ?;`,
 				utils.StrToInt(pf_id),
 			); err != nil {

+ 13 - 3
modules/module_shop_attributes_act_modify.go

@@ -50,6 +50,7 @@ func (this *Modules) RegisterAction_ShopAttributesModify() *Action {
 			if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 				// Insert row
 				res, err := tx.Exec(
+					ctx,
 					`INSERT INTO shop_filters SET
 						name = ?,
 						filter = ?
@@ -68,13 +69,14 @@ func (this *Modules) RegisterAction_ShopAttributesModify() *Action {
 				}
 
 				// Block rows
-				if _, err := tx.Exec("SELECT id FROM shop_filters WHERE id = ? FOR UPDATE;", lastID); err != nil {
+				if _, err := tx.Exec(ctx, "SELECT id FROM shop_filters WHERE id = ? FOR UPDATE;", lastID); err != nil {
 					return err
 				}
 
 				// Insert values
 				for vname, _ := range filter_values {
 					if _, err = tx.Exec(
+						ctx,
 						`INSERT INTO shop_filters_values SET
 							filter_id = ?,
 							name = ?
@@ -99,13 +101,14 @@ func (this *Modules) RegisterAction_ShopAttributesModify() *Action {
 		} else {
 			if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 				// Block rows
-				if _, err := tx.Exec("SELECT id FROM shop_filters WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+				if _, err := tx.Exec(ctx, "SELECT id FROM shop_filters WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 					return err
 				}
-				if _, err := tx.Exec("SELECT id FROM shop_filters_values WHERE filter_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+				if _, err := tx.Exec(ctx, "SELECT id FROM shop_filters_values WHERE filter_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 					return err
 				}
 				if _, err := tx.Exec(
+					ctx,
 					`SELECT
 						shop_filter_product_values.product_id
 					FROM
@@ -122,6 +125,7 @@ func (this *Modules) RegisterAction_ShopAttributesModify() *Action {
 
 				// Update row
 				if _, err := tx.Exec(
+					ctx,
 					`UPDATE shop_filters SET
 						name = ?,
 						filter = ?
@@ -144,6 +148,7 @@ func (this *Modules) RegisterAction_ShopAttributesModify() *Action {
 				}
 				if len(ignore_ids) > 0 {
 					if _, err := tx.Exec(
+						ctx,
 						`DELETE
 							shop_filter_product_values
 						FROM
@@ -159,6 +164,7 @@ func (this *Modules) RegisterAction_ShopAttributesModify() *Action {
 						return err
 					}
 					if _, err := tx.Exec(
+						ctx,
 						`DELETE FROM shop_filters_values WHERE filter_id = ? AND id NOT IN (`+strings.Join(ignore_ids, ",")+`);`,
 						utils.StrToInt(pf_id),
 					); err != nil {
@@ -166,6 +172,7 @@ func (this *Modules) RegisterAction_ShopAttributesModify() *Action {
 					}
 				} else {
 					if _, err := tx.Exec(
+						ctx,
 						`DELETE
 							shop_filter_product_values
 						FROM
@@ -180,6 +187,7 @@ func (this *Modules) RegisterAction_ShopAttributesModify() *Action {
 						return err
 					}
 					if _, err := tx.Exec(
+						ctx,
 						`DELETE FROM shop_filters_values WHERE filter_id = ?;`,
 						utils.StrToInt(pf_id),
 					); err != nil {
@@ -191,6 +199,7 @@ func (this *Modules) RegisterAction_ShopAttributesModify() *Action {
 				for vname, vid := range filter_values {
 					if vid == 0 {
 						if _, err := tx.Exec(
+							ctx,
 							`INSERT INTO shop_filters_values SET
 								filter_id = ?,
 								name = ?
@@ -202,6 +211,7 @@ func (this *Modules) RegisterAction_ShopAttributesModify() *Action {
 						}
 					} else {
 						if _, err := tx.Exec(
+							ctx,
 							`UPDATE shop_filters_values SET
 								name = ?
 							WHERE

+ 10 - 10
modules/module_shop_categories_act_delete.go

@@ -22,38 +22,38 @@ func (this *Modules) RegisterAction_ShopCategoriesDelete() *Action {
 
 		err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 			// Block rows
-			if _, err := tx.Exec("SELECT id FROM shop_cats FOR UPDATE;"); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT id FROM shop_cats FOR UPDATE;"); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT category_id FROM shop_cat_product_rel WHERE category_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT category_id FROM shop_cat_product_rel WHERE category_id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT id FROM shop_products WHERE category = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT id FROM shop_products WHERE category = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 
 			// Set root category
-			if _, err := tx.Exec("UPDATE shop_products SET category = 1 WHERE category = ?;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "UPDATE shop_products SET category = 1 WHERE category = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 
 			// Process
-			if _, err := tx.Exec("DELETE FROM shop_cat_product_rel WHERE category_id = ?;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "DELETE FROM shop_cat_product_rel WHERE category_id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT @ml := lft, @mr := rgt FROM shop_cats WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT @ml := lft, @mr := rgt FROM shop_cats WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("DELETE FROM shop_cats WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "DELETE FROM shop_cats WHERE id = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("UPDATE shop_cats SET lft = lft - 1, rgt = rgt - 1 WHERE lft > @ml AND rgt < @mr;"); err != nil {
+			if _, err := tx.Exec(ctx, "UPDATE shop_cats SET lft = lft - 1, rgt = rgt - 1 WHERE lft > @ml AND rgt < @mr;"); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("UPDATE shop_cats SET lft = lft - 2 WHERE lft > @mr;"); err != nil {
+			if _, err := tx.Exec(ctx, "UPDATE shop_cats SET lft = lft - 2 WHERE lft > @mr;"); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("UPDATE shop_cats SET rgt = rgt - 2 WHERE rgt > @mr;"); err != nil {
+			if _, err := tx.Exec(ctx, "UPDATE shop_cats SET rgt = rgt - 2 WHERE rgt > @mr;"); err != nil {
 				return err
 			}
 			return nil

+ 18 - 17
modules/module_shop_categories_act_modify.go

@@ -12,24 +12,24 @@ func (this *Modules) shop_ActionCategoryAdd(wrap *wrapper.Wrapper, pf_id, pf_nam
 	var lastID int64 = 0
 	return wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 		// Block rows
-		if _, err := tx.Exec("SELECT id FROM shop_cats FOR UPDATE;"); err != nil {
+		if _, err := tx.Exec(ctx, "SELECT id FROM shop_cats FOR UPDATE;"); err != nil {
 			return err
 		}
 
 		// Process
-		if _, err := tx.Exec("SELECT @mr := rgt FROM shop_cats WHERE id = ?;", utils.StrToInt(pf_parent)); err != nil {
+		if _, err := tx.Exec(ctx, "SELECT @mr := rgt FROM shop_cats WHERE id = ?;", utils.StrToInt(pf_parent)); err != nil {
 			return err
 		}
-		if _, err := tx.Exec("UPDATE shop_cats SET rgt = rgt + 2 WHERE rgt > @mr;"); err != nil {
+		if _, err := tx.Exec(ctx, "UPDATE shop_cats SET rgt = rgt + 2 WHERE rgt > @mr;"); err != nil {
 			return err
 		}
-		if _, err := tx.Exec("UPDATE shop_cats SET lft = lft + 2 WHERE lft > @mr;"); err != nil {
+		if _, err := tx.Exec(ctx, "UPDATE shop_cats SET lft = lft + 2 WHERE lft > @mr;"); err != nil {
 			return err
 		}
-		if _, err := tx.Exec("UPDATE shop_cats SET rgt = rgt + 2 WHERE id = ?;", utils.StrToInt(pf_parent)); err != nil {
+		if _, err := tx.Exec(ctx, "UPDATE shop_cats SET rgt = rgt + 2 WHERE id = ?;", utils.StrToInt(pf_parent)); err != nil {
 			return err
 		}
-		res, err := tx.Exec("INSERT INTO shop_cats (id, user, name, alias, lft, rgt) VALUES (NULL, ?, ?, ?, @mr, @mr + 1);", wrap.User.A_id, pf_name, pf_alias)
+		res, err := tx.Exec(ctx, "INSERT INTO shop_cats (id, user, name, alias, lft, rgt) VALUES (NULL, ?, ?, ?, @mr, @mr + 1);", wrap.User.A_id, pf_name, pf_alias)
 		if err != nil {
 			return err
 		}
@@ -48,8 +48,9 @@ func (this *Modules) shop_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 		// If parent not changed, just update category data
 		return wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 			// Process
-			if _, err := tx.Exec(`
-				UPDATE shop_cats SET
+			if _, err := tx.Exec(
+				ctx,
+				`UPDATE shop_cats SET
 					name = ?,
 					alias = ?
 				WHERE
@@ -71,7 +72,7 @@ func (this *Modules) shop_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 	// Parent is changed, move category to new parent
 	return wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 		// Block all rows
-		if _, err := tx.Exec("SELECT id FROM shop_cats FOR UPDATE;"); err != nil {
+		if _, err := tx.Exec(ctx, "SELECT id FROM shop_cats FOR UPDATE;"); err != nil {
 			return err
 		}
 
@@ -112,13 +113,13 @@ func (this *Modules) shop_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 				// From right to left
 				// Shift
 				step := targetR - targetL + 1
-				if _, err := tx.Exec("UPDATE shop_cats SET lft = lft + ? WHERE lft > ? and lft < ?;", step, parentR, targetL); err != nil {
+				if _, err := tx.Exec(ctx, "UPDATE shop_cats SET lft = lft + ? WHERE lft > ? and lft < ?;", step, parentR, targetL); err != nil {
 					return err
 				}
-				if _, err := tx.Exec("UPDATE shop_cats SET rgt = rgt + ? WHERE rgt > ? and rgt < ?;", step, parentR, targetL); err != nil {
+				if _, err := tx.Exec(ctx, "UPDATE shop_cats SET rgt = rgt + ? WHERE rgt > ? and rgt < ?;", step, parentR, targetL); err != nil {
 					return err
 				}
-				if _, err := tx.Exec("UPDATE shop_cats SET rgt = rgt + ? WHERE id = ?;", step, utils.StrToInt(pf_parent)); err != nil {
+				if _, err := tx.Exec(ctx, "UPDATE shop_cats SET rgt = rgt + ? WHERE id = ?;", step, utils.StrToInt(pf_parent)); err != nil {
 					return err
 				}
 
@@ -126,7 +127,7 @@ func (this *Modules) shop_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 				for i, _ := range rows_id {
 					new_lft := rows_lft[i] - (targetL - parentR)
 					new_rgt := rows_rgt[i] - (targetL - parentR)
-					if _, err := tx.Exec("UPDATE shop_cats SET lft = ?, rgt = ? WHERE id = ?;", new_lft, new_rgt, rows_id[i]); err != nil {
+					if _, err := tx.Exec(ctx, "UPDATE shop_cats SET lft = ?, rgt = ? WHERE id = ?;", new_lft, new_rgt, rows_id[i]); err != nil {
 						return err
 					}
 				}
@@ -134,10 +135,10 @@ func (this *Modules) shop_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 				// From left to right
 				// Shift
 				step := targetR - targetL + 1
-				if _, err := tx.Exec("UPDATE shop_cats SET lft = lft - ? WHERE lft > ? and lft < ?;", step, targetR, parentR); err != nil {
+				if _, err := tx.Exec(ctx, "UPDATE shop_cats SET lft = lft - ? WHERE lft > ? and lft < ?;", step, targetR, parentR); err != nil {
 					return err
 				}
-				if _, err := tx.Exec("UPDATE shop_cats SET rgt = rgt - ? WHERE rgt > ? and rgt < ?;", step, targetR, parentR); err != nil {
+				if _, err := tx.Exec(ctx, "UPDATE shop_cats SET rgt = rgt - ? WHERE rgt > ? and rgt < ?;", step, targetR, parentR); err != nil {
 					return err
 				}
 
@@ -145,7 +146,7 @@ func (this *Modules) shop_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 				for i, _ := range rows_id {
 					new_lft := rows_lft[i] + (parentR - targetL - step)
 					new_rgt := rows_rgt[i] + (parentR - targetL - step)
-					if _, err := tx.Exec("UPDATE shop_cats SET lft = ?, rgt = ? WHERE id = ?;", new_lft, new_rgt, rows_id[i]); err != nil {
+					if _, err := tx.Exec(ctx, "UPDATE shop_cats SET lft = ?, rgt = ? WHERE id = ?;", new_lft, new_rgt, rows_id[i]); err != nil {
 						return err
 					}
 				}
@@ -156,7 +157,7 @@ func (this *Modules) shop_ActionCategoryUpdate(wrap *wrapper.Wrapper, pf_id, pf_
 		}
 
 		// Update target cat data
-		if _, err := tx.Exec("UPDATE shop_cats SET name = ?, alias = ? WHERE id = ?;", pf_name, pf_alias, utils.StrToInt(pf_id)); err != nil {
+		if _, err := tx.Exec(ctx, "UPDATE shop_cats SET name = ?, alias = ? WHERE id = ?;", pf_name, pf_alias, utils.StrToInt(pf_id)); err != nil {
 			return err
 		}
 

+ 1 - 0
modules/module_shop_currencies_act_delete.go

@@ -23,6 +23,7 @@ func (this *Modules) RegisterAction_ShopCurrenciesDelete() *Action {
 		err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 			// Process
 			if _, err := tx.Exec(
+				ctx,
 				`DELETE FROM shop_currencies WHERE id = ?;`,
 				utils.StrToInt(pf_id),
 			); err != nil {

+ 3 - 1
modules/module_shop_currencies_act_modify.go

@@ -49,6 +49,7 @@ func (this *Modules) RegisterAction_ShopCurrenciesModify() *Action {
 			if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 				// Insert row
 				res, err := tx.Exec(
+					ctx,
 					`INSERT INTO shop_currencies SET
 						name = ?,
 						coefficient = ?,
@@ -84,12 +85,13 @@ func (this *Modules) RegisterAction_ShopCurrenciesModify() *Action {
 		} else {
 			if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 				// Block rows
-				if _, err := tx.Exec("SELECT id FROM shop_currencies WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+				if _, err := tx.Exec(ctx, "SELECT id FROM shop_currencies WHERE id = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 					return err
 				}
 
 				// Update row
 				if _, err := tx.Exec(
+					ctx,
 					`UPDATE shop_currencies SET
 						name = ?,
 						coefficient = ?,

+ 8 - 8
modules/module_users_act_delete.go

@@ -22,30 +22,30 @@ func (this *Modules) RegisterAction_UsersDelete() *Action {
 
 		err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 			// Block rows
-			if _, err := tx.Exec("SELECT id FROM blog_cats WHERE user = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT id FROM blog_cats WHERE user = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT id FROM blog_posts WHERE user = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT id FROM blog_posts WHERE user = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT id FROM pages WHERE user = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT id FROM pages WHERE user = ? FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("SELECT id FROM users WHERE id = ? and id > 1 FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "SELECT id FROM users WHERE id = ? and id > 1 FOR UPDATE;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 
 			// Process
-			if _, err := tx.Exec("UPDATE blog_cats SET user = 1 WHERE user = ?;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "UPDATE blog_cats SET user = 1 WHERE user = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("UPDATE blog_posts SET user = 1 WHERE user = ?;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "UPDATE blog_posts SET user = 1 WHERE user = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("UPDATE pages SET user = 1 WHERE user = ?;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "UPDATE pages SET user = 1 WHERE user = ?;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
-			if _, err := tx.Exec("DELETE FROM users WHERE id = ? and id > 1;", utils.StrToInt(pf_id)); err != nil {
+			if _, err := tx.Exec(ctx, "DELETE FROM users WHERE id = ? and id > 1;", utils.StrToInt(pf_id)); err != nil {
 				return err
 			}
 			return nil

+ 3 - 0
modules/module_users_act_modify.go

@@ -61,6 +61,7 @@ func (this *Modules) RegisterAction_UsersModify() *Action {
 			var lastID int64 = 0
 			if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 				res, err := tx.Exec(
+					ctx,
 					`INSERT INTO users SET
 						first_name = ?,
 						last_name = ?,
@@ -96,6 +97,7 @@ func (this *Modules) RegisterAction_UsersModify() *Action {
 			if pf_password == "" {
 				if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 					_, err := tx.Exec(
+						ctx,
 						`UPDATE users SET
 							first_name = ?,
 							last_name = ?,
@@ -123,6 +125,7 @@ func (this *Modules) RegisterAction_UsersModify() *Action {
 			} else {
 				if err := wrap.DB.Transaction(wrap.R.Context(), func(ctx context.Context, tx *wrapper.Tx) error {
 					_, err := tx.Exec(
+						ctx,
 						`UPDATE users SET
 							first_name = ?,
 							last_name = ?,